Re: [PATCH][RFC] gcc3 arch options

Kai Germaschewski (kai-germaschewski@uiowa.edu)
Mon, 27 May 2002 17:47:58 -0500 (CDT)


On Mon, 27 May 2002, J.A. Magallon wrote:

> >CFLAGS is initially defined with ':=', which, as opposed to '=' means to
> >evaluate directly and store the resulting string, so it should be fine.
>
> 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)

Actually, it makes a difference. Backquoting doesn't really have anything
to do with the problem at all, since make doesn't understand it, it
just puts literally "`date`" into the variable, so you pass
echo "B="`date` to the shell, which will then to the substitution.

(Try

C = `echo all.c`

all: $(C)

it won't compile all, even if there is all.c - backquoting can only work
in the command part of a rule.)

Anyway, A= vs A:=, A += $(shell ...) behaves differently, as I
conjectured. Example:

VAR =
#VAR :=
VAR += $(shell echo $$RANDOM)

all:
@echo $(VAR)
@echo $(VAR)

Not that it really matters...

--Kai

-
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/