[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Question] multiple targets for implicit rule

From: LeJacq, Jean Pierre
Subject: Re: [Question] multiple targets for implicit rule
Date: Tue, 19 Feb 2019 11:02:29 -0500

On Tuesday, February 19, 2019 10:51:42 AM EST Masahiro Yamada wrote:
> ------------(Makefile begin)---------
> .PHONY: all
> all: foo.x foo.z
> %.x %.z:
>         touch $@
> -------------(Makefile end)----------
> $ rm foo*
> $ make
> touch foo.x
> $ make
> touch foo.z
> $ make
> make: Nothing to be done for 'all'.
> When multiple targets appear in one implicit rule,
> Make runs the recipe just once instead of twice
> even when it is requested to create two targets.
> In this case, does Make assume the recipe
> will create both %.x and %.z ?
> Is this behavior intentional?
> Documented somewhere?

There are two cases, both documented in the GNU Make manual:

1. https://www.gnu.org/software/make/manual/html_node/Multiple-Targets.html
2. https://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html

Your example is covered by the first reference which describes multiple 
targets for a normal rule. If you want the recipe in a rule to create more 
than one target, you have to use a pattern rule as documented in the second 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]