PLATFORM=-DSUN3
REL_PLATFORM=sun3

#PLATFORM=-DSUN4
#REL_PLATFORM=sun4


# End of system dependent stuff (between suns)
DEBUG=
INCL=../..

PRODUCED=expdiff.ex

SHDIR=../../shared
#SHDIR=/usr/valid/tools/pascal/shared

STRUCTURES= \
basic.structures \
string.structures \
unixtypes.structures \
args.structures \
error.structures \
debug.structures \
lexparse.structures \
file.structures \
netlist.structures

DERIVED_H=vopen.h unixtime.h consts.h types.h vars.h

SRC=\
$(DERIVED_H) \
externals.p \
procs.p \
insymbol.p \
avlcompare.p \
heap.p \
avldebug.p \
../avl/insert.p \
../avl/traverse.p \
table.p \
compare.p \
parse.p \
timeutils.p \
args.p \
init.p \
fileio.p \
expdiff.p

.SUFFIXES: .o .c .p .C
.p.o:
	pc -c ${PLATFORM} -L -P $(DEBUG) -I$(INCL) $*.p
.C.o:
	CC -c -O $(DEBUG) ${PLATFORM} -I${INCL} $*.C
.c.o:
	cc -c -O $(DEBUG) ${PLATFORM} -I${INCL} $*.c

PASC_OFILES=$(SHDIR)/vopen.o $(SHDIR)/unixtime.o
OFILES=$(PASC_OFILES) ../shared/misc.o ${SHDIR}/cwrap.o ../shared/fio.o

all: $(PRODUCED)

s32:
	make -f makefile.s32

pmax: expdiff.pmax.o $(PRODUCED)

expdiff.pmax.o: $(SRC)
	/usr/lib/cpp -E -I$(INCL) $(PLATFORM) expdiff.p | sed -e "/^#/d" > expdiff.pmax.p
	pc -c $(PFLAGS) $(DEBUG) -I$(INCL) expdiff.pmax.p
	rm -f expdiff.o expdiff.pmax.p
	ln expdiff.pmax.o expdiff.o

clean:
	rm -f *.obj *.o *.i *junk junk* .emacs* core $(DERIVED_H)
realclean:
	rm -f *.obj *.o *.i *junk junk* .emacs* core $(DERIVED_H) $(PRODUCED)


expdiff.ex: expdiff.o $(OFILES)
	pc -o expdiff.ex expdiff.o $(OFILES)
	strip expdiff.ex

expdiff.o: $(SRC)
consts.h types.h vars.h:	${STRUCTURES}
	sed -f structmung.sed ${STRUCTURES}

unixtime.h:	${SHDIR}/unixtime.h
	cp ${SHDIR}/unixtime.h .
vopen.h:	${SHDIR}/vopen.h
	cp ${SHDIR}/vopen.h .
