# Top-level Makefile for Win95/DJGPP AFS client
# Assumes you are doing cross-compiling from Linux
# Set LINUX_SYS to the proper sysname for your Linux system

OBJ = $(SYS_NAME)/obj
DEST = $(SYS_NAME)/dest
DESTDIR = DEST/
SRCDIR = ${DESTDIR}
#LINUX_SYS = i386_linux22
TOP_SRCDIR = `pwd`/src

all: afsd

afsd: config pinstall libs
	make -C $(OBJ)/WINNT/afsd -f Makefile.djgpp depends
	make -C $(OBJ)/WINNT/afsd -f Makefile.djgpp install

utils: pinstall rxgen comerr
includes: afsdinc osiinc authinc 
libs: fsint cmd lwp osi rx rxkad vldb rxstat acl

clean:
	-$(RM) -f $(SYS_NAME)/dest/include/*
	-$(RM) -f $(SYS_NAME)/dest/include/afs/*
	-$(RM) -f $(SYS_NAME)/dest/lib/*
	-$(RM) -f $(SYS_NAME)/dest/lib/afs/*
	-$(RM) -f $(SYS_NAME)/dest/bin/*

config:
	-make -C $(OBJ)/config install

# pinstall, rxgen, comerr, and util are built to run on Linux
pinstall: config
	-mkdir $(OBJ)/pinstall/afs
	-cp $(OBJ)/config/param.$(LINUX_SYS).h $(OBJ)/pinstall/afs/param.h
	make -C $(OBJ)/pinstall SYS_NAME=$(LINUX_SYS) install
rxgen: config
	-mkdir $(OBJ)/rxgen/afs
	-cp $(OBJ)/config/param.$(LINUX_SYS).h $(OBJ)/rxgen/afs/param.h
	make -C $(OBJ)/rxgen SYS_NAME=$(LINUX_SYS) install
comerr: config util
	-mkdir $(OBJ)/comerr/afs
	-cp $(OBJ)/config/param.$(LINUX_SYS).h $(OBJ)/comerr/afs/param.h
	make -C $(OBJ)/comerr SYS_NAME=$(LINUX_SYS) install
util: config procmgmt
	-mkdir $(OBJ)/util/afs
	-cp $(OBJ)/util/param.$(LINUX_SYS).h $(OBJ)/util/afs/param.h
	make -C $(OBJ)/util SYS_NAME=$(LINUX_SYS) install

procmgmt:
	make -C $(OBJ)/procmgmt includes
lwp: util afsdinc osiinc lwpinc
	make -C $(OBJ)/lwp install
lwpinc:
	make -C $(OBJ)/lwp includes
rx: rxgen lwp
	make -C $(OBJ)/rx install-djgpp
des: desprogs
	make -C $(OBJ)/des install
desprogs:
	make -C $(OBJ)/des SYS_NAME=$(LINUX_SYS) gprogs
ubik: rx lwp
	make -C $(OBJ)/ubik install
fsint: rx rxgen
	make -C $(OBJ)/fsint install
rxkad: rx des
	make -C $(OBJ)/rxkad install
audit: fsint
	make -C $(OBJ)/audit install
authinc: comerr
	make -C $(OBJ)/auth includes
vldb: rxgen rx authinc audit ubik rxkad
	make -C $(OBJ)/vlserver libinstall
rxstat: rxgen rx
	make -C $(OBJ)/rxstat install
cmd: comerr
	make -C $(OBJ)/cmd install
afsdinc:
	make -C $(OBJ)/WINNT/afsd -f Makefile.djgpp includes
osiinc:
	make -C $(OBJ)/WINNT/client_osi -f Makefile.djgpp includes
osi: config
	make -C $(OBJ)/WINNT/client_osi -f Makefile.djgpp depends
	make -C $(OBJ)/WINNT/client_osi -f Makefile.djgpp install
acl: config ptlib
	make -C $(OBJ)/libacl install
ptlib: config rxgen comerr
	make -C $(OBJ)/ptserver libinstall
