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

SRC = Src/
OBJ = Obj/

CC = SC

# Things you might add to DEFS:
# STDC_HEADERS      If you have ANSI C headers and libraries.
# HAVE_STRING_H     If you don't have ANSI C headers but have string.h.
# HAVE_MEMORY_H     If you don't have ANSI C headers and have memory.h.
# HAVE_STRERROR     If you have strerror function.
DEFS = DEFINE=STDC_HEADERS

# Some System V machines do not come with libPW.  If this is true, use
# the GNU alloca.o here.
ALLOCA = $(OBJ)alloca.o

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

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

# names of parser files
PFILE  = Bison.simple
PFILE1 = Bison.hairy

PFILES = DEFINE XPFILE="PROGDIR:$(PFILE)" DEFINE XPFILE1="PROGDIR:$(PFILE1)"

OBJECTS = $(OBJ)LR0.o     $(OBJ)allocate.o $(OBJ)closure.o $(OBJ)conflicts.o \
		  $(OBJ)derives.o $(OBJ)files.o    $(OBJ)getargs.o $(OBJ)gram.o      \
		  $(OBJ)lalr.o    $(OBJ)lex.o      $(OBJ)main.o    $(OBJ)nullable.o  \
		  $(OBJ)output.o  $(OBJ)print.o    $(OBJ)reader.o  $(OBJ)reduce.o    \
		  $(OBJ)symtab.o  $(OBJ)warshall.o $(OBJ)getopt.o  $(OBJ)getopt1.o   \
		  $(OBJ)version.o $(ALLOCA)

all: Bison

Bison: $(OBJECTS)
	@$(CC) $(LDFLAGS) LINK TO $@ $(OBJECTS) $(LIBS)

# This file is different to pass the parser file names to the compiler.
$(OBJ)files.o     : $(SRC)files.c
	@$(CC) $(PFILES) $(DEFS) $(SRC)files.c OBJNAME=$(OBJ)files.o

$(OBJ)alloca.o    : $(SRC)alloca.c
$(OBJ)allocate.o  : $(SRC)allocate.c
$(OBJ)closure.o   : $(SRC)closure.c
$(OBJ)conflicts.o : $(SRC)conflicts.c
$(OBJ)derives.o   : $(SRC)derives.c
$(OBJ)LR0.o       : $(SRC)LR0.c
$(OBJ)getargs.o   : $(SRC)getargs.c
$(OBJ)gram.o      : $(SRC)gram.c
$(OBJ)lalr.o      : $(SRC)lalr.c
$(OBJ)lex.o       : $(SRC)lex.c
$(OBJ)main.o      : $(SRC)main.c
$(OBJ)nullable.o  : $(SRC)nullable.c
$(OBJ)output.o    : $(SRC)output.c
$(OBJ)print.o     : $(SRC)print.c
$(OBJ)reader.o    : $(SRC)reader.c
$(OBJ)symtab.o    : $(SRC)symtab.c
$(OBJ)warshall.o  : $(SRC)warshall.c
$(OBJ)getopt.o    : $(SRC)getopt.c
$(OBJ)getopt1.o   : $(SRC)getopt1.c
$(OBJ)reduce.o    : $(SRC)reduce.c
$(OBJ)version.o   : $(SRC)version.c

