Unify some common rules of programs/Makefile and tests/Makefile

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2023-12-22 11:49:35 +01:00
parent 076fd25480
commit 4392fc101f
3 changed files with 12 additions and 22 deletions

View file

@ -121,9 +121,6 @@ endif
fuzz: ${MBEDTLS_TEST_OBJS} fuzz: ${MBEDTLS_TEST_OBJS}
$(MAKE) -C fuzz THIRDPARTY_INCLUDES=$(THIRDPARTY_INCLUDES) $(MAKE) -C fuzz THIRDPARTY_INCLUDES=$(THIRDPARTY_INCLUDES)
$(MBEDLIBS):
$(MAKE) -C ../library
${MBEDTLS_TEST_OBJS}: ${MBEDTLS_TEST_OBJS}:
$(MAKE) -C ../tests mbedtls_test $(MAKE) -C ../tests mbedtls_test
@ -432,12 +429,5 @@ else
endif endif
$(MAKE) -C fuzz clean $(MAKE) -C fuzz clean
neat: clean
ifndef WINDOWS
rm -f $(GENERATED_FILES)
else
for %f in ($(subst /,\,$(GENERATED_FILES))) if exist %f del /Q /F %f
endif
list: list:
echo $(EXES) echo $(EXES)

View file

@ -62,3 +62,15 @@ gen_file_dep =
else else
gen_file_dep = | gen_file_dep = |
endif endif
default: all
$(MBEDLIBS):
$(MAKE) -C ../library
neat: clean
ifndef WINDOWS
rm -f $(GENERATED_FILES)
else
for %f in ($(subst /,\,$(GENERATED_FILES))) if exist %f del /Q /F %f
endif

View file

@ -3,8 +3,6 @@ include ../scripts/common.make
# Set this to -v to see the details of failing test cases # Set this to -v to see the details of failing test cases
TEST_FLAGS ?= $(if $(filter-out 0 OFF Off off NO No no FALSE False false N n,$(CTEST_OUTPUT_ON_FAILURE)),-v,) TEST_FLAGS ?= $(if $(filter-out 0 OFF Off off NO No no FALSE False false N n,$(CTEST_OUTPUT_ON_FAILURE)),-v,)
default: all
# Also include library headers, for the sake of invasive tests. # Also include library headers, for the sake of invasive tests.
LOCAL_CFLAGS += -I../library LOCAL_CFLAGS += -I../library
@ -111,9 +109,6 @@ BINARIES := $(addsuffix $(EXEXT),$(APPS))
all: $(BINARIES) all: $(BINARIES)
$(MBEDLIBS):
$(MAKE) -C ../library
MBEDTLS_TEST_PATH = . MBEDTLS_TEST_PATH = .
MBEDTLS_TEST_OBJS = $(patsubst %.c,%.o,$(wildcard ${MBEDTLS_TEST_PATH}/src/*.c ${MBEDTLS_TEST_PATH}/src/drivers/*.c)) MBEDTLS_TEST_OBJS = $(patsubst %.c,%.o,$(wildcard ${MBEDTLS_TEST_PATH}/src/*.c ${MBEDTLS_TEST_PATH}/src/drivers/*.c))
MBEDTLS_TEST_OBJS += $(patsubst %.c,%.o,$(wildcard ${MBEDTLS_TEST_PATH}/src/test_helpers/*.c)) MBEDTLS_TEST_OBJS += $(patsubst %.c,%.o,$(wildcard ${MBEDTLS_TEST_PATH}/src/test_helpers/*.c))
@ -193,13 +188,6 @@ else
if exist include/test/instrument_record_status.h del /Q /F include/test/instrument_record_status.h if exist include/test/instrument_record_status.h del /Q /F include/test/instrument_record_status.h
endif endif
neat: clean
ifndef WINDOWS
rm -f $(GENERATED_FILES)
else
for %f in ($(subst /,\,$(GENERATED_FILES))) if exist %f del /Q /F %f
endif
# Test suites caught by SKIP_TEST_SUITES are built but not executed. # Test suites caught by SKIP_TEST_SUITES are built but not executed.
check: $(BINARIES) check: $(BINARIES)
perl scripts/run-test-suites.pl $(TEST_FLAGS) --skip=$(SKIP_TEST_SUITES) perl scripts/run-test-suites.pl $(TEST_FLAGS) --skip=$(SKIP_TEST_SUITES)