Move control of debug/release flags from makefile internal to user controlled
This commit is contained in:
parent
d45372cb23
commit
d4f7e5e601
@ -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
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#You should have received a copy of the GNU General Public License
|
||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#You should have received a copy of the GNU General Public License
|
||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#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
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#You should have received a copy of the GNU General Public License
|
||||
#along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user