summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-08-03 14:20:45 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-08-03 14:20:45 -0700
commitc595d3043110cf1820d22e17454e4cf787562894 (patch)
tree0fb8d841906158b03191f30727d0c929e7263c15
parentcaac8c95a04f3cf83eb81510680833e2c6cf26d5 (diff)
downloadtxr-c595d3043110cf1820d22e17454e4cf787562894.tar.gz
txr-c595d3043110cf1820d22e17454e4cf787562894.tar.bz2
txr-c595d3043110cf1820d22e17454e4cf787562894.zip
Define TXR_DBG macro when compiling debug build.
* Makefile (dbg/%.o): Pass $(DBG_ONLY_FLAGS) to COMPILE_C_WITH_DEPS recipe macro. * configure (debug_only_flags): New macro. (gen_config_make): Generate DBG_ONLY_FLAGS. Add debug-only-flags to usage help text.
-rw-r--r--ChangeLog11
-rw-r--r--Makefile4
-rwxr-xr-xconfigure10
3 files changed, 22 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 00c9ba96..ba297dcd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2015-08-03 Kaz Kylheku <kaz@kylheku.com>
+
+ Define TXR_DBG macro when compiling debug build.
+
+ * Makefile (dbg/%.o): Pass $(DBG_ONLY_FLAGS) to COMPILE_C_WITH_DEPS
+ recipe macro.
+
+ * configure (debug_only_flags): New macro.
+ (gen_config_make): Generate DBG_ONLY_FLAGS.
+ Add debug-only-flags to usage help text.
+
2015-08-03 Christopher Meng <i@cicku.me>
Custom linker flags support.
diff --git a/Makefile b/Makefile
index e20fabd6..80c22556 100644
--- a/Makefile
+++ b/Makefile
@@ -117,14 +117,14 @@ endef
ifneq ($(top_srcdir),)
dbg/%.o: $(top_srcdir)%.c
- $(call COMPILE_C_WITH_DEPS,)
+ $(call COMPILE_C_WITH_DEPS,$(DBG_ONLY_FLAGS))
opt/%.o: $(top_srcdir)%.c
$(call COMPILE_C_WITH_DEPS,$(OPT_FLAGS))
endif
dbg/%.o: %.c
- $(call COMPILE_C_WITH_DEPS,)
+ $(call COMPILE_C_WITH_DEPS,$(DBG_ONLY_FLAGS))
opt/%.o: %.c
$(call COMPILE_C_WITH_DEPS,$(OPT_FLAGS))
diff --git a/configure b/configure
index 507feec3..ccd4b927 100755
--- a/configure
+++ b/configure
@@ -99,6 +99,7 @@ opt_flags=-O2
lang_flags='-ansi -D_XOPEN_SOURCE=600'
diag_flags='-Wall -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=strict-prototypes'
debug_flags=-g
+debug_only_flags=-DTXR_DEBUG
debug_also=
inline=
platform_cflags=
@@ -356,7 +357,13 @@ diag-flags [$diag_flags]
debug-flags [$debug_flags]
Specifies flags for requesting that debugging information be
- retained in the compile and link.
+ retained in the compile and link. These flags are applied
+ to optimized and debugging targets.
+
+debug-only-flags [$debug_only_flags]
+
+ Specifies compiler flags which only apply to debugging
+ targets.
debug-also [$debug_also]
@@ -661,6 +668,7 @@ OPT_FLAGS := $opt_flags
LANG_FLAGS := $lang_flags
DIAG_FLAGS := $diag_flags
DBG_FLAGS := $debug_flags
+DBG_ONLY_FLAGS := $debug_only_flags
BUILD_TARGETS := $(if [ $debug_also ] ; then
echo '$(PROG) $(PROG)-dbg'
else