#===========================================================================
#
# src Makefile
#
# author: Scott Binegar 
#
# Modification History:
#
#   Date       OPR         Who       Reason
# --------   -------   ------------  -----------------------------------------
# 09/20/01   n/a       S. Binegar    first version
# 01/31/03   47450     Sontag        Added lines for AIX
# 12/22/03   49783     Sontag        Extra clean step for AIX
# 01/24/05   52373     Sontag        Extra clean steps for top-level clean
# 09/28/06   52073     Sontag        Port GUI's to OSX, handle cygwin clean
# 01/29/08   57952     Sontag        Handle x86_osx
# 11/12/09   63939     MSwam         Re-use OS_SUB_DIR from above
#===========================================================================
# Eliminate implicit rules
.SUFFIXES:

# Build both libraries and applications
all: libs apps scripts
	@echo "Finished build";

# Build the libraries
libs: FORCE
	@echo "Building Libraries..."
	@cd libs && $(MAKE)

# Build the applications
apps: FORCE
	@echo "Building Applications..."
	@cd apps && $(MAKE)

# Copy the scripts
scripts: FORCE
	@echo "Copying Scripts..."
	@cd scripts && $(MAKE)

FORCE:

# Delete the objects, libs, etc.
.PHONY: clean
clean: clean_deps
	@cd libs; for file in *.make ; do $(MAKE) -I .. -f $$file clean ; done
	@cd apps; for file in *.make ; do $(MAKE) -I .. -f $$file clean ; done
	@cd scripts; $(MAKE) clean
	#@rm -f ../inc/*.cpp > /dev/null 2>&1  (lets not be quiet...)
	@rm -f ../inc/*.cpp
	@rm -rf ../obj/$(OS_SUB_DIR)/*
	@rm -rf ../lib/$(OS_SUB_DIR)/*
	@rm -rf ../bin/$(OS_SUB_DIR)/*
	@rm -rf ../bin/java/*
ifeq ($(OSNAME),AIX)
	@cd ../lib/$(OS_SUB_DIR); rm -f *.a; rm -f */*.a
endif

.PHONY: clean_deps
clean_deps:
	@echo "Deleting dependency files..."
	@rm -f apps/dep/*.d
	@rm -f libs/dep/*.d

