From e526873c5277ad28f7efb24d949240f07a95dd43 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Wed, 17 May 2023 17:13:51 +0200 Subject: make: add comment about cmdline args --- src/development/make.md | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/development/make.md') diff --git a/src/development/make.md b/src/development/make.md index dcc9fe6..1ebe98e 100644 --- a/src/development/make.md +++ b/src/development/make.md @@ -54,7 +54,7 @@ bbb: ``` Running above `Makefile` gives: -```test +```text @ = foobar < = aaa ^ = aaa bbb @@ -72,6 +72,25 @@ Running above `Makefile` gives: Variables related to filesystem paths: - `$(CURDIR)`: Path of current working dir after using `make -C path` +## Arguments + +Arguments specified on the command line *override* ordinary variable +assignments in the makefile ([overriding variables][make-var-override]). + +```make +VAR = abc +all: + @echo VAR=$(VAR) +``` + +```text +# make +VAR=abc + +# make VAR=123 +VAR=123 +``` + ## Useful functions ### Substitution references @@ -108,3 +127,5 @@ Resolve each file name as canonical path. ```make $(realpath fname1 fname2 ..) ``` + +[make-var-override]: https://www.gnu.org/software/make/manual/html_node/Overriding.html -- cgit v1.2.3