.SUFFIXES: .b .c .lst .h .mss .press .o

CFLAGS = -I/usr/sun/include -DVAX
STUBS =
#ifdef X
C68FLAGS = -O -V -vx
#else X
C68FLAGS = -O -V
#endif X
LIBS = 

SRC0 = misc.c init.c input.c find.c debug.c
SRC1 = perm.c defaults.c
SRC2 = rotate.c scale.c move.c copy.c create.c
SRC3 = alter.c erase.c lower.c raise.c
SRCn = draw.c
SRC = $(SRC0) $(SRC1) $(SRC2) $(SRC3) $(SRCn)
SRCh = draw.h

OBJ0 = misc.b init.b input.b find.b debug.b
OBJ1 = perm.b defaults.b
OBJ2 = rotate.b scale.b move.b copy.b create.b
OBJ3 = alter.b erase.b lower.b raise.b
OBJn = draw.b
OBJ = $(OBJ0) $(OBJ1)  $(OBJ2) $(OBJ3) $(OBJn)

VOBJ0 = misc.o init.o input.o find.o debug.o
VOBJ1 = perm.o defaults.o
VOBJ2 = rotate.o scale.o move.o copy.o create.o
VOBJ3 = alter.o erase.o lower.o raise.o
VOBJn = draw.o
VOBJ = $(VOBJ0) $(VOBJ1) $(VOBJ2) $(VOBJ3) $(VOBJn)

LST0 = misc.lst init.lst input.lst find.lst debug.lst
LST1 = perm.lst defaults.lst
LST2 = rotate.lst scale.lst move.lst copy.lst create.lst
LST3 = alter.lst erase.lst lower.lst raise.lst
LSTn = draw.lst
LST = $(LST0) $(LST1) $(LST2) $(LST3) $(LSTn)


all: draw.r draw
manuals: manual.press internal.press

draw: $(VOBJ)
	cc -O -o draw $(VOBJ) $(CFLAGS) $(STUBS) -lm -lVgts

draw.r: $(OBJ)
	cc68 $(C68FLAGS) -r -o draw.r $(OBJ) $(LIBS) 

lint:
	lint -bhax -I/usr/sun/include $(SRC) >lint.out

$(VOBJ) $(OBJ):	draw.h

.c.o:
	cc -c $(C68FLAGS) $(CFLAGS) $<

.c.b:
	cc68 -c $(C68FLAGS) $<

.mss.press:
	scribe $<

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

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

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

all-listings:
	@cz README makefile draw.h &
	@echo Making listings on the dover.
	@echo
	@touch $(LST)
	@yapp $(SRC) &

no-listings:
	@touch $(LST)

incr-listings: $(LST)

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

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

install: draw.r
#ifdef X
	netinstall -x -p draw.r /usr/sun/xVboot
#else X
	netinstall -p draw.r /usr/sun/Vboot
#endif X

backup:
	cd ..; cpdir draw ../../Vbackup/cmds/draw

build:
	buildmake

xbuild:
	buildmake -DX=1
