###########################
# Data General Unix Makefile for FUDGIT
###########################
#
# macro definitions
# Linker flags
LDFLAGS = -lm -Lreadline/ -lreadline -lmalloc -ltermcap
# Final compiling flags
FCFLAGS = $(OPT)
# The following is for  Data General
# Define -DNOWAITPID if you only have wait3()
CFLAGS = $(OPT) -DDALIGN -DNOMALLINFO -DNOTRUNC -Dconst= 
# READLINE CFLAGS 
READLINE = OTH_CFLAGS="-Dconst= $(VI_MODE)"

# You should not need to edit anything below that line
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 extramath.o

# The default shell
SHELL = /bin/sh
# Default compiler
CC = cc
YFLAGS = -d
DATE = `cat ../Date`
VERSION = `cat ../Version`

all: 
	(cd readline; $(MAKE) CC="$(CC)" $(READLINE))
	$(MAKE) -f Makefile.datagen CC="$(CC)" ../fudgit

../fudgit: $(OBJECTS) fudgit.h setshow.h readline/libreadline.a
	$(CC) $(FCFLAGS) -o ../fudgit $(OBJECTS) $(LDFLAGS)

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

y.tab.h: mathparse.o

chd.o : chd.c fudgit.h head.h 

code.o : code.c symbol.h code.h math.tab.h fudgit.h head.h 
	$(CC) -c $(CFLAGS) $(POP) code.c

command.o : command.c symbol.h code.h macro.h math.tab.h fudgit.h setshow.h \
  functions.h help.h command.h readline/history.h head.h install.dummy.c 

fft.o : fft.c symbol.h code.h math.tab.h fudgit.h setshow.h \
  functions.h dalloca.h head.h 

fit.o : fit.c head.h 

fits.o : fits.c symbol.h code.h math.tab.h fudgit.h setshow.h \
  functions.h head.h 

fudgit.o : fudgit.c fudgit.h macro.h head.h setshow.h functions.h 
	$(CC) $(CFLAGS) -DDATE="\"$(DATE)\"" -DVERSION="\"$(VERSION)\"" -c fudgit.c

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

if.o : if.c fudgit.h head.h 

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

install.o : install.c dld/dl/dl.h 

install.dummy.o : install.dummy.c 

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

macro.o : macro.c fudgit.h macro.h setshow.h functions.h readline/history.h \
  head.h symbol.h code.h math.tab.h 

math.o : math.c fudgit.h head.h symbol.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) $(OPT) -c mathparse.c

medfit.o : medfit.c dalloca.h head.h 

minit.o : minit.c fudgit.h setshow.h functions.h macro.h head.h 

mrqmin.o : mrqmin.c dalloca.h head.h 

plot.o : plot.c fudgit.h setshow.h functions.h macro.h head.h command.h 

readline2.o : readline2.c readline/readline.h readline/keymaps.h \
  readline/chardefs.h readline/history.h fudgit.h command.h macro.h head.h 

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

spline.o : spline.c fudgit.h dalloca.h head.h 

strings.o : strings.c fudgit.h head.h 

strstr.o : strstr.c 

svdfit.o : svdfit.c dalloca.h head.h 

vgetargp.o : vgetargp.c fudgit.h macro.h symbol.h code.h math.tab.h head.h 


