# $Id: Makefile,v 1.3 2001/05/14 23:40:49 larryt Exp $


BUILD = ../build
VERSION = 1.1.0 

ifdef RELEASE 

STAGING_ARGS = -R 

endif

.PHONY : lsserver lsfunction trip_test doc

SUBDIRS = tripcore lsserver test lsapi lsfunctions 

EXTERNAL_SUBDIRS = util 

######################################################################

# this code is the start of modularity for the makefile process.  we
# won't be using it for the moment, however.

#MAKE_INCLUDES := $(foreach dir,$(SUBDIRS),$(dir)/Makefile.data)

#-include $(MAKE_INCLUDES)

#default:
#	@echo "The make file no longer supports a default target."
#	@echo "Please choose one of the following:"
#	@echo ""
#	@for i in $(TARGET_LIST) ; do echo "$$i" ; done
#	@echo "all		all of the above targets"
#	@echo "clean		clean all code"
#	@echo "cleanall		clean all code thoroughly"

######################################################################

usage:
	@echo "The make file no longer supports a default target."
	@echo "Please choose one of the following:"
	@echo ""
	@echo "lsserver       To build the LS server "
	@echo "trip-test      To build the test cases "
	@echo "all           all of the above targets"
	@echo "clean         clean all code"
	@echo "cleanall      clean all code thoroughly"
	@echo "veryclean     clean debug.*, bin.*, *.d, *.o"

#
# this include is here because our default target overrides everyone
# else's default target

include $(BUILD)/Makefile.pre


MAKE_NOJ = $(patsubst %-j4,%, $(patsubst %-j2,%, $(MAKE)))

all: lsserver trip-test

lsserver: tripcore lsfunction 
	cd lsserver; $(MAKE) 

tripcore:
	cd tripcore; $(MAKE)

lsfunction: tripcore 
	cd lsfunctions; $(MAKE)


trip-test: tripcore lsfunction 
	cd test ; $(MAKE)

doc: 
	rm -rf docs/tripCoreHtml; 
	rm -rf docs/lsFunctionsHtml; 
	mkdir docs/html; 
	cd tripcore ; $(MAKE) doc; mv html ../docs/tripCoreHtml
	cd lsfunctions ; $(MAKE) doc; mv html ../docs/lsFunctionsHtml

cleanall:
	touch $$.$$.$$.d
	find . -name 'obj.*' -print -exec /bin/rm -rf {} \;
	find . -name 'bin.*' -print -exec /bin/rm -rf {} \;
	find . -name '*.d' -print -exec /bin/rm -f {} \;
	find . -name '.link_host' -print -exec /bin/rm -f {} \;
	for i in $(SUBDIRS) ; do ( cd $$i && $(MAKE) cleanall ) ; done
	rm -rf release/bin.*/*
	rm -rf release/lib.*/*
	rm -rf release/include/*

veryclean: clean
	- find . -name 'obj.*' -print -exec /bin/rm -rf {} \;
	- find . -name 'bin.*' -print -exec /bin/rm -rf {} \;
	- find . -name '*.o' -print -exec /bin/rm -f {} \;
	- find . -name '*.a' -print -exec /bin/rm -f {} \;
	- find . -name 'core' -print -exec /bin/rm -f {} \;
	- find . -name '.link_host' -print -exec /bin/rm -f {} \;

clean:
	- for i in $(SUBDIRS) ; do ( cd $$i && $(MAKE) clean ) ; done
	- find . -name '*.d' -print -exec /bin/rm -f {} \;

