[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Implement Check on Input Values
From: |
David Boyce |
Subject: |
Re: Implement Check on Input Values |
Date: |
Mon, 8 Aug 2011 15:08:04 -0400 |
On Mon, Aug 8, 2011 at 2:35 PM, Stephan Beal <address@hidden> wrote:
> 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.
Good point.
> i wasn't aware of $(if) (call me old-fashioned). That is certainly simpler
> than using if/endif blocks.
Another way:
$(info $(shell test -d $(WORK_DIR) || mkdir -p $(WORK_DIR)))
(the $(info) is there on the off chance it generates output). Also,
note a beneficial side effect of mkdir -p is that, unlike mkdir alone,
it's silent and happy if the dir already exists. So you can just do an
unequivocal
$(info $(shell mkdir -p foo))
to make sure a directory exists. It's never good to do a mkdir in a
recipe (race condition under -j), so all these ways are preferred in
that they work directly from the make process. In the OP's case it
might be necessary to combine them with target-specific variables:
foobar: _dummy := $(shell ...)
-David Boyce
Re: Implement Check on Input Values, Lane Schwartz, 2011/08/08