From 973e60ef11e7ef9784cbf6d6754fa38e3d1e8ebc Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Tue, 19 Jan 2021 20:12:34 -0500 Subject: [PATCH] Fix Makefile assignment bug When a user provides variable=value as an argument to make, all assignments to that variable are ignored within the Makefile because the user has explicitly overrode variable to be "value". This made the ENABLE_ASAN assignment to be ignored, resulting in Toxic always enabling ASAN unless you run `make ENABLE_ASAN=disabled`, which is not documented and not how it's intended to work. This can be fixed by prefixing the assignment with "override", but to be in line with other argument assignments we just change the variable name. See more at: https://www.gnu.org/software/make/manual/html_node/Overriding.html --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6850f28..c956edc 100644 --- a/Makefile +++ b/Makefile @@ -28,8 +28,8 @@ else endif # Check if LLVM Address Sanitizer is enabled -ENABLE_ASAN := $(shell if [ -z "$(ENABLE_ASAN)" ] || [ "$(ENABLE_ASAN)" = "0" ] ; then echo disabled ; else echo enabled ; fi) -ifneq ($(ENABLE_ASAN), disabled) +ASAN := $(shell if [ -z "$(ENABLE_ASAN)" ] || [ "$(ENABLE_ASAN)" = "0" ] ; then echo disabled ; else echo enabled ; fi) +ifneq ($(ASAN), disabled) CFLAGS += -fsanitize=address -fno-omit-frame-pointer endif