diff options
Diffstat (limited to 'makefiles/Makefile.tools')
-rw-r--r-- | makefiles/Makefile.tools | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/makefiles/Makefile.tools b/makefiles/Makefile.tools index 86fac4c..33d6add 100644 --- a/makefiles/Makefile.tools +++ b/makefiles/Makefile.tools @@ -399,6 +399,25 @@ ifeq ($(toolchain),) $(error Unable to detect toolchain) endif +# Detect if the toolchain ought to support sanitizers +SANITIZE_OK=no +ifeq ($(toolchain),gcc) + GCC_VERSION := $(shell $(CC) -dumpversion) + GCC_MAJOR := $(word 1,$(subst ., ,$(GCC_VERSION))) + ifeq ($(shell expr $(GCC_MAJOR) \>= 6),1) + SANITIZE_OK=yes + endif +else ifeq ($(toolchain),clang) + SANITIZE_OK=yes +endif + +# And fail if we can't sanitize and yet the user asked for it +ifeq ($(MAKECMDGOALS),sanitize) + ifeq ($(SANITIZE_OK),no) + $(error Unable to build with sanitizers enabled, compiler not compatible + endif +endif + # TODO: It would be nice to avoid this hard-coded path include $(NSBUILD)/Makefile.$(toolchain) |