# -*- Mode: Makefile; Modified: "Thu Dec  9 22:48:51 1999 by dbs"; -*- 

# Build the GNU `cpp' program for systems with inadequate native `cpp'.

# This GNUmakefile builds the `cccp-<system_id>' executable
# by choosing the appropriate subdirectory based on system
# type and invoking `make' in that directory and then sym-linking
# the executable to a system-dependent name in the $CHOMBO_HOME/mk
# directory.

# Currently, the only system that builds `cccp' is the Cray T3E
# running Unicos/mk.  The vector Crays (running Unicos) probably
# also need this, but will need a different version of the code
# because they have a different processor.

# NOTE: This makefile does not follow the Chombo convention of 
#       including `Make.rules' file.  It _does_ include the
#       standard `Make.defs' file so it can get system info.

include $(CHOMBO_HOME)/mk/Make.defs

DIRS = CRAY-T3E

.PHONY: usage all util realclean clean

usage:
	@echo "This GNU makefile supports the targets:"
	@echo "     all clean realclean usage"

# Determine the system type and build the appropriate version of cccp
all util:
ifeq ($(system),CRAY)
	$(MAKE) --directory $(system)-$(craytype) --no-print-directory $(CHOMBO_HOME)/mk/gnucpp.$(system)-$(craytype)
endif

# clean deletes everything except what is needed to determine that the target is up-to-date.
clean:
	@$(foreach i ,$(DIRS) ,$(MAKE) --directory $i --no-print-directory clean ;)

# realclean deletes everything back to the way it was in the release tar file
realclean:
	@$(foreach i ,$(DIRS) ,$(MAKE) --directory $i --no-print-directory realclean ;)
	$(RM) $(CHOMBO_HOME)/mk/gnucpp.*
