# V executive buildfile
# by Bill Nowicki January 1983

.SUFFIXES:
.SUFFIXES: .b .c 
VPATH = ../mi

#include ../../../buildprefix
#ifdef X
C68FLAGS = -O -V -vx -DXEXEC -I../../../libc/include
#else X
C68FLAGS = -O -V
#endif X

LIBS = 

.c.b:
	cc68  $(C68FLAGS) -c $*.c
.c.s:
	cc68 $(C68FLAGS) -S -c $*.c

BIN = exec.b aliases.b getline.b history.b io.b remote.b parseline.b \
	readdir.b descname.b

SERVER = execserver.b

ALL = libVexec.a exec.m68k execserver.m68k

all: $(ALL)

libVexec.a: $(SERVER) $(BIN)
	rm -f libVexec.a
	ar cq libVexec.a $(SERVER) $(BIN)
	ranlib68 libVexec.a

execserver.m68k: server.b $(SERVER) $(BIN) 
	cc68 $(C68FLAGS) -o execserver.m68k server.b $(SERVER) $(BIN)

exec.m68k:	execmain.b $(BIN)
	cc68 $(C68FLAGS) -o exec.m68k execmain.b $(BIN) $(LIBS) 

#delete this if we don't want EXECSERVER active
exec.b:	exec.c
	cc68 $(C68FLAGS) -DEXECSERVER -c exec.c

# How to make tags:
#   Tags should be made periodically, and also when you want 
#   to make sure that "tags" is up to date.
#   Sometimes it is necessary to delete "tags" in order to build
#   it (i.e. when you get the message "'tags' is up to date.").
#   The "tags" file copied into ../mi and ../m68k because ved uses 
#   the "tags" file in the current directory.
#   The "tags" file copied into ../mi and ../m68k is the most recent
#   "tags" file built for any particular object directory.

tags:
	csh -c \
	"ctags -tw {.,../m68k,../mi,../../../libc/exec/{mi,m68k},../../../libc/include/{mi,m68k}}/*.[ch]"
	cp tags ../mi/tags
	cp tags ../tags

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

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

relink:
	rm -f $(ALL)

install: all
	$(NETINSTALL) -p "execserver.m68k exec.m68k" $(VSYS)/bin
	$(NETINSTALL) "libVexec.a" $(VSYS)/lib/m68k
