From 94230eaf4153dfac761d2dcabe81ab80017e2ab1 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 18 May 2021 15:48:56 +0200 Subject: [PATCH] Fix `make generated_files` generating broken visualc files Ensure that the .c files that generate_visualc_files.pl enumerates are present before it runs. Otherwise, depending on the order in which make builds targets, running `make generated_files` from a fresh checkout could end up missing `library/error.c` and `library/version_features.c`. Signed-off-by: Gilles Peskine --- Makefile | 6 ++++++ tests/scripts/check-generated-files.sh | 3 +++ 2 files changed, 9 insertions(+) diff --git a/Makefile b/Makefile index a0c4386764..786ad86faf 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,12 @@ generated_files: visualc_files VISUALC_FILES = visualc/VS2010/mbedTLS.sln visualc/VS2010/mbedTLS.vcxproj # TODO: $(app).vcxproj for each $(app) in programs/ visualc_files: $(VISUALC_FILES) + +# Ensure that the .c files that generate_visualc_files.pl enumerates are +# present before it runs. List the files explicitly, not via the +# library/generated_files indirection, because otherwise running +# make visualc_files would always consider the visualc files out of date. +$(VISUALC_FILES): library/error.c library/version_features.c $(VISUALC_FILES): scripts/generate_visualc_files.pl $(VISUALC_FILES): scripts/data_files/vs2010-app-template.vcxproj $(VISUALC_FILES): scripts/data_files/vs2010-main-template.vcxproj diff --git a/tests/scripts/check-generated-files.sh b/tests/scripts/check-generated-files.sh index 07974a23e2..b480837866 100755 --- a/tests/scripts/check-generated-files.sh +++ b/tests/scripts/check-generated-files.sh @@ -109,6 +109,9 @@ check() check scripts/generate_errors.pl library/error.c check scripts/generate_query_config.pl programs/test/query_config.c check scripts/generate_features.pl library/version_features.c +# generate_visualc_files enumerates source files (library/*.c). It doesn't +# care about their content, but the files must exist. So it must run after +# the step that creates or updates these files. check scripts/generate_visualc_files.pl visualc/VS2010 check scripts/generate_psa_constants.py programs/psa/psa_constant_names_generated.c check tests/scripts/generate_psa_tests.py $(tests/scripts/generate_psa_tests.py --list)