############################
# Generic Makefile for FUDGIT
############################
#
# The following should be passed from above:

LDFLAGS = 
PROC = 
CFLAGS = 
RLINCLUDES=-I../libs
CC = cc
YACC = yacc
YFLAGS = -d
ALLOCA =

# YOU SHOULD NOT NEED TO EDIT BELOW THIS POINT
########################################################
# shell definition
SHELL = /bin/sh
DATE = `cat ../.date`
VERSION = `cat ../.version`

OBJECTS = mathparse.o fudgit.o alloc.o setshow.o vgetargp.o plot.o\
	fits.o fit.o svdfit.o medfit.o help.o mrqmin.o \
	command.o code.o math.o lexi.o init.o fft.o macro.o minit.o \
	spline.o readline2.o chd.o if.o strings.o extrafuncs.o $(ALLOCA)

.c.o:
	$(CC) -c $(CFLAGS) $(RLINCLUDES) $*.c

../fudgit: $(OBJECTS) fudgit.h setshow.h
	$(CC) $(CFLAGS) -o ../fudgit $(OBJECTS) $(LDFLAGS)

code.o: code.h math.tab.h symbol.h code.c

command.o: symbol.h code.h macro.h fudgit.h math.tab.h \
	setshow.h help.h install.irix5.c command.c
	$(CC) -c $(CFLAGS) $(RLINCLUDES) $(PROC) command.c

fft.o: math.tab.h code.h symbol.h fudgit.h setshow.h dalloca.h

fits.o: symbol.h code.h fudgit.h math.tab.h setshow.h

fudgit.o: fudgit.h macro.h ../.date fudgit.c ../.version
	$(CC) -c $(CFLAGS) -DDATE="\"$(DATE)\"" -DVERSION="\"$(VERSION)\"" fudgit.c

help.o: help.h fudgit.h help.c help.c
	$(CC) -c $(CFLAGS) -DHELPFILE="\"$(LIBDIR)/fudgit.help\"" help.c

if.o: fudgit.h

init.o: symbol.h code.h math.tab.h fudgit.h

lexi.o: symbol.h code.h fudgit.h math.tab.h

macro.o: macro.h fudgit.h setshow.h

math.o: fudgit.h

mathparse.o: symbol.h code.h parse.y
	$(YACC) $(YFLAGS) parse.y
	cat y.tab.c | sed s/yy/Ft_mathyy/g > mathparse.c
	rm y.tab.c
	$(CC) -c $(CFLAGS) mathparse.c

medfit.o: dalloca.h

minit.o: macro.h setshow.h

mrqmin.o: dalloca.h

chd.o: fudgit.h

plot.o: fudgit.h setshow.h macro.h

setshow.o: symbol.h code.h fudgit.h math.tab.h setshow.h macro.h functions.h

spline.o: dalloca.h fudgit.h math.tab.h symbol.h code.h command.h

svdfit.o: dalloca.h

vgetarg.o: fudgit.h macro.h symbol.h code.h math.tab.h

math.tab.h: y.tab.h
	cat y.tab.h | sed s/yy/Ft_mathyy/g > math.tab.h

y.tab.h: mathparse.o
