I certainly tried out your snippet the first time before replying 🙂 To my mind, what you're missing is the fact that `build/% : BAR +=' is evaluated as part of `build/release'.
It is no different than the following snippet from the manual: 🙶 objects = foo.o bar.o foo.o : defs.h bar.o : defs.h test.h $(objects) : config.h 🙸 In the above snippet, last line is not recipe for for `$(objects)'. However, it does mutate its prerequisites. In the same vein, line #2 of your snippet, while not being a recipe for `build/release', updates its prerequisites (in this case just a variable.) See https://www.gnu.org/software/make/manual/make.html#Multiple-Rules Does that make sense? -- Bahman Join the chatter on Matrix: 🌐 https://matrix.to/#/#.mk:matrix.org Subscribe to the Lemmy community: 🌐 https://lemmy.ml/c/makefile On Wed, 2023-09-27 at 16:35 +0200, Markus F.X.J. Oberhumer wrote: > I think you did not get what I'm complaining about. Please > try this 3-line Makefile: > > ### BEGIN > FOO += > build/%: BAR += > build/release: ; @echo "FOO='$(FOO)' BAR='$(BAR)'" > ### END > > And run "make FOO=X BAR=Y" > > BAR is now **two** Y aka 'Y Y' which does not make any sense. > > ~Markus >