From 0517b7d93b4d707fea1a2e154977ba813f38f1ad Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 7 Dec 2014 09:36:40 -0800 Subject: Debug builds optional with --debug-also config option. * Makefile (PROG): Variable removed, now set in config.make. (all): Target now depends on $(BUILD_TARGETS) variable, set in config.make. * configure (debug_also) New variable. (gen_config_make): Generate PROG and BUILD_TARGETS variables. --- ChangeLog | 11 +++++++++++ Makefile | 3 +-- configure | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f1f3b3a..ddaede40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2014-12-07 Kaz Kylheku + + Debug builds optional with --debug-also config option. + + * Makefile (PROG): Variable removed, now set in config.make. + (all): Target now depends on $(BUILD_TARGETS) variable, set + in config.make. + + * configure (debug_also) New variable. + (gen_config_make): Generate PROG and BUILD_TARGETS variables. + 2014-12-05 Kaz Kylheku * arith.c (tofloat, toint): Handle characters. diff --git a/Makefile b/Makefile index 12702c18..9b4dcf54 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,6 @@ OBJS += $(MPI_OBJS) DBG_OBJS = $(call ADD_CONF,dbg,$(OBJS) $(OBJS-y)) OPT_OBJS = $(call ADD_CONF,opt,$(OBJS) $(OBJS-y)) -PROG := txr TXR := ./$(PROG) .SUFFIXES: @@ -77,7 +76,7 @@ opt/%.o: %.c %.o: %.c $(CC) $(OPT_FLAGS) $(CFLAGS) -c -o $@ $< -all: $(PROG) $(PROG)-dbg +all: $(BUILD_TARGETS) $(PROG): $(OPT_OBJS) $(CC) $(OPT_FLAGS) $(CFLAGS) -o $@ $^ -lm diff --git a/configure b/configure index a11c9c63..9bef1060 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_also= inline= platform_flags= remove_flags= @@ -353,6 +354,13 @@ debug-flags [$debug_flags] Specifies flags for requesting that debugging information be retained in the compile and link. +debug-also [$debug_also] + + Specifies that a debugging version of TXR is to be built at the + same time. This means that "make" will always update two sets + of object files compiled with different optimization flags, + and produce two binaries: txr and txr-dbg. + platform-flags [$platform_flags] Specify additional compiler flags for anything else, such as CPU tuning, @@ -624,10 +632,16 @@ LEX := $lex YACC := $yacc NM := $nm +PROG := txr + OPT_FLAGS := $opt_flags LANG_FLAGS := $lang_flags DIAG_FLAGS := $diag_flags DBG_FLAGS := $debug_flags +BUILD_TARGETS := $(if [ $debug_also ] ; then + echo '$(PROG) $(PROG)-dbg' + else + echo '$(PROG)'; fi) PLATFORM_FLAGS := $platform_flags REMOVE_FLAGS := $remove_flags LEX_DBG_FLAGS := $lex_dbg_flags -- cgit v1.2.3