From 4392fc101ff3f5ef8d273359f73ad9a83f9923ed Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Fri, 22 Dec 2023 11:49:35 +0100 Subject: [PATCH] Unify some common rules of programs/Makefile and tests/Makefile Signed-off-by: Gilles Peskine --- programs/Makefile | 10 ---------- scripts/common.make | 12 ++++++++++++ tests/Makefile | 12 ------------ 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/programs/Makefile b/programs/Makefile index 590b54eba..64f7cc1a3 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -121,9 +121,6 @@ endif fuzz: ${MBEDTLS_TEST_OBJS} $(MAKE) -C fuzz THIRDPARTY_INCLUDES=$(THIRDPARTY_INCLUDES) -$(MBEDLIBS): - $(MAKE) -C ../library - ${MBEDTLS_TEST_OBJS}: $(MAKE) -C ../tests mbedtls_test @@ -432,12 +429,5 @@ else endif $(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: echo $(EXES) diff --git a/scripts/common.make b/scripts/common.make index 12fd27fb4..1350b12e3 100644 --- a/scripts/common.make +++ b/scripts/common.make @@ -62,3 +62,15 @@ gen_file_dep = else gen_file_dep = | 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 diff --git a/tests/Makefile b/tests/Makefile index 8e4149b94..7a10af271 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -3,8 +3,6 @@ include ../scripts/common.make # 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,) -default: all - # Also include library headers, for the sake of invasive tests. LOCAL_CFLAGS += -I../library @@ -111,9 +109,6 @@ BINARIES := $(addsuffix $(EXEXT),$(APPS)) all: $(BINARIES) -$(MBEDLIBS): - $(MAKE) -C ../library - 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/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 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. check: $(BINARIES) perl scripts/run-test-suites.pl $(TEST_FLAGS) --skip=$(SKIP_TEST_SUITES)