Scripsit "Albert D. Cahalan" <[EMAIL PROTECTED]> > -------- this didn't work -------- > $(BINFILES) : $(notdir $@) > $(install) --mode a=rx --strip $(notdir $@) $@ > ---------------------------------
> It seems make doesn't set $@ where I want it set. No. That's one of the things you just have to know: automatic variables work *only* in commands, not in dependency list or elsewhere. This doesn't seem to be said explicitly in the manual, but I'm sure that Paul would welcome an actual patch for it, if you care enough to learn Texinfo and figure out where to add what language. The technical reason for this is that variables in the entire dependencies line are only onfolded once, namely to read the dependency information info make's database. On the other hand, variables (and function applications) in *command* lines are only expanded hen the command is actually about to be launched, at which point the automatic variables have been set. > ------ also didn't work ------- > $(BINFILES) : % : $(notdir %) > $(install) --mode a=rx --strip $(notdir $@) $@ > ------------------------------ > That won't do it either, for some really strange reason. The reason is the same: When the dependency line is read in, the following happens *in order*: 1. Variables and function calls are expanded. The function call "$(notdir %)" expands to "%" because the notdir function does not assign any special mening to the % character, and the non-directory part of a file called "%" is indeed "%". 2. Then the line is parsed as a static pattern rule, and the targets and patterns are stored in the database. Now "%" does have a special significanse, but "$" has lost _its_ special significanse. 3. Then one of the $(BINFILES) are to be remade, its name is matched against the "%" target pattern and root thus found is inserted in the dependency pattern "%". > It'd be mighty nice if somebody could fix my code too. :-) If your $(BINFILES) live in different directories, I dont think there's any way to get around writing separate rules for each directory (save for some kind of clever abuse of the new $(eval ...) function in 3.80 which I have not investigate in detail). If they are in the same directory, I would try something like $(BINFILES) : $(exec_prefix)/% : % <do stuff> It would indeed be convenient from time to time to have variables in the dependency list of a (static) pattern rule be unfolded only after the target has been selected. However, this would lead to parsing problems: The colons that seperate different parts of the rule can *themself* arise from variable expansions - so how would poor make know when to defer further expansion until the target is known? It wouldn't do to redefine the rules such that the colons must be explicitly given in the rule, because someone, somewhere, is sure to have a Makefile that depend on getting the rule punctuation from variables - and they would have a right to expect it to work, because all other make implementation I know works that way. [Disclaimer: I am not a GNU make developer, much less the maintainer. I just try to relieve the guys who do the real work by answering questions that I feel competent to answer.] -- Henning Makholm "Khanivore is climbing out of its life-support pod." _______________________________________________ Bug-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-make