summaryrefslogtreecommitdiff
path: root/Makefile.rules
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-03-21 01:06:41 +0000
committerChris Lattner <sabre@nondot.org>2006-03-21 01:06:41 +0000
commit7192786afcf624af592df32df02eca56ab1aa35d (patch)
treedb2432a460a4b50c972b1de9b90c8fcb7e2346d4 /Makefile.rules
parent8593f9891da4782719e49ef1fb2554072ed1e52d (diff)
downloadllvm-7192786afcf624af592df32df02eca56ab1aa35d.tar.gz
llvm-7192786afcf624af592df32df02eca56ab1aa35d.tar.bz2
llvm-7192786afcf624af592df32df02eca56ab1aa35d.tar.xz
Enable assertions to be enabled in release builds by building with
make ENABLE_OPTIMIZED=1 ENABLE_ASSERTIONS=1 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26914 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Makefile.rules')
-rw-r--r--Makefile.rules32
1 files changed, 21 insertions, 11 deletions
diff --git a/Makefile.rules b/Makefile.rules
index 0bdb3deeed..6692c73fd8 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -198,12 +198,11 @@ install-bytecode:: install-bytecode-local
# Variables derived from configuration we are building
#--------------------------------------------------------------------
-
ifdef ENABLE_PROFILING
BuildMode := Profile
- CXX.Flags := -O3 -DNDEBUG -felide-constructors -finline-functions -pg
- C.Flags := -O3 -DNDEBUG -pg
- LD.Flags := -O3 -DNDEBUG -pg
+ CXX.Flags := -O3 -felide-constructors -finline-functions -pg
+ C.Flags := -O3 -pg
+ LD.Flags := -O3 -pg
else
ifdef ENABLE_OPTIMIZED
BuildMode := Release
@@ -211,19 +210,30 @@ else
ifneq ($(OS),FreeBSD)
OmitFramePointer := -fomit-frame-pointer
endif
- CXX.Flags := -O3 -DNDEBUG -finline-functions -felide-constructors \
- $(OmitFramePointer)
- C.Flags := -O3 -DNDEBUG $(OmitFramePointer)
- LD.Flags := -O3 -DNDEBUG
+ CXX.Flags := -O3 -finline-functions -felide-constructors $(OmitFramePointer)
+ C.Flags := -O3 $(OmitFramePointer)
+ LD.Flags := -O3
else
BuildMode := Debug
- CXX.Flags := -g -D_DEBUG
- C.Flags := -g -D_DEBUG
- LD.Flags := -g -D_DEBUG
+ CXX.Flags := -g
+ C.Flags := -g
+ LD.Flags := -g
KEEP_SYMBOLS := 1
+ # Assertions default to ON for debug builds.
+ ENABLE_ASSERTIONS := 1
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)
C.Flags += $(CFLAGS)
CPP.Flags += $(CPPFLAGS)