TIL
Notes on makefile
- 1 minutes read - 108 wordsThere are two types of variable declaration.
- recursively expanded variables -
foois assigned withbarwhich inturns assigned toughwhose value isHuh?
foo = $(bar)
bar = $(ugh)
ugh = Huh?
all:;echo $(foo)
$ make
$ Huh?
- simply expanded variables -
foois assigned withbarhowever bar is not defined yet. so it outputs to nothing.
foo := $(bar)
bar := $(ugh)
ugh := Huh?
all:;echo $(foo)
$ make
$
NOTE: To echo something it needs to be in a target. Here the target name is all.
If I don’t want to have target and print something I can use warning.
Reference:
https://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/make_6.html