On Mon, Aug 8, 2011 at 8:20 PM, David Boyce <[email protected]> wrote: > On Mon, Aug 8, 2011 at 1:19 PM, Stephan Beal <[email protected]> > wrote: > >> ifeq (1,$(words $(wildcard $(WORK_DIR))) > > The wildcard function is defined to return a null string iff the named > file doesn't exist, thus: > > $(if $(wildcard $(WORK_DIR)),,$(error make: $(WORK_DIR): no such > directory)) > > would suffice as a test. You could just as easily do this as an > if/endif pair if preferred. >
True, but $(wildcard) can expand to multiple words, so the ifeq(1,$(words...)) hack is a bit safer against undesired side-effects if someone accidentally or maliciously adds a ? or * to the value. But it of course won't work if the path has a space in it, which would cause $(words) to be >1. i wasn't aware of $(if) (call me old-fashioned). That is certainly simpler than using if/endif blocks. -- ----- stephan beal http://wanderinghorse.net/home/stephan/ _______________________________________________ Help-make mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-make
