diff --git a/README.md b/README.md index 2ccae23..3d8b7d9 100644 --- a/README.md +++ b/README.md @@ -1289,7 +1289,7 @@ These are the directories: foo.c bar.c baz.c $(addprefix prefix,names…) ``` -For each reference in `names`, appends a prefix to it. The final result is the prefix concatenated with each reference, separated by a space between each final reference. +For each reference in `names`, it appends `prefix` to it. The final result is the prefix concatenated with each reference, separated by a space between each final reference. Here's an example ([code/22-addprefix-example](code/22-addprefix-example)): @@ -1310,6 +1310,35 @@ Final paths: sources/foo.c sources/bar.c sources/baz.c + +
+

addsuffix

- appends a suffix to strings
+ +``` +$(addsuffix suffix,names…) +``` + +For each reference in `names`, it appends `suffix` to it. The final result is the suffix concatenated with each reference, separated by a space between each final reference. + +Here's an example ([code/23-addsuffix-example](code/23-addsuffix-example)): + +```Makefile +FILES = foo bar baz + +all: + echo Final object files: $(addsuffix .o, $(FILES)) +.SILENT: +``` + +Output: + +``` +Final object files: foo.o bar.o baz.o +``` + +
+ +