%% Steve James <[EMAIL PROTECTED]> writes: sj> Given this makefile:
sj> all: setup sj> @echo wildcard value is $(wildcard xxx) sj> setup: sj> @mkdir -p xxx sj> I find that the $(wildcard xxx) evals to nothing if directory sj> "xxx" does not exist before invoking make. This surprises me. sj> When are the variables in a target's rules expanded, before making sj> prerequisites or after? I would have assumed after. This is because GNU make caches the contents of directories, for speed purposes. When you have a rule that builds something other than what it says it builds (here, the "setup" rule builds the directory "xxx", which make doesn't know about) then the cache is not updated correctly and things like $(wildcard ...) return the wrong values. This is not a good way to make directories anyway; it's very error prone. If you want to be sure that a directory exists you should do it like this: __dummy := $(shell [ -d xxx ] || mkdir -p xxx) This will be invoked every time the makefile is parsed, regardless of what arguments you give to make. -- ------------------------------------------------------------------------------- Paul D. Smith <[EMAIL PROTECTED]> Find some GNU make tips at: http://www.gnu.org http://www.paulandlesley.org/gmake/ "Please remain calm...I may be mad, but I am a professional." --Mad Scientist _______________________________________________ Help-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-make
