From 19896c3515a55f1dbb233cd15fed82025a9664b2 Mon Sep 17 00:00:00 2001 From: Anjia Wang Date: Sat, 30 Mar 2024 12:10:44 -0700 Subject: [PATCH] Add an option to create DEBUG build --- CPP/7zip/7zip_gcc.mak | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/CPP/7zip/7zip_gcc.mak b/CPP/7zip/7zip_gcc.mak index 8bf0594..944821a 100644 --- a/CPP/7zip/7zip_gcc.mak +++ b/CPP/7zip/7zip_gcc.mak @@ -27,13 +27,22 @@ ifneq ($(CC), xlc) CFLAGS_WARN_WALL = -Werror -Wall -Wextra endif +ifdef DEBUG_BUILD +CFLAGS_DEBUG = -g +else +CFLAGS_DEBUG = -DNDEBUG +ifneq ($(CC), $(CROSS_COMPILE)clang) +LFLAGS_STRIP = -s +endif +endif + # for object file # -Wa,-aln=test.s # -save-temps CFLAGS_BASE_LIST = -c # CFLAGS_BASE_LIST = -S CFLAGS_BASE = -O2 $(CFLAGS_BASE_LIST) $(CFLAGS_WARN_WALL) $(CFLAGS_WARN) \ - -DNDEBUG -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \ + $(CFLAGS_DEBUG) -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \ -fPIC FLAGS_FLTO = -ffunction-sections @@ -207,10 +216,6 @@ $(O): # LDFLAGS3= -Wl,--gc-sections # -Wl,--print-gc-sections -ifneq ($(CC), $(CROSS_COMPILE)clang) -LFLAGS_STRIP = -s -endif - LFLAGS_ALL = $(LFLAGS_STRIP) $(MY_ARCH_2) $(LDFLAGS) $(FLAGS_FLTO) $(LD_arch) $(OBJS) $(MY_LIBS) $(LIB2) # -s : GCC : Remove all symbol table and relocation information from the executable.