# V Server buildfile - Vax/Unix4.2BSD configuration

#include ../../../buildprefix

VPATH = . ../unix ../osi

KSOURCES = ether3meg.c ether10meg.c kernel.c bufmgr.c swab.c net.c groups.c
KOBJS = ether3meg.o ether10meg.o kernel.o bufmgr.o swab.o net.o groups.o
KHEADERS = kernel.h net.h swab.h
SSOURCES = ihandlers.c ioqueue.c process.c time.c server.c instance.c file.c \
	   session.c lookup.c naming.c directory.c debug.c unix.c qk.c \
	   usercorr.c
SOBJS = ihandlers.o ioqueue.o process.o time.o server.o instance.o file.o \
	session.o lookup.o naming.o directory.o debug.o unix.o qk.o usercorr.o
SHEADERS = server.h naming.h debug.h config.h

LOCAL_INCLUDE = -I. -I../vax -I../unix -I../osi # mirrors VPATH
UNIX_INCLUDE = -I/usr/include/ -I/usr/include/sys
V_INCLUDE = -I../../../libc/include/mi

INCLUDE = $(LOCAL_INCLUDE) $(UNIX_INCLUDE) $(V_INCLUDE)

# These manifests may be installation-dependent.  They are in the buildfile
# instead of config.h because cpp won't do macro substitution inside quotes.
# NOTE that the PUBLIC_DIR must end in a '/'

HOST_TABLE_FILE=$(VSYS)/run/Vhosttab

VSFLAGS= '-DHOST_TABLE_FILE="$(HOST_TABLE_FILE)"' \
	 '-DPUBLIC_DIR="$(VSYS)/boot/"'

#ifdef X
XFLAGS = -DEXP_V
#else X
XFLAGS = 
#endif X

CCFLAGS = -O $(XFLAGS) $(VSFLAGS)
LIBRARIES = 

.c.o :
	cc -c $(INCLUDE) $(CCFLAGS) $*.c
.c.s :
	cc -S $(INCLUDE) $(CCFLAGS) $*.c

Vserver : $(KOBJS) $(SOBJS)
	-mv Vserver Old.Vserver
	cc -o Vserver $(CCFLAGS) $(SOBJS) $(KOBJS) $(LIBRARIES)

$(SOBJS) : $(SHEADERS) 
$(KOBJS) : $(KHEADERS) debug.h

clean:
	-rm -f $(KOBJS) $(SOBJS) Vserver *.BAK *.CKP .emacs*

install: Vserver
#ifdef X
	rm -f xVserver
	ln Vserver xVserver
	mv -f /etc/V/xVserver /etc/V/xVserver.old
	cp xVserver /etc/V
	cp xVserver /etc/V/xVserver.new
	netinstall -x -r -m 755 xVserver /etc/V
#else X
	mv -f /etc/V/Vserver /etc/V/Vserver.old
	cp Vserver /etc/V
	cp Vserver /etc/V/Vserver.new
	netinstall -r -m 755 Vserver /etc/V
#endif X
