This is actually a very old and well known issue. It's not a deliberate feature, more a missing capability which no one has ever filled in. There's no way to tell make that one recipe makes multiple *explicit* targets; however the same flaw does not affect pattern rules. This is discussed in the manual in various places such as https://www.gnu.org/software/make/manual/make.html#Pattern-Intro :
"Pattern rules may have more than one target. Unlike normal rules, this does not act as many different rules with the same prerequisites and recipe. If a pattern rule has multiple targets, make knows that the rule’s recipe is responsible for making all of the targets. The recipe is executed only once to make all the targets...." Multiple workarounds have been published; google around and you should find them. However the most robust solution, where possible, is to use pattern rules instead. Sometimes it's possible to pretend an explicit rule is implicit by appending a %. For instance this use of explicit rules does the wrong thing: % cat Makefile .PHONY: all all: axx bxx axx bxx: cxx dxx touch $@ touch bxx % make -j touch axx touch bxx touch bxx touch bxx But when converted to a fake pattern rule it works correctly: % cat Makefile .PHONY: all all: axx bxx ax% bx%: cxx dxx touch $@ touch bxx % make -j touch axx touch bxx David On Wed, Feb 28, 2018 at 6:52 AM, Alberto Luaces <alua...@udc.es> wrote: > Sébastien Hinderer writes: > > > Dear Alberto, > > > > Many thanks for your response. > > > > The comand was jsut an example, the real world one si different. Sorry > > for the confusion it may have introduced. > > > > Hi Sébastien. No problem! > > Just post an example of what are you trying to do exactly, and we will > manage to help you. > > Regards, > > -- > Alberto > > > _______________________________________________ > Help-make mailing list > Help-make@gnu.org > https://lists.gnu.org/mailman/listinfo/help-make > _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make