build(cert-create): don't generate build_msg.c

This change avoids generating a build message source file on the shell,
instead using the `__DATE__` and `__TIME__` macros directly.

Change-Id: Ieda75bbac174847c716701bce8dd10b8e9975902
Signed-off-by: Chris Kay <chris.kay@arm.com>
This commit is contained in:
Chris Kay 2024-06-14 11:31:03 +00:00
parent c4d9fbec5e
commit a004ee8de7
2 changed files with 7 additions and 11 deletions

View file

@ -18,6 +18,7 @@ include ${MAKE_HELPERS_DIRECTORY}build_env.mk
include ${MAKE_HELPERS_DIRECTORY}common.mk include ${MAKE_HELPERS_DIRECTORY}common.mk
include ${MAKE_HELPERS_DIRECTORY}defaults.mk include ${MAKE_HELPERS_DIRECTORY}defaults.mk
include ${MAKE_HELPERS_DIRECTORY}toolchain.mk include ${MAKE_HELPERS_DIRECTORY}toolchain.mk
include ${MAKE_HELPERS_DIRECTORY}utilities.mk
ifneq (${PLAT},none) ifneq (${PLAT},none)
TF_PLATFORM_ROOT := ../../plat/ TF_PLATFORM_ROOT := ../../plat/
@ -60,7 +61,7 @@ else
HOSTCCFLAGS += -O2 -DLOG_LEVEL=20 HOSTCCFLAGS += -O2 -DLOG_LEVEL=20
endif endif
HOSTCCFLAGS += ${DEFINES} HOSTCCFLAGS += ${DEFINES} -DPLAT_MSG=$(call escape-shell,"$(PLAT_MSG)")
# USING_OPENSSL3 flag will be added to the HOSTCCFLAGS variable with the proper # USING_OPENSSL3 flag will be added to the HOSTCCFLAGS variable with the proper
# computed value. # computed value.
HOSTCCFLAGS += -DUSING_OPENSSL3=$(USING_OPENSSL3) HOSTCCFLAGS += -DUSING_OPENSSL3=$(USING_OPENSSL3)
@ -84,10 +85,7 @@ all: --openssl ${BINARY}
${BINARY}: ${OBJECTS} Makefile ${BINARY}: ${OBJECTS} Makefile
$(s)echo " HOSTLD $@" $(s)echo " HOSTLD $@"
$(q)echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__; \ $(q)$(host-cc) ${OBJECTS} ${LIB_DIR} ${LIB} -o $@
const char platform_msg[] = "${PLAT_MSG}";' | \
$(host-cc) -c ${HOSTCCFLAGS} -xc - -o src/build_msg.o
$(q)$(host-cc) src/build_msg.o ${OBJECTS} ${LIB_DIR} ${LIB} -o $@
%.o: %.c %.o: %.c
$(s)echo " HOSTCC $<" $(s)echo " HOSTCC $<"
@ -99,7 +97,7 @@ ifeq ($(DEBUG),1)
endif endif
clean: clean:
$(call SHELL_DELETE_ALL, src/build_msg.o ${OBJECTS}) $(call SHELL_DELETE_ALL,${OBJECTS})
realclean: clean realclean: clean
$(call SHELL_DELETE,${BINARY}) $(call SHELL_DELETE,${BINARY})

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2015-2022, Arm Limited and Contributors. All rights reserved. * Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
@ -66,10 +66,8 @@ static int new_keys;
static int save_keys; static int save_keys;
static int print_cert; static int print_cert;
/* Info messages created in the Makefile */ static const char build_msg[] = "Built : " __TIME__ ", " __DATE__;
extern const char build_msg[]; static const char platform_msg[] = PLAT_MSG;
extern const char platform_msg[];
static char *strdup(const char *str) static char *strdup(const char *str)
{ {