GNUMake document says
"An argument that contains ‘=’ specifies the value of a variable: ‘v=x’ sets the value of the variable v to x. If you specify a value in this way, all ordinary assignments of the same variable in the makefile are ignored; we say they have been overridden by the command line argument"
This means, value defined as command-line argument has top priority in terms of variable definition.
< Make file >
PRIV_V=hello_OUT
$(info $(PRIV_V))
all: a b
@echo all
a: PRIV_V := hello_A
a:
@echo $(PRIV_V)
b: PRIV_V := hello_B
b:
@echo $(PRIV_V)
< Test >
$ export PRIV_V=ENV
$ make
hello_OUT
hello_A
hello_B
all
$ make PRIV_V=CMD
CMD
CMD
CMD
all
* Tips : Variable definition in gnumake command line.
Variable definition syntax in the Makefile, is also available as command line argument.
Example.
$ make CC=Hello
$ make CC:=Hello
$ make CC+=Hello
'Tools' 카테고리의 다른 글
[Mocha] Limitation at testing async function (0) | 2019.05.03 |
---|---|
[VSCode][Mocha] Breakpoint at Mocha-test with typescript! (0) | 2019.05.03 |
[Gnumake] Organizing my knowledge about 'gnumake' (0) | 2013.07.11 |
[GNUMake] deferred & immediate assignment. (0) | 2013.07.05 |
[ Emacs ] key-bindings.... (my environment) (0) | 2012.03.23 |