# Makefile for V remote demo programs
# Bill Nowicki April 1983

CFLAGS = -DVAX -O -I/usr/sun/include
.SUFFIXES: .b .ls .a68 .c
#ifdef X
C68FLAGS = -O -V -vx
#else X
C68FLAGS = -O -V
#endif X
LIBS = 

LIBDIR = ../../libc/vgts

#  The following can be gotten from either the V library, or
# for debugging: $(LIBDIR)/{stubs.b vtty.b}
VSTUBS =

# installed V commands
INSVCMDS = silly.r binsun.r

# test V commands
TESTVCMDS = vectime.r test.r datsun.r photo.r

# installed Unix commands
INSUCMDS = datsun silly photo

# test Unix commands
TESTUCMDS = test condense vectime

# how to compile a 68000 file
.c.b:
	cc68 $(C68FLAGS) -c $*.c 

# how to make an assembly file (Not deleting it or assembling it)
.c.s:
	cc68 $(C68FLAGS) -S $*.c

# how to make an assembly listing
.c.ls:
	cc68 $(C68FLAGS) -c -L $*.c

demos: $(INSVCMDS) $(TESTVCMDS) $(INSUCMDS) $(TESTUCMDS)

test: test.o
	cc -o test test.o -lVgts

test.r: test.b
	cc68 $(C68FLAGS) -o test.68 test.b $(VSTUBS) $(LIBS) 
	rev68 test.68 test.r
	nm68 -nh test.68 >test.sym
	rm test.68

datsun.r: datsun.b
	cc68 $(C68FLAGS) -r -o datsun.r datsun.b $(VSTUBS) $(LIBS) 

datsun: datsun.o
	cc -o datsun datsun.o -lVgts

vectime.r: vectime.b
	cc68 $(C68FLAGS) -r -o vectime.r vectime.b $(VSTUBS) $(LIBS) 

vectime: vectime.o
	cc -o vectime vectime.o -lVgts -lm

photo.r: photo.b
	cc68 $(C68FLAGS) -r -o photo.r photo.b $(VSTUBS) $(LIBS) 

photo: photo.o
	cc -o photo photo.o -lVgts

silly.o silly.b silmove.b: silly.h

silly.r: silly.b silmove.b
	cc68 $(C68FLAGS) -r -o silly.r silly.b silmove.b $(VSTUBS) $(LIBS) 

silly: silly.o
	cc -o silly silly.o -lVgts

condense: condense.o
	cc -o condense condense.o

binsun.r: binsun.b
	cc68 $(C68FLAGS) -r -o binsun.r binsun.b $(VSTUBS) $(LIBS) 

binsun: binsun.o
	cc -o binsun binsun.o -lVgts


install: demos
#ifdef X
	netinstall -x -p "$(INSVCMDS)" /usr/sun/xVboot
	netinstall -x "$(INSUCMDS)" /usr/local/bin
#else X
	netinstall -p "$(INSVCMDS)" /usr/sun/Vboot
	netinstall "$(INSUCMDS)" /usr/local/bin
#endif X

listings:
	yapp vectime.c datsun.c silly.c silmove.c photo.c test.c

clean: 
	rm -f *.b *BAK *CKP *.r *.d *.o
	rm -f $(INSVCMDS) $(TESTVCMDS) $(INSUCMDS) $(TESTUCMDS)

build:
	buildmake

xbuild:
	buildmake -DX=1
