From: Matt McCutchen Date: Fri, 8 Jun 2007 18:29:23 +0000 (-0400) Subject: - Factor out `%: %.g' rule as mg-file-from-genfile . X-Git-Url: https://mattmccutchen.net/mgear/mgear.git/commitdiff_plain/a62dce77118722372f753ab0589d59a0c1d5f0c1 - Factor out `%: %.g' rule as mg-file-from-genfile . - Add comment about applicability of mg-define-prereq . --- diff --git a/src/mage.mk b/src/mage.mk index 22e33aa..0b1c564 100644 --- a/src/mage.mk +++ b/src/mage.mk @@ -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