Don't make configuration-independent files depend on config.h

Don't regenerate configuration-independent files when config.h or
crypto_config.h changes. These files only depend on the set of symbols
present in the headers and not on which symbols are enabled. To avoid
rebuilding the generated files whenever the configuration changes,
don't declare the configuration as a dependency.

In the rare event that a maintainer makes an edit to *config.h that
affects the generated files, they'll have to remove the generated files.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine
2021-04-22 14:50:16 +02:00
parent c89c96061e
commit f2d8833c75
3 changed files with 19 additions and 4 deletions

View File

@@ -278,14 +278,19 @@ generated_files: $(GENERATED_FILES)
error.c: ../scripts/generate_errors.pl
error.c: ../scripts/data_files/error.fmt
error.c: $(wildcard ../include/mbedtls/*.h)
error.c: $(filter-out %config%,$(wildcard ../include/mbedtls/*.h))
error.c:
echo " Gen $@"
$(PERL) ../scripts/generate_errors.pl
version_features.c: ../scripts/generate_features.pl
version_features.c: ../scripts/data_files/version_features.fmt
version_features.c: ../include/mbedtls/config.h
## The generated file only depends on the options that are present in config.h,
## not on which options are set. To avoid regenerating this file all the time
## when switching between configurations, don't declare config.h as a
## dependency. Remove this file from your working tree if you've just added or
## removed an option in config.h.
#version_features.c: ../include/mbedtls/config.h
version_features.c:
echo " Gen $@"
$(PERL) ../scripts/generate_features.pl

View File

@@ -147,7 +147,12 @@ psa/psa_constant_names_generated.c:
$(PYTHON) ../scripts/generate_psa_constants.py
test/query_config.c: ../scripts/generate_query_config.pl
test/query_config.c: ../include/mbedtls/config.h
## The generated file only depends on the options that are present in config.h,
## not on which options are set. To avoid regenerating this file all the time
## when switching between configurations, don't declare config.h as a
## dependency. Remove this file from your working tree if you've just added or
## removed an option in config.h.
#test/query_config.c: ../include/mbedtls/config.h
test/query_config.c: ../scripts/data_files/query_config.fmt
test/query_config.c:
echo " Gen $@"

View File

@@ -64,7 +64,12 @@ GENERATED_FILES := $(GENERATED_DATA_FILES)
generated_files: $(GENERATED_FILES)
$(GENERATED_DATA_FILES): scripts/generate_psa_tests.py
$(GENERATED_DATA_FILES): ../include/psa/crypto_config.h
## The generated file only depends on the options that are present in
## crypto_config.h, not on which options are set. To avoid regenerating this
## file all the time when switching between configurations, don't declare
## crypto_config.h as a dependency. Remove this file from your working tree
## if you've just added or removed an option in crypto_config.h.
#$(GENERATED_DATA_FILES): ../include/psa/crypto_config.h
$(GENERATED_DATA_FILES): ../include/psa/crypto_values.h
$(GENERATED_DATA_FILES): ../include/psa/crypto_extra.h
$(GENERATED_DATA_FILES): suites/test_suite_psa_crypto_metadata.data