From a004ee8de72e622b5b6ef35f163d168e05810a65 Mon Sep 17 00:00:00 2001 From: Chris Kay Date: Fri, 14 Jun 2024 11:31:03 +0000 Subject: [PATCH] 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 --- tools/cert_create/Makefile | 10 ++++------ tools/cert_create/src/main.c | 8 +++----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/tools/cert_create/Makefile b/tools/cert_create/Makefile index 767093918..16f4aa3c9 100644 --- a/tools/cert_create/Makefile +++ b/tools/cert_create/Makefile @@ -18,6 +18,7 @@ include ${MAKE_HELPERS_DIRECTORY}build_env.mk include ${MAKE_HELPERS_DIRECTORY}common.mk include ${MAKE_HELPERS_DIRECTORY}defaults.mk include ${MAKE_HELPERS_DIRECTORY}toolchain.mk +include ${MAKE_HELPERS_DIRECTORY}utilities.mk ifneq (${PLAT},none) TF_PLATFORM_ROOT := ../../plat/ @@ -60,7 +61,7 @@ else HOSTCCFLAGS += -O2 -DLOG_LEVEL=20 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 # computed value. HOSTCCFLAGS += -DUSING_OPENSSL3=$(USING_OPENSSL3) @@ -84,10 +85,7 @@ all: --openssl ${BINARY} ${BINARY}: ${OBJECTS} Makefile $(s)echo " HOSTLD $@" - $(q)echo 'const char build_msg[] = "Built : "__TIME__", "__DATE__; \ - 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 $@ + $(q)$(host-cc) ${OBJECTS} ${LIB_DIR} ${LIB} -o $@ %.o: %.c $(s)echo " HOSTCC $<" @@ -99,7 +97,7 @@ ifeq ($(DEBUG),1) endif clean: - $(call SHELL_DELETE_ALL, src/build_msg.o ${OBJECTS}) + $(call SHELL_DELETE_ALL,${OBJECTS}) realclean: clean $(call SHELL_DELETE,${BINARY}) diff --git a/tools/cert_create/src/main.c b/tools/cert_create/src/main.c index 14610ed11..edc2d683b 100644 --- a/tools/cert_create/src/main.c +++ b/tools/cert_create/src/main.c @@ -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 */ @@ -66,10 +66,8 @@ static int new_keys; static int save_keys; static int print_cert; -/* Info messages created in the Makefile */ -extern const char build_msg[]; -extern const char platform_msg[]; - +static const char build_msg[] = "Built : " __TIME__ ", " __DATE__; +static const char platform_msg[] = PLAT_MSG; static char *strdup(const char *str) {