# V executive buildfile
# by Bill Nowicki January 1983

.SUFFIXES: .c .b

#ifdef X
C68FLAGS = -O -V -vx -DXEXEC
#else X
C68FLAGS = -O -V
#endif X
LIBS = -lVexcept -lVlocname -lVteamsrv -lVhost

BIN = exec.b firstteam.b aliases.b getline.b history.b io.b

ALL = libVexec.a exec serverexec

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

.c.s:
	cc68 $(C68FLAGS) -S -c $<


all: $(ALL)

libVexec.a: $(BIN)
	ar rc libVexec.a `lorder68 $(BIN) | tsort`

exec: $(BIN) main.b
	cc68 $(C68FLAGS) -r -o exec $(BIN) main.b $(LIBS) 

serverexec: $(BIN) servermain.b
	cc68 $(C68FLAGS) -r -o serverexec $(BIN) servermain.b $(LIBS)

clean:
	rm -f *.BAK *.CKP *.68 *.sym
	rm -f *.b *.o .emacs* $(ALL)

cleanbak:
	rm -f *.BAK *.CKP *.68 *.sym

install: all
#ifdef X
	netinstall -x -p "exec serverexec" /usr/sun/xVboot
	netinstall -x "libVexec.a" /usr/sun/xlib
#else X
	netinstall -p "exec serverexec" /usr/sun/Vboot
	netinstall "libVexec.a" /usr/sun/lib
#endif X

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

build:
	buildmake

xbuild:
	buildmake -DX=1
