The #pragma multi directive lets you use one rule that creates multiple outputs simultaneously. You can use this directive when a pattern rule might not be suitable. This directive lets you create non-pattern rules that have multiple outputs. You can use this directive only with gmake and NMAKE emulation.
#pragma multi causes the targets of the immediately-following rule or dependency specification to be treated as updated together if they are updated. For example, the following produces one rule and one rule job, rather than three of each:
#pragma multi a b c: ; @echo building a b and c
The #pragma multi directive has the following restrictions:
-
If you apply
#pragma multito a target list, then you must apply it to all overlapping target lists. Those lists must specify the same set of targets (although they might do so in a different order). -
Target- and pattern-specific variable assignments for the targets of a
#pragma multirule must agree. Otherwise, eMake might choose the assignments for just one target or combine them all. -
You cannot apply
#pragma multito static patterns, double-colon rules, or pattern targets that follow non-pattern targets on the same line. -
If you apply
#pragma multito a non-static pattern, a warning appears. -
A
#pragma multirule with commands might not override (or be overridden by) other commands for the same targets. -
A
#pragma multidependency specification must correspond to a#pragma multirule with commands having the same set of targets. Otherwise, eMake will fail with errors. Implicit rules are not searched for these missing commands. -
$@has the same meaning as it does in multiple-target patterns: the target that first caused the rule to be needed. -
Setting the
--emake-disable-pragma=multior--emake-disable-pragma=alloptions disables#pragma multi.