Re: [PATCH][RFC] gcc3 arch options

J.A. Magallon (jamagallon@able.es)
Mon, 27 May 2002 23:42:48 +0200


On 2002.05.27 Kai Germaschewski wrote:
>On Mon, 27 May 2002, David Woodhouse wrote:
>
>> jamagallon@able.es said:
>> > +CFLAGS += $(shell if $(CC) -march=pentium-mmx -S -o /dev/null -xc /
>> > dev/null >/dev/null 2>&1; then echo "-march=pentium-mmx"; else echo
>> > "-march=i586"; fi)
>>
>> Doesn't this run the shell command every time $(CFLAGS) is used?
>
>CFLAGS is initially defined with ':=', which, as opposed to '=' means to
>evaluate directly and store the resulting string, so it should be fine.
>
>Even if it wasn't, only the evaluations from the top-level Makefile would
>cause the command to be executed, make will always pass down the evaluated
>result to the subdir makes.
>

It even does not depend on that. That is exactly the difference between
$(shell ) and backquoting.

Try this (with both = and :=):

# Makefile

A=
B=
#A:=
#B:=
A+=$(shell date)
B+=`date`

all:
@echo "A="$(A)
@sleep 2
@echo "A="$(A)
@sleep 2
@echo "B="$(B)
@sleep 2
@echo "B="$(B)

-- 
J.A. Magallon                           #  Let the source be with you...        
mailto:jamagallon@able.es
Mandrake Linux release 8.3 (Cooker) for i586
Linux werewolf 2.4.19-pre8-jam4 #2 SMP dom may 26 11:20:42 CEST 2002 i686
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/