# CLAM System default rule and target definitions. ############################################################################### # This file contains composite macros and rules for creating objects. # This file should be included in the user's makefile after the variables # have been initialized appropriately for the particular project being # created. The user's own targets should be placed after the include # directive that specifies this file. ############################################################################### # This ensures that any of other projects required by this one (defined through # BUILD_BEFORE) get created before the real work in this project is done. ifneq "$(BUILD_BEFORE)" "" FIRST_TARGETS += $(BUILD_BEFORE:%=%.make) endif ifneq "$(BUILD_AFTER)" "" LAST_TARGETS += $(BUILD_AFTER:%=%.make) endif # Make the default action be an error stop if we can't find an appropriate rule. .DEFAULT: $(HIDER)echo $(HIDER)echo [$@] is missing files or has a makefile problem. $(HIDER)echo $(HIDESH)$(CLAM_DIR)/exit_make.sh # This rule halts make for some supposedly devastating reason. More # information should be printed out by the cause of the halt. %.halt: @echo CLAM execution halted, the cause being: $@ $(HIDESH)$(CLAM_DIR)/exit_make.sh # Provides a time-stamp in the make log. show_date.%: $(HIDER)echo "{$(shell date)}" # The .make rule changes to the directory with the same first part of the # pattern and makes whatever projects are there. This is used by the build # before procedure. %.make: $(HIDESH) -c '\ if [ -d $* ]; then \ if [ -f "$*/$(MAKEFILE_NAME)" ]; then \ $(MAKE) --silent -f "$(MAKEFILE_NAME)" NOT_FIRST_MAKE=t -C "$*"; \ else \ echo Skipping makefile-less directory [$*]; \ fi \ else \ echo Skipping missing directory [$*]; \ fi' # always run the exes listed in RUN_TARGETS. .PHONY: run_targets # "all" is the first target to execute in any makefile. we capture it and # use it to produce the requested actions. all: start $(ACTUAL_FIRST_TARGETS) $(ACTUAL_TARGETS) $(ACTUAL_LAST_TARGETS) run_targets finish # "start" announces the beginning of compilation. start: $(HIDESH) -c '\ if [ ! -d "$(CLAM_TMP)" ]; then \ mkdir "$(CLAM_TMP)"; \ fi' ifeq "$(QUIET)" "" $(HIDER)echo Project $(PROJECT) [$(shell basename $(shell dirname $(shell pwd) ) )/$(shell basename $(shell pwd) )] v. $(major).$(minor).$(revision).$(build) endif $(HIDER)rm -f $(FLAG_FILES) # "finish" announces the end of compilation. if there are targets to # run, then they are executed here. finish: ifeq "$(QUIET)" "" $(HIDER)echo Finished $(PROJECT). endif $(HIDER)rm -f $(FLAG_FILES) $(SUB_FLAG_FILES) ifeq "$(NOT_FIRST_MAKE)" "" $(HIDESH) -c '\ if [ ! -f "$(FAILURE_FILE)" ]; then \ $(SHELL) $(FEISTY_MEOW_SCRIPTS)/multimedia/sound_play.sh $(CLAM_FINISH_SOUND); \ fi' endif # toss the flag files so we do not see them again. $(HIDER)rm -f "$(DIRTY_FILE)" "$(SUBMAKE_FLAG)" # runs the programs specified in the RUN_TARGETS variable. run_targets: $(HIDESH)"$(CLAM_DIR)/target_runner.sh" #### "$(RUN_TARGETS)" # "make_subdirs" travels down each subdirectory and builds using make. make_subdirs: $(HIDESH) -c '\ for i in *; do \ if [ -d $$i ]; then \ if [ -f $$i/$(MAKEFILE_NAME) -a ! $$i -ef `pwd` ]; then \ echo; \ (cd $$i; $(MAKE) --silent NOT_FIRST_MAKE=t -f $(MAKEFILE_NAME) ); \ else \ echo Skipping makefile-less directory $$i...; \ echo; \ fi \ fi \ done; \ exit 0' # "clean" is a default target that removes object files, libs, executable # files and such that were created by the project. it invokes the makefile # again with the CLEAN variable defined so that this can be passed down into # all subsequent makes. clean: set_cleaner_variable clean_subdirs $(OTHER_CLEANS) ready_to_clean # no code here. set_cleaner_variable: $(eval CLEAN := true) ready_to_clean: @echo Whacking [$(CLEANUPS)] $(HIDESH) -c '\ echo the other cleans were: $(OTHER_CLEANS); \ echo the cleanup removal list is: $(CLEANUPS); \ if [ ! -z "$(CLEANUPS)" ]; then \ for i in $(CLEANUPS) nonexistentishfileforlist; do \ rm -rf "$$i"; \ done \ fi' # "clean_subdirs" travels down each subdirectory and cleans using make. clean_subdirs: $(HIDESH) -c '\ for smoot87 in *; do \ if [ -d "$$smoot87" ]; then \ echo "got inside first check of it being dir: $$smoot87"; \ if [ -f "$$smoot87/$(MAKEFILE_NAME)" -a ! "$$smoot87" -ef `pwd` ]; then \ echo "got inside barriers, with filename=$$smoot87 and all conditions met."; \ echo "the interesting one was: [$(test ! "$$smoot87" -ef `pwd` )]"; \ (cd "$$i"; $(MAKE) --silent NOT_FIRST_MAKE=t -f $(MAKEFILE_NAME) clean); \ else \ echo "Skipping makefile-less directory $$i..."; \ fi \ fi \ done; \ exit 0' ###echo Cleaning "$$i" now...; # "rm_links" removes the files in the current directory that are links # to other files. this is only useful in a unix environment. rm_links: $(HIDESH) -c '\ for i in *; do \ if [ -h "$$i" ]; then \ /bin/rm -f "$$i"; \ fi \ done; \ exit 0'