- Factor out `%: %.g' rule as mg-file-from-genfile .
authorMatt McCutchen <hashproduct@gmail.com>
Fri, 8 Jun 2007 18:29:23 +0000 (14:29 -0400)
committerMatt McCutchen <hashproduct@gmail.com>
Fri, 8 Jun 2007 18:29:23 +0000 (14:29 -0400)
- Add comment about applicability of mg-define-prereq .

src/mage.mk

index 22e33aa..0b1c564 100644 (file)
@@ -128,16 +128,17 @@ $1.g: mg< = $$(firstword $$(mg^))
 $1.g: $2 $$$$(mg-scout-target) MG-FORCE
        $$(mg-generate)
 
+$(mg-file-from-genfile)
+)
+endef
+
+define mg-file-from-genfile
 # If the file was regenerated, load the new genfile.
 # If not, replay any warnings.
-## We don't have to worry about .DELETE_ON_ERROR deleting the target because
-## it is only touched if we *successfully* regenerate it.
-# - No longer applies because we don't remember errors.
 # HMMM Maybe errors should go to stderr???
 $1: MG-FORCE | $1.g
        $$(call gload,$$@)
        $$(if $$($$@@warnings),$$(if $$($$@@built),,$$(info $$($$@@cmd) # warning replay)$$(info $$($$@@warnings))),)
-)
 endef
 
 # If the target is unmanaged, we must run the rule; we'll see that the
@@ -148,7 +149,8 @@ mg-scout-target=$(if $(wildcard $(target)),$(scout-oid)$(aname)$(target),)
 mg-check-cmd=$(if $(call streq,$(cmd),$($(target)@cmd)),,x)
 
 # Just add additional prerequisites.
-# I don't think this works for implicit rules.
+# I don't think this can add patterns to implicit rules, but it should be able
+# to add specific prerequisites to uses of implicit rules.
 define mg-define-prereq
 $(eval 
 $1.g: $2