dorule1: RULE_DEPENDENT_VAR += rule1text
dorule2: RULE_DEPENDENT_VAR += rule2text
I don't think target-specific variables transcend targets, though.
HTH, Noel
David Wuertele wrote:
Can I set a variable only on condition that a rule is applied? For example:
# Running "make rule1" should echo "rule1text" on the console.
rule1: dorule1 print rule2: dorule2 print
dorule1: @echo in rule1 RULE_DEPENDENT_VAR+=rule1text
dorule2: @echo in rule2 RULE_DEPENDENT_VAR+=rule2text
print: @echo $(RULE_DEPENDENT_VAR)
(Unforunately, the above results in the error "RULE_DEPENDENT_VAR+=rule1text: command not found")
Goal: I have some rules that unpacks some sources, applies patches, and builds. The rules are designed so that the sources can be .tar.gz or .tar.bz2 (and many other options as well). At the end of building everything, I want to copy all sources into a package, but I only want to copy the version that was actually used. Here is an example:
$(BUILD)/%/.unpacked: $(TARBALLS)/%.tar.gz rm -rf $(@D) mkdir -p $(BUILD) cd $(BUILD) && tar xvzf $<
$(BUILD)/%/.unpacked: $(TARBALLS)/%.tar.bz2 rm -rf $(@D) mkdir -p $(BUILD) cd $(BUILD) && tar xvjf $<
I would like to have a variable called something like MANIFEST that gets appended to automatically when one of the above rules is invoked. For example, if I have the files
fred.tar.gz fred.tar.bz2
in my sources directory, and I do a build, maybe "fred.tar.gz" will get unpacked, maybe "fred.tar.bz2" will get unpacked. Only one gets unpacked. I want THAT one to be added to MANIFEST. So, if the first rule (the tar.gz rule) was activated, I want MANIFEST to contain "fred.tar.gz", and if the second rule was activated, I want MANIFEST to contain "fred.tar.bz2".
Is there an easy way to accomplish this?
_______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
_______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
