Update assignment section "=" (#1626)

I think these are more informative and precise examples for assignment expression.
This commit is contained in:
Mohammed Samir 2021-03-10 23:07:03 +02:00 committed by GitHub
parent 1e966a9ff1
commit 02fed04a43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 7 deletions

View File

@ -8,10 +8,13 @@ category: CLI
## Var assignment ## Var assignment
```makefile ```makefile
uglify = $(uglify) # lazy assignment foo = "bar"
compressor := $(uglify) # immediate assignment bar = $(foo) foo # dynamic (renewing) assignment
prefix ?= /usr/local # safe assignment foo := "boo" # one time assignment, $(bar) now is "boo foo"
hello += world # append foo ?= /usr/local # safe assignment, $(foo) and $(bar) still the same
bar += world # append, "boo foo world"
foo != echo fooo # exec shell command and assign to foo
# $(bar) now is "fooo foo world"
``` ```
`=` expressions are only evaluated when they're being used. `=` expressions are only evaluated when they're being used.
@ -98,7 +101,6 @@ make
-e, --environment-overrides -e, --environment-overrides
-B, --always-make -B, --always-make
-s, --silent -s, --silent
-j, --jobs=N # parallel processing -j, --jobs=N # parallel processing
``` ```