]> git.lizzy.rs Git - rust.git/commitdiff
build: Add --enable-debug configure option
authorBrian Anderson <banderson@mozilla.com>
Fri, 30 Mar 2012 02:10:38 +0000 (19:10 -0700)
committerBrian Anderson <banderson@mozilla.com>
Fri, 30 Mar 2012 02:10:38 +0000 (19:10 -0700)
When CFG_ENABLE_DEBUG is defined it will call rustc with -g --cfg=debug
and cc with -DRUST_DEBUG. Otherwise it calls rustc with --cfg=ndebug and cc
with -DRUST_NDEBUG.

I plan to use this for a few things in the runtime.

Makefile.in
configure
mk/platform.mk

index 50f5d542d126e0f4f9ddd0a424d6ad5afd9db8e4..f82e1176d6c96b5414915c184de07b1f389f0b10 100644 (file)
@@ -68,11 +68,24 @@ ifneq ($(wildcard $(NON_HOST_TRIPLES)),)
 CFG_INFO := $(info cfg: non host triples $(NON_HOST_TRIPLES))
 endif
 
+CFG_RUSTC_FLAGS :=
+CFG_GCCISH_CFLAGS :=
+CFG_GCCISH_LINK_FLAGS :=
+
 ifdef CFG_DISABLE_OPTIMIZE
   $(info cfg: disabling rustc optimization (CFG_DISABLE_OPTIMIZE))
-  CFG_RUSTC_FLAGS :=
+  CFG_RUSTC_FLAGS +=
 else
-  CFG_RUSTC_FLAGS := -O
+  CFG_RUSTC_FLAGS += -O
+endif
+
+ifdef CFG_ENABLE_DEBUG
+  $(info cfg: enabling more debugging (CFG_ENABLE_DEBUG))
+  CFG_RUSTC_FLAGS += -g --cfg=debug
+  CFG_GCCISH_CFLAGS += -DRUST_DEBUG
+else
+  CFG_RUSTC_FLAGS += --cfg=ndebug
+  CFG_GCCISH_CFLAGS += -DRUST_NDEBUG
 endif
 
 ifdef SAVE_TEMPS
@@ -87,9 +100,6 @@ endif
 ifdef TIME_LLVM_PASSES
   CFG_RUSTC_FLAGS += --time-llvm-passes
 endif
-ifdef DEBUG
-  CFG_RUSTC_FLAGS += -g
-endif
 
 # platform-specific auto-configuration
 include $(CFG_SRC_DIR)mk/platform.mk
index ff6cb342da181e4bcfc08c8797e47461a9dbb04b..527c1b4ae8f48ceb4aa9a95fb808ae5f128b9093 100755 (executable)
--- a/configure
+++ b/configure
@@ -280,6 +280,7 @@ opt docs     1 "build documentation"
 opt optimize 1 "build optimized rust code"
 opt optimize-cxx 1 "build optimized C++ code"
 opt optimize-llvm 1 "build optimized LLVM"
+opt debug 0 "build with extra debug fun"
 opt fast-make 0 "use .gitmodules as timestamp for submodule deps"
 opt manage-submodules 1 "let the build manage the git submodules"
 opt mingw-cross 0 "cross-compile for win32 using mingw"
index e7b6cb57ef0816c60e74a227c4f5c4354153569c..7d2039acdead57dbaac7a268b5dad8252dd9976a 100644 (file)
@@ -9,8 +9,7 @@ endef
 $(foreach t,$(CFG_TARGET_TRIPLES),$(eval $(call DEF_HOST_VAR,$(t))))
 $(foreach t,$(CFG_TARGET_TRIPLES),$(info cfg: host for $(t) is $(HOST_$(t))))
 
-CFG_GCCISH_FLAGS := -fno-strict-aliasing
-CFG_GCCISH_LINK_FLAGS :=
+CFG_GCCISH_FLAGS += -fno-strict-aliasing
 
 # On Darwin, we need to run dsymutil so the debugging information ends
 # up in the right place.  On other platforms, it automatically gets