On Monday 01 September 2003 07:26 am, [EMAIL PROTECTED] wrote: > Hi, > > I want to define a dependency for several files in the cmd directory like > this: > > %project/out : %cmd/*.tcl > This failed, the * did not expand as far as I could see. >
This is because the expansion is done before any parsing of the implicit rule definition. So you're literally trying to expand %cmd/*.tcl (with the %), which I don't think you have. The expansion of the % in the implicit rule is done later. Try using make -p and you'll be better able to understand. > Now I tried: > %project/out : %$(wildcard cmd/*.tcl) > > Now I was surpised to see only the first .tcl file get the % expanded. All > the other files did not !(just cmd/<file>.tcl) > So this did not work either. Not the way you expected, no. The expansion of what you have above is a single % followed by a list of filenames. What you're expecting, which is the % should be appended to each filename, should be done with something like $(patsubst ...). > Now I tried a work around like: > CMD = $(shell ls cmd/*.tcl | sed 's/cmd/%cmd/') > %project/out: $CMD > > Now it works as I would expect. > (This actually reproduces a hand made list of %cmd/<files>.tcl which > worked also.) > > Now I wonder, is there really not a better way to do this other than > "hacking" by shell commands? The shell commands could be replaced by $(patsubst %,\%%,$(wildcard cmd/*.tcl)) However, if you're looking for a more elegant solution, then we'll need to know a little more about you're actually trying to do. I'm still a bit confused about what your directory structure is. > Could this be a bug? No. Mike Gibson _______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
