[csw-devel] SF.net SVN: gar:[10981] csw/mgar/gar/v2/gar.mk
dmichelsen at users.sourceforge.net
dmichelsen at users.sourceforge.net
Thu Sep 16 20:45:05 CEST 2010
Revision: 10981
http://gar.svn.sourceforge.net/gar/?rev=10981&view=rev
Author: dmichelsen
Date: 2010-09-16 18:45:05 +0000 (Thu, 16 Sep 2010)
Log Message:
-----------
mGAR v2: Add EXPANDVARS
Modified Paths:
--------------
csw/mgar/gar/v2/gar.mk
Modified: csw/mgar/gar/v2/gar.mk
===================================================================
--- csw/mgar/gar/v2/gar.mk 2010-09-16 17:36:11 UTC (rev 10980)
+++ csw/mgar/gar/v2/gar.mk 2010-09-16 18:45:05 UTC (rev 10981)
@@ -405,7 +405,9 @@
extract-modulated: checksum-modulated $(EXTRACTDIR) $(COOKIEDIR) \
$(addprefix dep-$(GARDIR)/,$(EXTRACTDEPS)) \
announce-modulation \
- pre-extract-modulated pre-extract-$(MODULATION) $(EXTRACT_TARGETS) post-extract-$(MODULATION) post-extract-modulated $(if $(filter global,$(MODULATION)),,post-extract-gitsnap)
+ pre-extract-modulated pre-extract-$(MODULATION) $(EXTRACT_TARGETS) post-extract-$(MODULATION) post-extract-modulated \
+ $(if $(filter global,$(MODULATION)),,post-extract-gitsnap) \
+ $(foreach FILE,$(EXPANDVARS),expandvars-$(FILE))
@$(DONADA)
# This target ensures that the values used by git when making a commit
@@ -443,6 +445,15 @@
extract-p:
@$(foreach COOKIEFILE,$(EXTRACT_TARGETS), test -e $(COOKIEDIR)/$(COOKIEFILE) ;)
+# The rule takes all files from EXPANDVARS and replaces all occurrences of @<var>@ in the file
+# with the values of <var> from the Makefile.
+_var_definitions = $(foreach VAR,$(shell perl -ne 'print "$$1 " if( /@([^@]+)@/ )' <$1),$(VAR)=$($(VAR)))
+
+expandvars-%:
+ $(call _var_definitions,$(WORKDIR)/$*) perl -i-unexpanded -npe 's/@([^@]+)@/$$ENV{$$1}/e' $(WORKDIR)/$*
+ @$(MAKECOOKIE)
+
+
# checkpatch - Do a "patch -C" instead of a "patch". Note
# that it may give incorrect results if multiple
# patches deal with the same file.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list