GNU Make 4.3, released on January 19, 2020, lets build maintainers declare that one command sequence produces several files together. Explicit rules can use &: instead of : to group their outputs. If one generated file is missing, Make understands that running the recipe—the commands attached to the rule—also updates the other members. The syntax belongs on rules whose recipe really produces the whole set. [S1][S2]

A list of filenames before an ordinary colon means something different. The 4.3 manual says those targets are independent, equivalent to writing a separate rule for each with the same prerequisites and recipe. That is appropriate when the command builds one selected file at a time. It does not describe a generator that writes several outputs in one run. Maintainers need to inspect what the command creates before changing the separator; a shared dependency alone is not a reason to group outputs. [S2]

Consider a generator that writes both a source file and a header from one input. If its rule names both outputs with &: and the header is missing, Make treats the recipe as updating both files. The manual specifies that grouped outputs are handled together even when only some are missing or out of date. This is a scheduling relationship declared by the makefile, not a promise that the generator cannot fail halfway through writing its files. Checking that the command actually produces both outputs remains part of validating the build. [S2]

Check the automatic variable $@ before converting a rule. In a grouped recipe, it identifies the target that triggered the rule, not all the files in the group. Replacing : with &: will not fix a command that uses $@ to write just one output. In the source-and-header example, the recipe must still know how to produce both files whichever target triggers it. [S2]

Grouped rules must include a recipe, but their members can also appear in ordinary rules that add prerequisites without supplying another recipe. Adding a second recipe is different: the manual says a later recipe replaces the earlier one with a warning and removes the target from its previous group. For shared makefiles, that makes included rule definitions worth checking as well as the line being edited. Before adopting the syntax across build machines, maintainers can look for grouped-target in Make’s .FEATURES variable; the 4.3 release notes identify it as the feature-detection token. [S1][S2]

Source documents

  1. GNU Make 4.3 NEWS — release changes, 19 January 2020https://raw.githubusercontent.com/mirror/make/4.3/NEWS
  2. GNU Make 4.3 release archive: doc/make.texi, Multiple Targets in a Rulehttps://ftp.gnu.org/gnu/make/make-4.3.tar.gz