#
# Files and Directories
#

GMDir = ../../manager
SXDir = ../../dev/bin

ABCDir = ..

MaiDir = main
LagDir = lag
MisDir = misc
GloDir = global
SrcDir = source

TGTBin = none
TGTLib = none
TGTInc =

TGTB = b
TGTA = a
TGTS = s

#
# Compiler/Loader Options
#
UniFlags = -L${LibDir}
CcFlags = ${GraphicsFlag} -I. -I../../dev/include -I${IncDir} ${MachDepGraphicsInc}
LdFlags = ${LDFLAGS}

#
# Files to remove in directory clean (pact clean)
#
CleanFiles = *~ core #*#

#
# Things upon which install depends (pact install)
#
InstallDep = 
BinObj = 
BinDep = 
LibDep =

#
# Code Units
#
Libs1 = ${LagDir}/liblag.a
Libs2 = ${MisDir}/libmisc.a
Libsa = ${GloDir}/libmesh.a
Libsb = ${LSX} ${LPANACEA} ${LSCHEME}
Libsc = ${LPGS} ${MachDepGraphicsLib} ${LPPC} ${LPDB} ${LPML} ${LSCORE} -lm ${MachDepLib}
Libs = ${Libs1} ${Libs2} ${Libsa} ${Libsb} ${Libsc}
LibsS = ${SrcDir}/libs.a ${Libs}

Hdrs = ${MaiDir}/b.h

AObjs = ${MaiDir}/a.o
BObjs = ${MaiDir}/b.o
SObjs = ${MaiDir}/s.o
Objs  =

ASrcs = ${MaiDir}/a.c
BSrcs = ${MaiDir}/b.c
SSrcs = ${MaiDir}/s.c

#
# make the whole system
#
auto :
	cd .. ; pact install
	cd ../../sx ; pact install
	sx -l panache.scm \(ld abc.dict\)
	mv a.c b.c b.h ${MaiDir}
	mv global.c global.h ${GloDir}
	mv lag.c lag.h ${LagDir}
	mv misc.c misc.h ${MisDir}
	pact system

system :
	cd .. ; pact install ; cp panace.h abc
	cd ../../sx ; pact install ; cp sx.h abc
	rm -f ${AObjs} ${BObjs} ${CObjs}
	pact packages
	${CLD} ${LdFlags} ${CDebug} ${ASrcs} -o a ${Libs}
	${CLD} ${LdFlags} ${CDebug} ${BSrcs} -o b ${Libs}
	${CLD} ${LdFlags} ${CDebug} ${SSrcs} -o s ${LibsS}

#
# make brand new a
#
a : ${ASrcs}
	cd .. ; pact install ; cp panace.h abc
	cd ../../sx ; pact install ; cp sx.h abc
	pact packages
	${CLD} ${LdFlags} ${CDebug} ${ASrcs} -o a ${Libs}

re-a :
	rm -f a ${AObjs}
	pact a
#
# make b
#
b : ${BSrcs}
	cd .. ; pact install ; cp panace.h abc
	cd ../../sx ; pact install ; cp sx.h abc
	pact packages
	${CLD} ${LdFlags} ${CDebug} ${BSrcs} -o b ${Libs}

re-b : 
	rm -f b ${BObjs}
	pact b

#
# make s
#
s : ${SSrcs}
	cd .. ; pact install ; cp panace.h abc
	cd ../../sx ; pact install ; cp sx.h abc
	pact packages
	${CLD} ${LdFlags} ${CDebug} ${SSrcs} -o s ${LibsS}

re-s : 
	rm -f s ${SObjs}
	pact s

#
# build the packages
#
packages :
	cd ${GloDir} ; pact libmesh.a ; cp global.h mesh.h ${ABCDir}
	cd ${LagDir} ; pact liblag.a ; cp lag.h ${ABCDir}
	cd ${MisDir} ; pact libmisc.a ; cp misc.h ${ABCDir}
	cd ${SrcDir} ; pact libs.a ; cp s.h ${ABCDir}

#
# remove the object files
#
remove-sys :
	pact -i remove
	rm -f a b s
	cd ${GloDir} ; pact -i remove
	cd ${LagDir} ; pact -i remove
	cd ${MisDir} ; pact -i remove
	cd ${SrcDir} ; pact -i remove
