Le 15 juin 2012 à 11:34, Stefano Lattarini a écrit :
>> Sometimes you using ifdef, and sometimes ifeq "". Are they equivalent?
>>
> AFAIU, these are equivalent:
>
> ifdef VAR
>
> ifneq "$(VAR)" ""
>
> But of course, there no way to express something like this with ifdef:
>
> ifneq "$(VAR-1)$(VAR-2)" ""
Yes, of course. Maybe note also this warnings from make.info:
Often you want to test if a variable has a non-empty value. When
the value results from complex expansions of variables and
functions, expansions you would consider empty may actually
contain whitespace characters and thus are not seen as empty.
However, you can use the `strip' function (*note Text Functions::)
to avoid interpreting whitespace as a non-empty value. For
example:
ifeq ($(strip $(foo)),)
TEXT-IF-EMPTY
endif
will evaluate TEXT-IF-EMPTY even if the expansion of `$(foo)'
contains whitespace characters.
>> There's no way to avoid forking another Make here?
>>
> So far I've found no natural way (note that such a fork is there also in
> mainline Automake, so this is not a performance regression at least).
I know.
> The
> problem is that all $(BUILT_SOURCES) must be created before we run any of
> all-recursive, all-am, or *any of their prerequisites*. I don't know
> whether there is any natural way to accomplish that with GNU make. Any
> suggestion?
I don't know. Maybe using order only dependencies?
%LOCAL-HEADERS% $(BUILT_SOURCES) :| $(if $(SUBDIRS),all-recursive,all-am)
all: %LOCAL-HEADERS% $(BUILT_SOURCES) $(if $(SUBDIRS),all-recursive,all-am)
>>> am__mkdir = test -d $1 || $(MKDIR_P) $1
>>
>> Is the "test" really needed? "mkdir -p /already/exists" should silently
>> exit 0, shouldn't it?
>>
> Yes, but then it would cause an extra fork even if the target directory
> already exists. I reckon that would quite displease our Cygwin users ;-)
Ah, yes, test is expected to be a built-in. Thanks.
> Thanks. I understand this is an ACK then?
Sure!