[llvm-commits] CVS: llvm/Makefile.rules

Chris Lattner lattner at cs.uiuc.edu
Mon Mar 20 17:06:53 PST 2006



Changes in directory llvm:

Makefile.rules updated: 1.351 -> 1.352
---
Log message:

Enable assertions to be enabled in release builds by building with
make ENABLE_OPTIMIZED=1 ENABLE_ASSERTIONS=1


---
Diffs of the changes:  (+21 -11)

 Makefile.rules |   32 +++++++++++++++++++++-----------
 1 files changed, 21 insertions(+), 11 deletions(-)


Index: llvm/Makefile.rules
diff -u llvm/Makefile.rules:1.351 llvm/Makefile.rules:1.352
--- llvm/Makefile.rules:1.351	Fri Mar 10 15:01:34 2006
+++ llvm/Makefile.rules	Mon Mar 20 19:06:41 2006
@@ -198,12 +198,11 @@
 # 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 @@
     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)






More information about the llvm-commits mailing list