1 # CLAM System default rule and target definitions.
3 ###############################################################################
5 # This file contains composite macros and rules for creating objects.
6 # This file should be included in the user's makefile after the variables
7 # have been initialized appropriately for the particular project being
8 # created. The user's own targets should be placed after the include
9 # directive that specifies this file.
11 ###############################################################################
13 # This ensures that any of other projects required by this one (defined through
14 # BUILD_BEFORE) get created before the real work in this project is done.
15 ifneq "$(BUILD_BEFORE)" ""
16 FIRST_TARGETS += $(BUILD_BEFORE:%=%.make)
18 ifneq "$(BUILD_AFTER)" ""
19 LAST_TARGETS += $(BUILD_AFTER:%=%.make)
22 # Make the default action be an error stop if we can't find an appropriate rule.
25 $(HIDER)echo [$@] is missing files or has a makefile problem.
27 $(HIDESH)$(CLAM_DIR)/exit_make.sh
29 # This rule halts make for some supposedly devastating reason. More
30 # information should be printed out by the cause of the halt.
32 @echo CLAM execution halted, the cause being: $@
33 $(HIDESH)$(CLAM_DIR)/exit_make.sh
35 # Provides a time-stamp in the make log.
37 $(HIDER)echo "{$(shell date)}"
39 # The .make rule changes to the directory with the same first part of the
40 # pattern and makes whatever projects are there. This is used by the build
45 if [ -f "$*/$(MAKEFILE_NAME)" ]; then \
46 $(MAKE) --silent -f "$(MAKEFILE_NAME)" NOT_FIRST_MAKE=t -C "$*"; \
48 echo "Asked to build directory [$*] but there was no makefile."; \
51 echo Skipping missing directory [$*]; \
53 #hmmm: maybe convert above to a script also.
55 # always run the exes listed in RUN_TARGETS.
58 # "all" is the first target to execute in any makefile. we capture it and
59 # use it to produce the requested actions.
60 all: start $(ACTUAL_FIRST_TARGETS) $(ACTUAL_TARGETS) $(ACTUAL_LAST_TARGETS) run_targets finish
62 # "start" announces the beginning of compilation.
65 if [ ! -d "$(CLAM_TMP)" ]; then \
66 mkdir "$(CLAM_TMP)"; \
69 $(HIDER)echo Project $(PROJECT) [$(shell basename $(shell dirname $(shell pwd) ) )/$(shell basename $(shell pwd) )] v. $(major).$(minor).$(revision).$(build)
71 $(HIDER)rm -f $(FLAG_FILES)
73 # "finish" announces the end of compilation. if there are targets to
74 # run, then they are executed here.
77 $(HIDER)echo Finished $(PROJECT).
79 $(HIDER)rm -f $(FLAG_FILES) $(SUB_FLAG_FILES)
80 ifeq "$(NOT_FIRST_MAKE)" ""
82 if [ ! -f "$(FAILURE_FILE)" ]; then \
83 $(SHELL) $(FEISTY_MEOW_SCRIPTS)/multimedia/sound_play.sh $(CLAM_FINISH_SOUND); \
86 # toss the flag files so we do not see them again.
87 $(HIDER)rm -f "$(DIRTY_FILE)" "$(SUBMAKE_FLAG)"
89 # runs the programs specified in the RUN_TARGETS variable.
91 $(HIDESH)"$(CLAM_DIR)/target_runner.sh"
93 # "make_subdirs" travels down each subdirectory and builds using make.
95 $(HIDESH)$(CLAM_DIR)/make_subdirs.sh
97 # "clean" is a default target that removes object files, libs, executable
98 # files and such that were created by the project. it invokes the makefile
99 # again with the CLEAN variable defined so that this can be passed down into
100 # all subsequent makes.
101 clean: set_cleaner_variable $(OTHER_CLEANS) scratch_other_cleans clean_subdirs ready_to_clean
104 set_cleaner_variable:
105 $(eval CLEAN := true)
107 scratch_other_cleans:
108 $(eval OTHER_CLEANS := )
110 ready_to_clean: $(OTHER_CLEANING_TASKS)
111 echo hey the other clean should have happened above.
112 @echo Whacking [$(CLEANUPS)]
113 # @echo could also be cleaning the first and last targets...
114 # @echo FIRST_TARGETS=$(FIRST_TARGETS)
115 # @echo LAST_TARGETS=$(LAST_TARGETS)
117 if [ ! -z "$(CLEANUPS)" ]; then \
118 for spork19 in $(CLEANUPS) nonexistentishfileforlist; do \
119 rm -rf "$$spork19"; \
123 # "clean_subdirs" travels down each subdirectory and cleans using make.
125 $(HIDESH)$(CLAM_DIR)/clean_subdirs.sh
127 # "rm_links" removes the files in the current directory that are links
128 # to other files. this is only useful in a unix environment.
131 for gujira26 in *; do \
132 if [ -h "$$gujira26" ]; then \
133 /bin/rm -f "$$gujira26"; \