#######################################################################
##                             Copyright (C) 1999                    ##
##              Keldysh Institute of Appllied Mathematics            ##
#######################################################################

# dvm/fdvm/parser/makefile.uni

#	HDR	traditional header files.
#	HDRg	header files generated by programs.
#	SRC	traditional source files.
#	SRCg	source files generated by programs.
#	OBJS	object files required to load the program.
#

BINDIR = ../../bin
LIBDIR = ../lib

SAGEROOT = ../Sage
LIBINCLUDE = $(SAGEROOT)/lib/include
HINCLUDE = $(SAGEROOT)/h
DVMINCLUDE = ../include
EXECUTABLES = parse

INCL = -I. -I$(DVMINCLUDE) -I$(LIBINCLUDE) -I$(HINCLUDE)

# -w don't issue warning now.
CFLAGS=$(INCL) -c -DSYS5 -Wall

$(OUTDIR)/%.o:%.c
	$(CC) $(CFLAGS) -o $(OUTDIR)/$*.o $<

gram1.tab.o: gram1.tab.c
	$(CC) $(CFLAGS) -DYYDEBUG gram1.tab.c
LIBS = $(LIBDIR)/libdb.a 
FDVM = $(DVMINCLUDE)/dvm_tag.h
HDR = $(DVMINCLUDE)/inc.h $(HINCLUDE)/defs.h $(DVMINCLUDE)/fdvm.h $(HINCLUDE)/bif.h \
	$(HINCLUDE)/ll.h $(HINCLUDE)/symb.h $(HINCLUDE)/defines.h \
	$(DVMINCLUDE)/extern.h $(HINCLUDE)/sets.h tag tokens
TOOLBOX_HDR = $(LIBINCLUDE)/macro.h $(LIBINCLUDE)/bif_node.def $(LIBINCLUDE)/type.def $(LIBINCLUDE)/symb.def
HDRg = tag.h tokdefs.h

HDRS = $(HDR) $(HDRg)
# !!
SRC = cftn.c init.c hash.c lexfdvm.c lists.c misc.c stat.c errors.c types.c sym.c \
	low_hpf.c unparse_hpf.c
#!!
SRCg = gram.tab.c

SRCS = $(SRC) $(SRCg)
#!! 
OBJS = cftn.o errors.o hash.o init.o \
	lexfdvm.o lists.o misc.o stat.o \
	types.o gram1.tab.o sym.o low_hpf.o unparse_hpf.o

$(BINDIR)/$(EXECUTABLES): $(OBJS)
	$(LINKER) -o $(BINDIR)/$(EXECUTABLES) $(OBJS) $(LIBS)

all: $(BINDIR)/$(EXECUTABLES)
	@echo "****** COMPILING EXECUTABLE $(EXECUTABLES) DONE ******"

clean:
	rm -f $(OBJS)
cleanall:
	rm -f $(OBJS)

# ***********************************************************

###
cftn.o: $(HINCLUDE)/db.h $(HINCLUDE)/defs.h $(HINCLUDE)/tag $(HINCLUDE)/bif.h \
	$(HINCLUDE)/ll.h $(HINCLUDE)/symb.h $(HINCLUDE)/sets.h
ftn.gram: $(DVMINCLUDE)/extern.h $(HINCLUDE)/defines.h $(HINCLUDE)/defs.h \
	$(DVMINCLUDE)/fdvm.h $(HINCLUDE)/bif.h $(HINCLUDE)/ll.h $(HINCLUDE)/symb.h \
	$(HINCLUDE)/sets.h
commsym.o: $(HINCLUDE)/defs.h $(HINCLUDE)/tag $(HINCLUDE)/symb.h $(HINCLUDE)/defines.h \
	$(HINCLUDE)/bif.h $(DVMINCLUDE)/extern.h $(HINCLUDE)/db.h $(HINCLUDE)/ll.h \
	$(HINCLUDE)/sets.h
errors.o: $(HINCLUDE)/defs.h $(HINCLUDE)/tag $(HINCLUDE)/symb.h $(DVMINCLUDE)/extern.h \
	$(HINCLUDE)/db.h $(HINCLUDE)/bif.h $(HINCLUDE)/ll.h $(HINCLUDE)/sets.h
exec.o: $(HINCLUDE)/defs.h $(HINCLUDE)/tag
gram.o: $(HINCLUDE)/defs.h \
	$(HINCLUDE)/tag $(HINCLUDE)/bif.h $(HINCLUDE)/ll.h $(HINCLUDE)/symb.h \
	$(HINCLUDE)/sets.h $(DVMINCLUDE)/extern.h $(HINCLUDE)/db.h $(HINCLUDE)/defines.h 
hash.o: $(HINCLUDE)/defs.h $(HINCLUDE)/symb.h $(HINCLUDE)/defines.h $(DVMINCLUDE)/extern.h \
	$(HINCLUDE)/db.h $(HINCLUDE)/bif.h $(HINCLUDE)/ll.h $(HINCLUDE)/sets.h $(HINCLUDE)/tag
init.o: $(DVMINCLUDE)/inc.h $(HINCLUDE)/defs.h $(HINCLUDE)/bif.h $(HINCLUDE)/defines.h \
	$(HINCLUDE)/ll.h $(HINCLUDE)/symb.h $(HINCLUDE)/sets.h $(HINCLUDE)/db.h $(HINCLUDE)/tag
# !!
lexfdvm.o: $(DVMINCLUDE)/extern.h
lists.o: $(HINCLUDE)/defs.h $(HINCLUDE)/ll.h $(HINCLUDE)/symb.h $(HINCLUDE)/bif.h
misc.o: $(HINCLUDE)/defs.h $(HINCLUDE)/tag $(HINCLUDE)/defines.h $(HINCLUDE)/db.h \
	$(HINCLUDE)/bif.h $(HINCLUDE)/ll.h $(HINCLUDE)/symb.h $(HINCLUDE)/sets.h
stat.o: $(HINCLUDE)/defs.h $(HINCLUDE)/bif.h $(HINCLUDE)/ll.h $(HINCLUDE)/symb.h\
	$(HINCLUDE)/sets.h $(HINCLUDE)/defines.h $(DVMINCLUDE)/extern.h
sym.o: $(HINCLUDE)/defs.h $(HINCLUDE)/tag $(HINCLUDE)/symb.h $(HINCLUDE)/defines.h \
	$(HINCLUDE)/bif.h $(DVMINCLUDE)/extern.h $(HINCLUDE)/db.h $(HINCLUDE)/ll.h \
	$(HINCLUDE)/sets.h $(DVMINCLUDE)/fdvm.h
types.o: $(HINCLUDE)/defs.h $(HINCLUDE)/ll.h $(HINCLUDE)/symb.h
low_hpf.o: $(FDVM) $(TOOLBOX_HDR)
unparse_hpf.o: $(FDVM) $(TOOLBOX_HDR) $(DVMINCLUDE)/unparse.hpf
