diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-07-02 21:25:19 +0200 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2023-07-02 21:25:19 +0200 |
commit | 0f5f0d65a05ff8f878122f3a360ce814b2499b8d (patch) | |
tree | 798d91d1ae2ce45b0628bb853aed0c85c50aab96 /src | |
parent | e730452fd8bd6824d35f25f2e87b8ec788b626fd (diff) | |
download | notes-0f5f0d65a05ff8f878122f3a360ce814b2499b8d.tar.gz notes-0f5f0d65a05ff8f878122f3a360ce814b2499b8d.zip |
make: add patsubst example
Diffstat (limited to 'src')
-rw-r--r-- | src/development/make.md | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/development/make.md b/src/development/make.md index 1ebe98e..254a7d7 100644 --- a/src/development/make.md +++ b/src/development/make.md @@ -101,6 +101,15 @@ out := $(in:.o=.c) # => out = a.c l.a c.c ``` +### `patsubst` ([ref][make-patsubst]) +```make +in := a.c b.c +out := $(patsubst %.c, build/%.o, $(in)) +# => out = build/a.o build/b.o + +# This is actually equivalent to $(in:%.c=build/%.o) +``` + ### `filter` Keep strings matching a pattern in a list. ```make @@ -129,3 +138,4 @@ $(realpath fname1 fname2 ..) ``` [make-var-override]: https://www.gnu.org/software/make/manual/html_node/Overriding.html +[make-patsubst]: https://www.gnu.org/software/make/manual/html_node/Text-Functions.html#index-patsubst-1 |