From 1d10257d215fc2ea366e7b6f15b532e2f40504b9 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Thu, 20 Jun 2019 17:23:58 +0200 Subject: [PATCH] Copy the new header files to Mbed OS on-target test directories The new PSA helper headers are needed at build time. When building Mbed OS tests, the source files are copied to a directory under TESTS. The required header files need to be present in this directory. --- tests/Makefile | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/Makefile b/tests/Makefile index 52f916356..94f0bc40e 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -104,8 +104,11 @@ $(BINARIES): %$(EXEXT): %.c $(DEP) echo " CC $<" $(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ +# Some test suites require additional header files. $(filter test_suite_psa_crypto%, $(BINARIES)): psa_crypto_helpers.h +$(addprefix embedded_,$(filter test_suite_psa_crypto%, $(APPS))): embedded_%: TESTS/mbedtls/%/psa_crypto_helpers.h $(filter test_suite_psa_%, $(BINARIES)): psa_helpers.h +$(addprefix embedded_,$(filter test_suite_psa_%, $(APPS))): embedded_%: TESTS/mbedtls/%/psa_helpers.h clean: ifndef WINDOWS @@ -143,3 +146,17 @@ $(EMBEDDED_TESTS): embedded_%: suites/$$(firstword $$(subst ., ,$$*)).function s generate-target-tests: $(EMBEDDED_TESTS) +define copy_header_to_target +TESTS/mbedtls/$(1)/$(2): $(2) + echo " Copy ./$$@" +ifndef WINDOWS + mkdir -p $$(@D) + cp $$< $$@ +else + mkdir $$(@D) + copy $$< $$@ +endif + +endef +$(foreach app, $(APPS), $(foreach file, $(wildcard *.h), \ + $(eval $(call copy_header_to_target,$(app),$(file)))))