# makefile for base plant
EKSdir=/usr3/dechao/eks
DBX= -g
LIBS= -L${EKSdir}/lib -lEKS -lIntrinsics -lDimensions -lm
CFLAGS= -I../dimensions -I../intrinsics -I../base -I../base/theory -I../base/site -I../base/building -I../tax_1 -I../tax_2 -pic ${DBX}
LFLAGS= -hbx
SRC= Component.C Component_def.C Connection.C Connection_def.C Context_pa.C Context_pa_def.C System.C System_def.C
OBJ= Component.o Component_def.o Connection.o Connection_def.o Context_pa.o Context_pa_def.o System.o System_def.o

plant_1:	${OBJ}

all:	plant_1  tax_1

tax_1:
	cd ../tax_2; make all

VERSION=`cat ${EKSdir}/lib/.version`
lib:	all
	echo ${VERSION}
	ld -o ${EKSdir}/lib/libEKS.so.${VERSION} -assert pure-text  \
		../base/[A-Z]*.o  ../base/*/[A-Z]*.o ../tax_1/[A-Z]*.o ../tax_2/[A-Z]*.o [A-Z]*.o
	ar cr ${EKSdir}/lib/libEKS.sa.${VERSION}  ../base/EKS.o

static_lib: all
	ar cr ${EKSdir}/lib/libEKS.a  \
		../base/[A-Z]*.o  ../base/*/[A-Z]*.o ../tax_1/[A-Z]*.o [A-Z]*.o 

clean:
	rm -f core lintout makeout tags makefile.bak *.o *.cyi

lintout: ${SRC}
	\@rm -f lintout
	lint ${LFLAGS} ${SRC} >lintout

errs:
	\@rm -f makeout
	make main1 >makeout

tags:	${SRC}
	\@rm -f tags
	ctags ${SRC}

source:
	mv makefile makefile.bak
	head -6 makefile.bak >makefile
	echo SRC= `ls *.C` >>makefile
	echo OBJ= `ls *.C | sed s/C$$/o/` >>makefile
	tail +9 <makefile.bak >>makefile

depend: ${SRC}
	for i in ${SRC};  \
	do \
		/lib/cpp  -M -Y/usr/CC/incl $$i \
		|  sort -u \
		|  sed -e 's, \./, ,' \
		|  awk ' \
				{ if ($$1 != prev) { \
					if (rec != "")   print rec; \
					rec = $$0;  prev = $$1;\
			 	  } else { \
					if ($$2 !~ /CC/) { \
						print rec "   \\"; \
						rec = "\t" $$2}\
					} \
				} \
			END { print rec } \
		'; \
	done >makedep
	echo '/^# DO NOT DELETE THIS LINE/+2,$$d' >eddep
	echo '$$r makedep' >>eddep
	echo 'w' >>eddep
	cp makefile makefile.bak
	ed - makefile <eddep
	rm eddep makedep
	echo '' >>makefile
	echo '# DEPENDENCIES MUST END AT END OF FILE' >>makefile
	echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >>makefile
	echo '# see make depend above' >>makefile

.SUFFIXES: .C
.C.o:
	CC ${CFLAGS} -c $*.C

# DO NOT DELETE THIS LINE -- make depend uses it

Component.o: Component.h   \
	Component_def.h   \
	Component.C
Component_def.o: Component_def.h   \
	Component_def.C
Connection.o: Component.h   \
	Component_def.h   \
	Connection.h   \
	Connection_def.h   \
	Connection.C
Connection_def.o: Connection_def.h   \
	Connection_def.C
Context_pa.o: Context_pa.h   \
	Context_pa_def.h   \
	System.h   \
	Context_pa.C
Context_pa_def.o: Component_def.h   \
	Connection_def.h   \
	Context_pa_def.h   \
	System.h   \
	System_def.h   \
	Context_pa_def.C
System.o: Component.h   \
	Component_def.h   \
	Connection.h   \
	Connection_def.h   \
	System.h   \
	System_def.h   \
	System.C
System_def.o: Component_def.h   \
	Connection_def.h   \
	System_def.h   \
	System_def.C

# DEPENDENCIES MUST END AT END OF FILE
# IF YOU PUT STUFF HERE IT WILL GO AWAY
# see make depend above
