Search notes:

GNU make: function $(foreach …)

$(foreach  var,list,text)
The following example iterates over each word in $(list).
In each iteration, first the variable with the name word is set to the value of the word of the iteration, and then, the text $(word)-$(word) is expanded.
Thus, this makefile prints foo-foo bar-bar baz-baz when invoked.
list = foo bar baz
list_2 = $(foreach word,$(list),$(word)-$(word))

all:
	@echo $(list_2)
Github repository about-Makefile, path: /functions/foreach/double-words.mak
Of course, calls to $(foreach) can be nested:
bla      = foo bar baz
list_foo = ding dong
list_bar = one two three
list_baz = XXX

cross_product = $(foreach T, $(bla),   \
	$(foreach U, $(list_$T),             \
	   $T\,$U                            \
	)                                    \
)

all:
	@echo $(cross_product)
Github repository about-Makefile, path: /functions/foreach/nested.mak
When invoked, the above makefile prints foo,ding foo,dong bar,one bar,two bar,three baz,XXX.

See also

make

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759414226, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/make/functions/foreach(70): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78