From c6d1d0886a2dbbc28f78e7d4bf8b349c3ed9cf1b Mon Sep 17 00:00:00 2001 From: Marek Marecki Date: Mon, 18 Dec 2023 00:22:52 +0100 Subject: [PATCH] Improve build and test scripts A better "clean" production (that also picks up the cache emitted by the test suite now). Different build presets for testing ("test") and debugging ("debug"), with the difference between them being that the "debug" preset does not include sanitisers as they do not play nice with GDB. --- new/Makefile | 3 +++ new/Makefile.d/Preset/debug | 7 ++----- new/Makefile.d/Preset/test | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 new/Makefile.d/Preset/test diff --git a/new/Makefile b/new/Makefile index 7cc40e68c..fad24fffa 100644 --- a/new/Makefile +++ b/new/Makefile @@ -110,6 +110,9 @@ clean-test: find ./tests -type f -name '*.o' -delete find ./tests -type f -name '*.asm~' -delete find ./tests -type f -name '*.log' -delete + find ./tests -type d -name '.cache' -print0 |\ + xargs --null -I CACHE_DIR find CACHE_DIR -type f -delete + find ./tests -type d -name '.cache' -delete clean: clean-test clean-bin diff --git a/new/Makefile.d/Preset/debug b/new/Makefile.d/Preset/debug index 404cce669..07414c6cc 100644 --- a/new/Makefile.d/Preset/debug +++ b/new/Makefile.d/Preset/debug @@ -4,11 +4,8 @@ CXXFLAGS_OPTIMISATION?=-Og CXXFLAGS_DEBUG?=-ggdb # Default sanitiser is for GCC. -# Remember to build without sanitisers if you want to use Valgrind. -CXXFLAGS_SANITISER?=\ - -fsanitize=leak \ - -fsanitize=address \ - -fsanitize=undefined +# Remember to build without sanitisers if you want to use Valgrind or GDB. +CXXFLAGS_SANITISER?= CXXFLAGS_OPTION?=\ -fstack-protector-all \ diff --git a/new/Makefile.d/Preset/test b/new/Makefile.d/Preset/test new file mode 100644 index 000000000..404cce669 --- /dev/null +++ b/new/Makefile.d/Preset/test @@ -0,0 +1,16 @@ +# vim:ft=make: + +CXXFLAGS_OPTIMISATION?=-Og +CXXFLAGS_DEBUG?=-ggdb + +# Default sanitiser is for GCC. +# Remember to build without sanitisers if you want to use Valgrind. +CXXFLAGS_SANITISER?=\ + -fsanitize=leak \ + -fsanitize=address \ + -fsanitize=undefined + +CXXFLAGS_OPTION?=\ + -fstack-protector-all \ + -fstrict-aliasing \ + -fstrict-overflow -- 2.45.2