# 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: establish_cleanup_variable $(OTHER_CLEANS) scratch_other_cleans clean_subdirs ready_to_clean
+clean: establish_cleanup_variable $(OTHER_CLEANS) scratch_other_cleans clean_subdirs add_to_cleanups_variable ready_to_clean
@# no code here.
establish_cleanup_variable:
scratch_other_cleans:
$(eval OTHER_CLEANS := )
+# add late breaking items to the cleanup list. this is mainly the actual
+# targets to build , since those are not specified until the user makefile
+# is included. we take a liberty here and also add non ".exe" versions in
+# case we are running on linux.
+add_to_cleanups_variable:
+ echo going to add to cleanup variable now.
+ $(eval CLEANUPS = $(CLEANUPS) $(ACTUAL_TARGETS) $(ACTUAL_TARGETS:%.exe=%) )
+ echo "new CLEANUPS variable: $(CLEANUPS)"
+
# guard the main cleaning task with our variable
# so we do not pull in subtargets when we do not want to.
-ifneq "$(CLEAN)" ""
-ready_to_clean: $(OTHER_CLEANING_TASKS)
+ready_to_clean:
@echo Whacking [$(CLEANUPS)]
$(HIDESH) -c '\
if [ ! -z "$(CLEANUPS)" ]; then \
rm -rf "$$spork19"; \
done \
fi'
-else
-ready_to_clean:
- @# do nothing.
-endif
+
+############################################################################
# "clean_subdirs" travels down each subdirectory and cleans using make.
clean_subdirs: