.SUFFIXES:
.SUFFIXES: .r .b .o .lst .lsth .press .c .hex .h .mss

I = ../mi/icons

ICON0 = $I/nouns/opencurve.hex $I/nouns/closedcurve.hex 
ICON1 = $I/nouns/filledcurve.hex $I/nouns/filledcircle.hex 
ICON2 = $I/nouns/filledelipse.hex $I/nouns/filledrectangle.hex 
ICON3 = $I/nouns/wideclosedarrow.hex $I/nouns/narrowclosedarrow.hex 
ICON4 = $I/nouns/presseditsymbol.hex $I/nouns/openpolygon.hex 
ICON5 = $I/nouns/closedpolygon.hex $I/nouns/filledpolygon.hex 
ICON6 = $I/nouns/closedcircle.hex $I/nouns/closedelipse.hex 
ICON7 = $I/nouns/closedrectangle.hex $I/nouns/wideopenarrow.hex 
ICON8 = $I/nouns/narrowopenarrow.hex $I/nouns/text.hex 
ICONn = $(ICON1) $(ICON2) $(ICON3) $(ICON4) $(ICON5) $(ICON6) $(ICON7) $(ICON8)
ICONa = $I/verbs/move.hex $I/verbs/copy.hex $I/verbs/erase.hex 
ICONb = $I/verbs/alter.hex $I/verbs/rotate.hex $I/verbs/scale.hex 
ICONc = $I/verbs/stretch.hex $I/verbs/group.hex $I/verbs/raise.hex 
ICONd = $I/verbs/lower.hex $I/verbs/opaque.hex 
ICONv = $(ICONa) $(ICONb) $(ICONc) $(ICONd)
ICONS = $(ICONn) $(ICONv)

SRC0 = objects.c parts.c symbols.c checkpoint.c groups.c
SRC1 = load.c save.c help.c 
SRC2 = nouns.c verbs.c commands.c 
SRC3 = icons.c init.c menu.c
SRC4 = drawpress.c spline.c splinedefs.c vec.c press.c writepsm.c
SRC5 = inum.c input.c find.c select.c point.c debug.c
SRCn = draw.c
SRC = $(SRC0) $(SRC1) $(SRC2) $(SRC3) $(SRC4) $(SRC5) $(SRCn)
SRCh = draw.h menu.h icons.h press.h vec.h dfont.h

O = $(OBJSUFFIX)
OBJ0 = objects.$O parts.$O symbols.$O checkpoint.$O groups.$O
OBJ1 = load.$O save.$O help.$O writepsm.$O
OBJ2 = nouns.$O verbs.$O commands.$O
OBJ3 = icons.$O init.$O menu.$O
OBJ4 = drawpress.$O spline.$O splinedefs.$O vec.$O press.$O
OBJ5 = inum.$O input.$O find.$O select.$O point.$O debug.$O
OBJn = draw.$O
OBJ = $(OBJ0) $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ5) $(OBJn)

LST0 = objects.lst parts.lst symbols.lst checkpoint.lst groups.$O
LST1 = load.lst save.lst help.lst writepsm.lst
LST2 = nouns.lst verbs.lst commands.lst
LST3 = icons.lst init.lst menu.lst
LST4 = drawpress.lst spline.lst splinedefs.lst vec.lst press.lst
LST5 = inum.lst input.lst find.lst select.lst point.lst debug.lst
LSTn = draw.lst
LST = $(LST0) $(LST1) $(LST2) $(LST3) $(LST4) $(LST5) $(LSTn)
LSTh = draw.lsth menu.lsth icons.lsth press.lsth vec.lsth dfont.lsth

all: draw.$(MACHINE)
# manuals: manual.press internal.press

draw.$(MACHINE): $(OBJ)
	$(CC) $(MIFLAGS) $(MDFLAGS) -o draw.$(MACHINE) $(OBJ) $(LIBRARIES)

lint:
	cd ../mi ; lint -vbax -I$(VSYS)/include/mi -I$(VSYS)/include/$(MACHINE) $(SRC) >../$(MACHINE)/lint.out

$(OBJ):			draw.h
$(OBJ3):		icons.h menu.h
$(OBJ4):		press.h vec.h dfont.h


icons.$O:		$(ICONS) icons.c

# This is so that writepsm reads from the right /usr/$(Xx)V/run/psm.ps file
writepsm.$O: writepsm.c
	$(CC) -DVSYSTEM_$(Xx) $(MIFLAGS) $(SPECINCLUDES) $(INCLUDES) -c $*.c

.c.o:
	$(CC) $(MIFLAGS) $(SPECINCLUDES) $(INCLUDES) -c $*.c 

# .mss.press:
# 	scribe $<

#---------------------------------------------------------------------
#     General purpose nicknacks.
#---------------------------------------------------------------------

#manual-listings: manual.press internal.press
#	@echo Making a listing of the manuals on the Dover.
#	@cz manual.press
#	@cz internal.press
#	@echo

boise-listings:
	@echo Making listings on Boise.
	@pr -f -l78 README buildtemplate $(SRCh) $(SRC) | boise -b "Draw program"

all-listings:
	@echo Making listings on the dover.
	@cz README buildtemplate
	@echo
	@touch $(LST) $(LSTh)
	@yapp $(SRC) $(SRCh)

no-listings:
	@touch $(LST) $(LSTh)

incr-listings: $(LST) $(LSTh)

.c.lst:
	@echo Listing $? on the Dover.
	@yapp $? 
	@touch $@

.h.lsth:
	@echo Listing $? on the Dover.
	@yapp $? 
	@touch $@

clean:
	rm -f *.BAK *.CKP core .emacs* *.press *.otl *.aux *.err
	rm -f *.o *.b *.u *.lst *.lsth draw draw.r lint.out

install: all
#ifdef UNIX
	mv draw.$(MACHINE) draw
	$(NETINSTALL) -p -m 755 draw /usr/local/bin
	cp ../mi/psm.psmaster psm.ps
	$(NETINSTALL) -p -m 644 psm.ps /usr/$(Xx)V/run
	rm -f psm.ps
	mv draw draw.$(MACHINE)
#else UNIX
	$(NETINSTALL) -p draw.$(MACHINE) $(VSYS)/bin
#endif UNIX




relink:
	rm -f *.$(MACHINE)
