#===========================================================================
#
# SHARE src Makefile
#
# author: Scott Binegar 
#
# Modification History:
#
#   Date       OPR         Who       Reason
# --------   -------   ------------  -----------------------------------------
# 09/20/01   n/a       S. Binegar    first version
# 01/24/05   52373     Sontag        Extra clean steps for top-level clean
# 12/23/09   64182     MSwam         changes for Linux
#===========================================================================
#
# Determine the operating system
include $(SHAREROOT)/platform.defs

# 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)

# Provide a way to run unit tests
tests: FORCE
	@echo "Run perl and python unit tests..."
	@cd scripts/tests; gmake do_test_perl
	@cd scripts/tests; gmake do_test_python

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 ../dbms/sql_files; rm -f *.idx; rm -f *.sql
	@cd scripts; $(MAKE) clean
	@rm -rf ../obj/$(OS_SUB_DIR)/*
	@rm -rf ../lib/$(OS_SUB_DIR)/*
	@rm -rf ../bin/$(OS_SUB_DIR)/*
	@rm -rf ../bin/java/*

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

