mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2026-07-02 10:22:37 +00:00
This commit streamlines directory creation by introducing a single
pattern rule to automatically make directories for which there is a
dependency.
We currently use several macros to generate rules to create directories
upon dependence, which is a significant amount of code and a lot of
redundancy. The rule introduced by this change represents a catch-all:
any rule dependency on a path ending in a forward slash is automatically
created.
Now, rules can rely on an unordered dependency (`|`) on `$$(@D)/` which,
when secondary expansion is enabled, expands to the directory of the
target being built, e.g.:
build/main.o: main.c | $$(@D)/ # automatically creates `build/`
Change-Id: I7e554efa2ac850e779bb302fd9c7fbb239886c9f
Signed-off-by: Chris Kay <chris.kay@arm.com>
19 lines
444 B
Makefile
19 lines
444 B
Makefile
#
|
|
# Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
|
|
#
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
#
|
|
|
|
ifndef build-rules-mk
|
|
build-rules-mk := $(lastword $(MAKEFILE_LIST))
|
|
|
|
include $(dir $(build-rules-mk))common.mk
|
|
include $(dir $(build-rules-mk))utilities.mk
|
|
|
|
.SECONDEXPANSION:
|
|
|
|
%/:
|
|
$(s)echo ' MD '$(call escape-shell,$(abspath $@))
|
|
$(q)mkdir -p $(call escape-shell,$@)
|
|
endif
|