From 76503edfebbc0618a992a70cf0162522f54a3280 Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 3 May 2025 17:20:42 +0200 Subject: [PATCH] add USELTO and USEASAN make flags to compile with LTO or Address sanitizer --- src/Makefile | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index 1119accfb..8e21d3410 100644 --- a/src/Makefile +++ b/src/Makefile @@ -452,10 +452,25 @@ else # build a normal optimised version WINDRESFLAGS = -DNDEBUG - CFLAGS+=-O3 -flto=auto - CPPFLAGS+=-O3 -flto=auto - #LDFLAGS+=-fsanitize=address + CFLAGS+=-O3 + CPPFLAGS+=-O3 endif + +ifndef DEBUGMODE +ifdef USELTO + # compile with LTO + CFLAGS+=-flto=auto + CPPFLAGS+=-flto=auto +endif +endif + +ifdef USEASAN + # compile with asan + CFLAGS+=-fsanitize=address + CPPFLAGS+=-fsanitize=address + LDFLAGS+=-fsanitize=address +endif + CFLAGS+=-g $(OPTS) $(ARCHOPTS) $(WINDRESFLAGS) ifdef PROFILEMODE