mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 17:44:19 +00:00
build: fix grouped targets on Make <= 4.2
Grouped targets are a feature introduced with GNU Make 4.3 which enable rules with multiple targets to communicate that all of the targets of that rule are built simultaneously, rather than independently. For example, without grouped targets the following rule may be executed twice: a.txt b.txt: touch a.txt b.txt # $ remake -j2 a.txt b.txt # touch a.txt b.txt # touch a.txt b.txt In this example, both `a.txt` and `b.txt` are touched twice, when the rule should only be executed once. Instead, this rule can use a grouped target: a.txt b.txt &: touch a.txt b.txt # $ remake -j2 a.txt b.txt # touch a.txt b.txt # remake: 'b.txt' is up to date. In this case, both `a.txt` and `b.txt` are created once only, as Make now knows that the recipe will create both files. Note that pattern rules with multiple targets always behave this way. Previously, we assumed that the grouped target feature was available, but on systems still packaging Make 4.2, most prominently Ubuntu 20.04, this is not the case. This change adds a check to ensure that we do not use grouped targets if they are unavailable. Change-Id: Ifd9da35421ae11468d7a25d3cbc76f6036921749 Signed-off-by: Chris Kay <chris.kay@arm.com>
This commit is contained in:
parent
98e7a83e09
commit
a57b94ec7c
2 changed files with 8 additions and 1 deletions
|
@ -73,7 +73,7 @@ $(BUILD_DIR)/jmptbl.i: ../../$(PLAT_DIR)/jmptbl.i | $$(@D)/
|
|||
$(s)echo " PRE $@"
|
||||
$(q)$(ROMLIB_GEN) pre --output $@ --deps $(BUILD_DIR)/jmptbl.d $<
|
||||
|
||||
$(WRAPPER_SOURCES) &: $(BUILD_DIR)/jmptbl.i | $$(@D)/
|
||||
$(WRAPPER_SOURCES) $&: $(BUILD_DIR)/jmptbl.i | $$(@D)/
|
||||
$(s)echo " WRP $<"
|
||||
$(q)$(ROMLIB_GEN) genwrappers --bti=$(ENABLE_BTI) -b $(WRAPPER_DIR) $<
|
||||
|
||||
|
|
|
@ -21,6 +21,13 @@ directory-name = $(call decompat-path,$(dir $(call compat-path,$(1))))
|
|||
|
||||
escape-shell = '$(subst ','\'',$(1))'
|
||||
|
||||
#
|
||||
# The grouped-target symbol. Grouped targets are not supported on versions of
|
||||
# GNU Make <= 4.2, which was most recently packaged with Ubuntu 20.04.
|
||||
#
|
||||
|
||||
& := $(if $(filter grouped-target,$(.FEATURES)),&)
|
||||
|
||||
#
|
||||
# Upper-case a string value.
|
||||
#
|
||||
|
|
Loading…
Add table
Reference in a new issue