# Generated automatically from Makefile.in by configure.
#
# on SUN under SunOS 4.1.3
#
## and manually adapted to OS/2 & EMX0.8h by Gregor Buehler (5 Oct 94).
## Sorry, a lot of defs and rules were thrown out,
## because they were not useful in my environment.
## Use following targets with make <target>:
##	'all'         - default - does all within 'srcdir'
##	'install'     - installs within EMX dirs (if required alter below)
##            'uninstall'   - uninstalls off EMX dirs
##	'clean'       - cleans produced files afer install
## Rules for producing a standalone version were added.
## This can be run under DOS or OS/2 without having EMX.
## 'binson.hairy' was renamed 'bison.hai' for poor DOSers.
#
# Makefile for bison
# copyright (C) 1988, 1989, 1991, 1993 Bob Corbett and Free Software Foundation, Inc.
# 
# This file is part of Bison, the GNU Compiler Compiler.
# 
# Bison is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# 
# Bison is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with Bison; see the file copyING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

#### Start of system configuration section. ####


# the path defs are mostly twofold
# due to GNU/UNIX Style '/' and
# OS/2 '\'

srcdir = \bison
srcdir_gnu = /bison

CC = gcc

# Things you might add to DEFS:
# -DSTDC_HEADERS	If you have ANSI C headers and libraries.
# -DHAVE_STRING_H	If you don't have ANSI C headers but have string.h.
# -DHAVE_MEMORY_H	If you don't have ANSI C headers and have memory.h.
# -DHAVE_STRERROR	If you have strerror function.
# This is true for 'gcc': 
DEFS =  -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA_H=1 -DEMX_OS2DOS_PORTABILITY=1

CFLAGS = -O2
CPPFLAGS =
LDFLAGS = -O2 -s
EMXBIND_FLAGS = -bsvw

prefix=\emx
prefix_gnu=/emx

# where the installed emx binary goes
bindir = $(prefix)\bin
bindir_gnu = $(prefix_gnu)/bin

# where the parsers skeletons go
libdir = $(prefix)\lib
libdir_gnu = $(prefix_gnu)/lib

# where the headers go
incdir = $(prefix)\include 
incdir_gnu = $(prefix_gnu)/include

# where the info files go
infodir = $(prefix)\info

# where manual pages go and what their extensions should be
# someone should add a rule and program to compile the manual
# to OS/2 INF format
mandir = $(prefix)\book

#### End of system configuration section. ####


# files of binary OS/2 & EMX distribution

BINDISTFILES = $(srcdir_gnu)/bison.exe $(srcdir_gnu)/bisonsta.exe $(srcdir_gnu)/$(PFILE) \
               $(srcdir_gnu)/$(HFILE) $(srcdir_gnu)/$(PFILE1)\
               $(srcdir_gnu)/makefile $(srcdir_gnu)/bisonppm.txt $(srcdir_gnu)/00readme.emx\
	       $(srcdir_gnu)/install.bat $(srcdir_gnu)/install.cmd $(srcdir_gnu)/patch.emx\
	       $(srcdir_gnu)/files.c


# names of parser files
PFILE = bison.cc
PFILE1 = bison.hai
HFILE = bison.h

PFILES = -DXPFILE=\"$(libdir_gnu)/$(PFILE)\" \
	 -DXHFILE=\"$(incdir_gnu)/$(HFILE)\" \
	 -DXPFILE1=\"$(libdir_gnu)/$(PFILE1)\"

# for the standalone version, the parser files shall be
# in same directory as the executable
PFILES_STA = -DXPFILE=\"$(srcdir_gnu)/$(PFILE)\" \
	 -DXHFILE=\"$(srcdir_gnu)/$(HFILE)\" \
	 -DXPFILE1=\"$(srcdir_gnu)/$(PFILE1)\"

OBJECTS_COMMON = lr0.o allocate.o closure.o conflict.o derives.o        \
	  getargs.o gram.o lalr.o lex.o					\
	  main.o nullable.o output.o print.o reader.o reduce.o symtab.o	\
	  warshall.o version.o						\
	  getopt.o getopt1.o

OBJECTS = $(OBJECTS_COMMON) files.o
OBJECTS_STA = $(OBJECTS_COMMON) files_sta.o



all: bison.exe bisonsta.exe bison.info bisonpp.zip


# make EMX binary for common EMX or RSX environment

bison.exe: $(OBJECTS)
	$(CC) $(LDFLAGS) -o $@ $(OBJECTS)


# make the standalone files for machines without EMX or RSX

bisonsta.exe: $(OBJECTS_STA)
	$(CC) $(LDFLAGS) -o $@ $(OBJECTS_STA)	
	emxbind -xq bisonsta.exe a.out
	emxbind $(EMXBIND_FLAGS) -q $(bindir)\emx.exe a.out bisonsta.exe
	del a.out


# make the info files for GNU info browser

bison.info: bison.texinfo
	makeinfo bison.texinfo


# make a distribution file of the binaries, skeletons, makefile, and manual

bisonpp.zip: $(BINDISTFILES)
	zip -k bisonpp.zip $(BINDISTFILES)

clean:
	del *.o bison.exe bisonsta.exe bison.i*
	del bisonpp.zip

install: all $(BINDISTFILES)
	xcopy bison.exe $(bindir) /O
	xcopy $(srcdir)\$(PFILE) $(libdir) /O
	xcopy $(srcdir)\$(HFILE) $(incdir) /O
	xcopy $(srcdir)\$(PFILE1) $(libdir) /O
	xcopy $(srcdir)\bisonppm.txt $(mandir) /O
	xcopy $(srcdir)\bison.info $(infodir) /O
	xcopy $(srcdir)\bison.i* $(infodir) /O

uninstall:
	del $(bindir)\bison.exe
	del $(libdir)\$(PFILE) $(incdir)\$(HFILE) $(libdir)\$(PFILE1)
	del $(mandir)\bisonppm.txt
	del $(infodir)\bison.i*




# This rule allows us to supply the necessary -D options
# in addition to whatever the user asks for.
.c.o:
	$(CC) -c $(DEFS) $(CPPFLAGS) $(CFLAGS) $<

# This file is different to pass the parser file names to the compiler.
files.o: files.c
	$(CC) -c $(PFILES) $(DEFS) $(CPPFLAGS) $(CFLAGS) \
	   $(srcdir_gnu)/files.c

# This is 'files' for the standalone version
files_sta.o: files.c
	$(CC) -c $(PFILES_STA) $(DEFS) $(CPPFLAGS) $(CFLAGS) \
	   $(srcdir_gnu)/files.c -o files_sta.o

lr0.o: system.h machine.h new.h gram.h state.h
closure.o: system.h machine.h new.h gram.h
conflict.o: system.h machine.h new.h files.h gram.h state.h
derives.o: system.h new.h types.h gram.h
files.o: system.h files.h new.h gram.h
getargs.o: system.h files.h
lalr.o: system.h machine.h types.h state.h new.h gram.h
lex.o: system.h files.h symtab.h lex.h
main.o: system.h machine.h
nullable.o: system.h types.h gram.h new.h
output.o: system.h machine.h new.h files.h gram.h state.h
print.o: system.h machine.h new.h files.h gram.h state.h
reader.o: system.h files.h new.h symtab.h lex.h gram.h
reduce.o: system.h machine.h files.h new.h gram.h
symtab.o: system.h new.h symtab.h gram.h
warshall.o: system.h machine.h

# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
