-clean:
- $(HIDER)$(MAKE) --silent CLEAN=t ready_to_clean
-
-ready_to_clean: $(OTHER_CLEANS) clean_subdirs
- @echo Whacking [$(CLEANUPS)]
+clean: establish_cleanup_variable $(OTHER_CLEANS) scratch_other_cleans clean_subdirs add_to_cleanups_variable ready_to_clean
+ @# no code here.
+
+establish_cleanup_variable:
+ $(eval CLEAN := true)
+
+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 different versions of
+# the file suffixes so we can clean all versions of the targets.
+add_to_cleanups_variable: $(SUPPLEMENTAL_CLEANUP_TARGETS)
+ $(eval CLEANUPS = $(ACTUAL_TARGETS) $(CLEANUPS) )
+# $(eval CLEANUPS = $(ACTUAL_TARGETS) $(ACTUAL_TARGETS:%.exe=%) $(ACTUAL_TARGETS:%.dll=%.so) $(ACTUAL_TARGETS:%.so=%.dll) $(CLEANUPS) )
+# echo "new CLEANUPS variable: $(CLEANUPS)"
+
+# main cleaning task.
+ready_to_clean:
+ifneq "$(CLEANUPS)" ""
+ @echo Whacking [$(notdir $(CLEANUPS))]
+endif