Files
arm-trusted-firmware/tools/sptool/Makefile
T
Chris Kay a4ac07c7a5 refactor(build): avoid implicit pattern rules
This change translates any implicit pattern rules into the equivalent
static pattern rules, i.e. rules like:

    %.o: %.s
        ...

... become:

    $(OBJS): %.o: %.s
        ...

These behave similarly, but have some subtle differences. The former
defines a rule "for any target matching %.o where there is not a more
specific rule", whereas the latter defines a rule "for these targets,
which match %.o".

Where possible it is better to use a static pattern rule as it reduces
the rule space that Make needs to search.

Change-Id: Ifba4f44bcecf4e74980c31347e192cdf1e42003e
Signed-off-by: Chris Kay <chris.kay@arm.com>
2025-10-04 01:27:18 +00:00

43 lines
972 B
Makefile

#
# Copyright (c) 2018-2025, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
MAKE_HELPERS_DIRECTORY := ../../make_helpers/
include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
include ${MAKE_HELPERS_DIRECTORY}common.mk
include ${MAKE_HELPERS_DIRECTORY}toolchain.mk
SPTOOL ?= sptool$(.exe)
PROJECT := $(notdir ${SPTOOL})
OBJECTS := sptool.o
override CPPFLAGS += -D_GNU_SOURCE -D_XOPEN_SOURCE=700
HOSTCCFLAGS := -Wall -Werror -pedantic -std=c99
ifeq (${DEBUG},1)
HOSTCCFLAGS += -g -O0 -DDEBUG
else
HOSTCCFLAGS += -O2
endif
INCLUDE_PATHS := -I../../include/tools_share
.PHONY: all clean distclean
all: ${PROJECT}
${PROJECT}: ${OBJECTS} Makefile
$(s)echo " HOSTLD $@"
$(q)$(host-cc) ${OBJECTS} -o $@ ${LDLIBS}
$(s)echo
$(s)echo "Built $@ successfully"
$(s)echo
$(OBJECTS): %.o: %.c Makefile
$(s)echo " HOSTCC $<"
$(q)$(host-cc) -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
clean:
$(q)rm -rf $(PROJECT) $(OBJECTS)