mg-define-prereq=$(eval $1: $2)
+# CLEAN
+
+# A command that finds all genfiles in a given directory and deletes them and
+# the corresponding generated files. If a file is overridden, only the genfile
+# is deleted.
+#
+# Example:
+#
+# clean:
+# $(call mg-clean-cmd,.)
+# .PHONY: clean
+
+define mg-clean-cmd
+ @exec 3>&1 &&\
+ find $1 -name '*.g' | while read gf; do\
+ f="$${gf%.g}" &&\
+ if ! [ "$$f" -nt "$$gf" ]; then\
+ echo "rm -f '$$f'" >&3 && echo "$$f";\
+ fi &&\
+ echo "$$gf";\
+ done | xargs rm -f
+endef
+
+
# DEPENDENCY-LOGGING COMMANDS
mg-dlc-static-run-oid:=$(mg-genfile-oid)