diff --git a/makefile.basic b/makefile.basic index 280cc1f..0704eaa 100644 --- a/makefile.basic +++ b/makefile.basic @@ -27,8 +27,10 @@ LIBDIRS::=lib INCLUDE_DIRS::=include CFLAGS::=-std=c18 -Wall -pedantic -Wextra CXXFLAGS::=-std=c++17 -Wall -pedantic -Wextra -DEBUG_CFLAGS::= -DEBUG_CXXFLAGS::= +DEBUG_CFLAGS::=$(CFLAGS) -O0 -g3 -ggdb +DEBUG_CXXFLAGS::=$(CXXFLAGS) -O0 -g3 -ggdb +RELEASE_CFLAGS::=$(CFLAGS) -O2 -Wno-strict-aliasing +RELEASE_CXXFLAGS::=$(CXXFLAGS) -O2 -Wno-strict-aliasing EXT::=cpp LANG::=$(EXT) MAIN_EXECUTABLE::=tester @@ -105,25 +107,22 @@ endif #setup compiler and flags based on language ifeq ($(LANG),cpp) - COMPILER_FLAGS::=$(CXXFLAGS) ifneq ($(RELEASE),1) - COMPILER_FLAGS+= $(DEBUG_CXXFLAGS) + COMPILER_FLAGS::=$(DEBUG_CXXFLAGS) + else + COMPILER_FLAGS::=$(RELEASE_CXXFLAGS) endif COMPILER::=$(CXX) else ifeq ($(LANG),c) - COMPILER_FLAGS::=$(CFLAGS) ifneq ($(RELEASE),1) - COMPILER_FLAGS+= $(DEBUG_CFLAGS) + COMPILER_FLAGS::=$(DEBUG_CFLAGS) + else + COMPILER_FLAGS::=$(RELEASE_CFLAGS) endif COMPILER::=$(CC) endif -ifeq ($(RELEASE),1) - #a lot of false strict aliasing warnings from gcc 9 - COMPILER_FLAGS+=-O2 -Wno-strict-aliasing -else - #default target - COMPILER_FLAGS+=-O0 -g3 -ggdb +ifneq ($(RELEASE),1) ifeq ($(MEMCHK),1) #use asan to check memory leaks/invalid accesses LDFLAGS+=-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls diff --git a/makefile.exe_progress b/makefile.exe_progress index 718258a..2ea163b 100644 --- a/makefile.exe_progress +++ b/makefile.exe_progress @@ -11,7 +11,7 @@ #You should have received a copy of the GNU General Public License #along with this program. If not, see . -#Copyright 2020 rexy712 +#Copyright 2020-2021 rexy712 #Makefile to generate a single executable from all sources in SOURCE_DIRS that end in EXT @@ -27,8 +27,10 @@ LIBDIRS::=lib INCLUDE_DIRS::=include CFLAGS::=-std=c18 -Wall -pedantic -Wextra CXXFLAGS::=-std=c++17 -Wall -pedantic -Wextra -DEBUG_CFLAGS::= -DEBUG_CXXFLAGS::= +DEBUG_CFLAGS::=$(CFLAGS) -O0 -g3 -ggdb +DEBUG_CXXFLAGS::=$(CXXFLAGS) -O0 -g3 -ggdb +RELEASE_CFLAGS::=$(CFLAGS) -O2 -Wno-strict-aliasing +RELEASE_CXXFLAGS::=$(CXXFLAGS) -O2 -Wno-strict-aliasing EXT::=cpp LANG::=$(EXT) MAIN_EXECUTABLE::=tester @@ -102,26 +104,22 @@ endif #setup compiler and flags based on language ifeq ($(LANG),cpp) - COMPILER_FLAGS::=$(CXXFLAGS) ifneq ($(RELEASE),1) - COMPILER_FLAGS+= $(DEBUG_CXXFLAGS) + COMPILER_FLAGS::=$(DEBUG_CXXFLAGS) + else + COMPILER_FLAGS::=$(RELEASE_CXXFLAGS) endif COMPILER::=$(CXX) else ifeq ($(LANG),c) - COMPILER_FLAGS::=$(CFLAGS) ifneq ($(RELEASE),1) - COMPILER_FLAGS+= $(DEBUG_CFLAGS) + COMPILER_FLAGS::=$(DEBUG_CFLAGS) + else + COMPILER_FLAGS::=$(RELEASE_CFLAGS) endif COMPILER::=$(CC) endif -ifeq ($(RELEASE),1) - #a lot of false strict aliasing warnings from gcc 9 - COMPILER_FLAGS+=-O2 -Wno-strict-aliasing - POST_TARGETS+= do_strip -else - #default target - COMPILER_FLAGS+=-O0 -g3 -ggdb +ifneq ($(RELEASE),1) ifeq ($(MEMCHK),1) #use asan to check memory leaks/invalid accesses LDFLAGS+=-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls diff --git a/makefile.library b/makefile.library index 7b428c5..cd668d3 100644 --- a/makefile.library +++ b/makefile.library @@ -27,8 +27,10 @@ LIBDIRS::=lib INCLUDE_DIRS::=include CFLAGS::=-std=c18 -Wall -pedantic -Wextra CXXFLAGS::=-std=c++17 -Wall -pedantic -Wextra -DEBUG_CFLAGS::= -DEBUG_CXXFLAGS::= +DEBUG_CFLAGS::=$(CFLAGS) -O0 -g3 -ggdb +DEBUG_CXXFLAGS::=$(CXXFLAGS) -O0 -g3 -ggdb +RELEASE_CFLAGS::=$(CFLAGS) -O2 -Wno-strict-aliasing +RELEASE_CXXFLAGS::=$(CXXFLAGS) -O2 -Wno-strict-aliasing EXT::=cpp LANG::=$(EXT) MAIN_LIBRARY::=tester @@ -118,25 +120,22 @@ endif #setup compiler and flags based on language ifeq ($(LANG),cpp) - COMPILER_FLAGS::=$(CXXFLAGS) ifneq ($(RELEASE),1) - COMPILER_FLAGS+=$(DEBUG_CXXFLAGS) + COMPILER_FLAGS::=$(DEBUG_CXXFLAGS) + else + COMPILER_FLAGS::=$(RELEASE_CXXFLAGS) endif COMPILER::=$(CXX) else ifeq ($(LANG),c) - COMPILER_FLAGS::=$(CFLAGS) ifneq ($(RELEASE),1) - COMPILER_FLAGS+=$(DEBUG_CFLAGS) + COMPILER_FLAGS::=$(DEBUG_CFLAGS) + else + COMPILER_FLAGS::=$(RELEASE_CFLAGS) endif COMPILER::=$(CC) endif -ifeq ($(RELEASE),1) - #a lot of false strict aliasing warnings from gcc 9 - COMPILER_FLAGS+=-O2 -Wno-strict-aliasing -else - #default target - COMPILER_FLAGS+=-O0 -g3 -ggdb +ifneq ($(RELEASE),1) ifeq ($(MEMCHK),1) #use asan to check memory leaks/invalid accesses LDFLAGS+=-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls diff --git a/makefile.reclib b/makefile.reclib index b32f897..87c432e 100644 --- a/makefile.reclib +++ b/makefile.reclib @@ -11,7 +11,7 @@ #You should have received a copy of the GNU General Public License #along with this program. If not, see . -#Copyright 2018-2020 rexy712 +#Copyright 2018-2021 rexy712 #Makefile to generate a single static or shared library from all the sources in SOURCE_DIRS ending in EXT @@ -27,8 +27,10 @@ LIBDIRS::=lib INCLUDE_DIRS::=include CFLAGS::=-std=c18 -Wall -pedantic -Wextra CXXFLAGS::=-std=c++17 -Wall -pedantic -Wextra -DEBUG_CFLAGS::= -DEBUG_CXXFLAGS::= +DEBUG_CFLAGS::=$(CFLAGS) -O0 -g3 -ggdb +DEBUG_CXXFLAGS::=$(CXXFLAGS) -O0 -g3 -ggdb +RELEASE_CFLAGS::=$(CFLAGS) -O2 -Wno-strict-aliasing +RELEASE_CXXFLAGS::=$(CXXFLAGS) -O2 -Wno-strict-aliasing EXT::=cpp LANG::=$(EXT) MAIN_LIBRARY::=tester @@ -110,27 +112,22 @@ endif #setup compiler and flags based on language ifeq ($(LANG),cpp) - COMPILER_FLAGS::=$(CXXFLAGS) ifneq ($(RELEASE),1) - COMPILER_FLAGS+=$(DEBUG_CXXFLAGS) + COMPILER_FLAGS::=$(DEBUG_CXXFLAGS) + else + COMPILER_FLAGS::=$(RELEASE_CXXFLAGS) endif COMPILER::=$(CXX) else ifeq ($(LANG),c) - COMPILER_FLAGS::=$(CFLAGS) ifneq ($(RELEASE),1) - COMPILER_FLAGS+=$(DEBUG_CFLAGS) + COMPILER_FLAGS::=$(DEBUG_CFLAGS) + else + COMPILER_FLAGS::=$(RELEASE_CFLAGS) endif COMPILER::=$(CC) endif -ifeq ($(RELEASE),1) - #a lot of false strict aliasing warnings from gcc 9 - COMPILER_FLAGS+=-O2 -Wno-strict-aliasing - POST_TARGETS+= do_strip -else - #default target - COMPILER_FLAGS+=-O0 -g3 -ggdb - ifeq ($(MEMCHK),1) +ifneq ($(RELEASE),1) #use asan to check memory leaks/invalid accesses LDFLAGS+=-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls COMPILER_FLAGS+=-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls diff --git a/makefile.recursive b/makefile.recursive index 59ebf79..303d703 100644 --- a/makefile.recursive +++ b/makefile.recursive @@ -11,7 +11,7 @@ #You should have received a copy of the GNU General Public License #along with this program. If not, see . -#Copyright 2018-2020 rexy712 +#Copyright 2018-2021 rexy712 #Makefile to generate a single executable from all sources in SOURCE_DIRS that end in EXT @@ -27,8 +27,10 @@ LIBDIRS::=lib INCLUDE_DIRS::=include CFLAGS::=-std=c18 -Wall -pedantic -Wextra CXXFLAGS::=-std=c++17 -Wall -pedantic -Wextra -DEBUG_CFLAGS::= -DEBUG_CXXFLAGS::= +DEBUG_CFLAGS::=$(CFLAGS) -O0 -g3 -ggdb +DEBUG_CXXFLAGS::=$(CXXFLAGS) -O0 -g3 -ggdb +RELEASE_CFLAGS::=$(CFLAGS) -O2 -Wno-strict-aliasing +RELEASE_CXXFLAGS::=$(CXXFLAGS) -O2 -Wno-strict-aliasing EXT::=cpp LANG::=$(EXT) MAIN_EXECUTABLE::=tester @@ -102,25 +104,22 @@ endif #setup compiler and flags based on language ifeq ($(LANG),cpp) - COMPILER_FLAGS::=$(CXXFLAGS) ifneq ($(RELEASE),1) - COMPILER_FLAGS+=$(DEBUG_CXXFLAGS) + COMPILER_FLAGS::=$(DEBUG_CXXFLAGS) + else + COMPILER_FLAGS::=$(RELEASE_CXXFLAGS) endif COMPILER::=$(CXX) else ifeq ($(LANG),c) - COMPILER_FLAGS::=$(CFLAGS) ifneq ($(RELEASE),1) - COMPILER_FLAGS+=$(DEBUG_CFLAGS) + COMPILER_FLAGS::=$(DEBUG_CFLAGS) + else + COMPILER_FLAGS::=$(RELEASE_CFLAGS) endif COMPILER::=$(CC) endif -ifeq ($(RELEASE),1) - #a lot of false strict aliasing warnings from gcc 9 - COMPILER_FLAGS+=-O2 -Wno-strict-aliasing -else - #default target - COMPILER_FLAGS+=-O0 -g3 -ggdb +ifneq ($(RELEASE),1) ifeq ($(MEMCHK),1) #use asan to check memory leaks/invalid accesses LDFLAGS+=-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls