Unify some common rules of programs/Makefile and tests/Makefile
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/programs/Makefile b/programs/Makefile
index 590b54e..64f7cc1 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -121,9 +121,6 @@
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 @@
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 12fd27f..1350b12 100644
--- a/scripts/common.make
+++ b/scripts/common.make
@@ -62,3 +62,15 @@
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 8e4149b..7a10af2 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -3,8 +3,6 @@
# 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 @@
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 @@
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)