makefile doesn't reuse variables as expected

17 Views Asked by At

Makefile

SRC := a

first: $(SRC)
        @echo $(SRC)
        @echo "$@ $<"

SRC := b

second: $(SRC)
        @echo $(SRC)
        @echo "$@ $<"

Why does it echo "b"?

make first
b
first a

Thanks, Ron

I'm trying to reuse variables in a Makefile and expected variables to have the value most recently assigned.

0

There are 0 best solutions below