diff --git a/Makefile.in b/Makefile.in index 50f5d542d12..f82e1176d6c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 diff --git a/configure b/configure index ff6cb342da1..527c1b4ae8f 100755 --- 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" diff --git a/mk/platform.mk b/mk/platform.mk index e7b6cb57ef0..7d2039acdea 100644 --- a/mk/platform.mk +++ b/mk/platform.mk @@ -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