build(fiptool): add object dependency generation

The object target in the fiptool Makefile only depends on the
corresponding source file so it won't rebuild the object, if a header
file used by the source file is changed.

To make it rebuild the object file for both source and header file
changes, a dependency file will now be generated for each object and
included in the Makefile.

Signed-off-by: Mikael Olsson <mikael.olsson@arm.com>
Change-Id: I0468c6e9c54126242150667268d471f28e011b0d
This commit is contained in:
Mikael Olsson 2022-12-08 17:07:06 +01:00 committed by Joanna Farley
parent 2a2e3e8770
commit 0165ddd7c0

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2014-2022, Arm Limited and Contributors. All rights reserved.
# Copyright (c) 2014-2023, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@ -61,6 +61,8 @@ ifneq (,$(wildcard ${PLAT_FIPTOOL_HELPER_MK}))
include ${PLAT_FIPTOOL_HELPER_MK}
endif
DEPS := $(patsubst %.o,%.d,$(OBJECTS))
.PHONY: all clean distclean --openssl
all: ${PROJECT}
@ -74,7 +76,9 @@ ${PROJECT}: --openssl ${OBJECTS} Makefile
%.o: %.c Makefile
@echo " HOSTCC $<"
${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} -MD -MP $< -o $@
-include $(DEPS)
--openssl:
ifeq ($(DEBUG),1)
@ -83,4 +87,4 @@ endif
clean:
$(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})
$(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS} $(DEPS))