Enable assertions to be enabled in release builds by building with

make ENABLE_OPTIMIZED=1 ENABLE_ASSERTIONS=1

llvm-svn: 26914
This commit is contained in:
Chris Lattner 2006-03-21 01:06:41 +00:00
parent acb2506622
commit 79d9b6db8a

View File

@ -198,12 +198,11 @@ install-bytecode:: install-bytecode-local
# Variables derived from configuration we are building # Variables derived from configuration we are building
#-------------------------------------------------------------------- #--------------------------------------------------------------------
ifdef ENABLE_PROFILING ifdef ENABLE_PROFILING
BuildMode := Profile BuildMode := Profile
CXX.Flags := -O3 -DNDEBUG -felide-constructors -finline-functions -pg CXX.Flags := -O3 -felide-constructors -finline-functions -pg
C.Flags := -O3 -DNDEBUG -pg C.Flags := -O3 -pg
LD.Flags := -O3 -DNDEBUG -pg LD.Flags := -O3 -pg
else else
ifdef ENABLE_OPTIMIZED ifdef ENABLE_OPTIMIZED
BuildMode := Release BuildMode := Release
@ -211,19 +210,30 @@ else
ifneq ($(OS),FreeBSD) ifneq ($(OS),FreeBSD)
OmitFramePointer := -fomit-frame-pointer OmitFramePointer := -fomit-frame-pointer
endif endif
CXX.Flags := -O3 -DNDEBUG -finline-functions -felide-constructors \ CXX.Flags := -O3 -finline-functions -felide-constructors $(OmitFramePointer)
$(OmitFramePointer) C.Flags := -O3 $(OmitFramePointer)
C.Flags := -O3 -DNDEBUG $(OmitFramePointer) LD.Flags := -O3
LD.Flags := -O3 -DNDEBUG
else else
BuildMode := Debug BuildMode := Debug
CXX.Flags := -g -D_DEBUG CXX.Flags := -g
C.Flags := -g -D_DEBUG C.Flags := -g
LD.Flags := -g -D_DEBUG LD.Flags := -g
KEEP_SYMBOLS := 1 KEEP_SYMBOLS := 1
# Assertions default to ON for debug builds.
ENABLE_ASSERTIONS := 1
endif endif
endif endif
# If this is a debug build or if ENABLE_ASSERTIONS=1 is specified on the make
# command line, enable assertions.
ifdef ENABLE_ASSERTIONS
CXX.Flags += -D_DEBUG
C.Flags += -D_DEBUG
else
CXX.Flags += -DNDEBUG
C.Flags += -DNDEBUG
endif
CXX.Flags += $(CXXFLAGS) CXX.Flags += $(CXXFLAGS)
C.Flags += $(CFLAGS) C.Flags += $(CFLAGS)
CPP.Flags += $(CPPFLAGS) CPP.Flags += $(CPPFLAGS)