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.
This commit is contained in:
Gilles Peskine 2019-06-20 17:23:58 +02:00
parent 3cff768ad4
commit 1d10257d21

View file

@ -104,8 +104,11 @@ $(BINARIES): %$(EXEXT): %.c $(DEP)
echo " CC $<" echo " CC $<"
$(CC) $(LOCAL_CFLAGS) $(CFLAGS) $< $(LOCAL_LDFLAGS) $(LDFLAGS) -o $@ $(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 $(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 $(filter test_suite_psa_%, $(BINARIES)): psa_helpers.h
$(addprefix embedded_,$(filter test_suite_psa_%, $(APPS))): embedded_%: TESTS/mbedtls/%/psa_helpers.h
clean: clean:
ifndef WINDOWS ifndef WINDOWS
@ -143,3 +146,17 @@ $(EMBEDDED_TESTS): embedded_%: suites/$$(firstword $$(subst ., ,$$*)).function s
generate-target-tests: $(EMBEDDED_TESTS) 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)))))