From 263375c3a4726f1b3d503a9d7d2be3fea9d38246 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 21 Oct 2015 11:57:39 -0400 Subject: maker.org make setting debug flags more straightforward --- makefile | 34 ++++++++++++++++++---------------- maker.org | 45 ++++++++++++++++++++++++--------------------- 2 files changed, 42 insertions(+), 37 deletions(-) diff --git a/makefile b/makefile index d8bee00..6f9b746 100644 --- a/makefile +++ b/makefile @@ -15,27 +15,29 @@ GDC_FLAGS_RELEASE=-frelease GDC_FLAG_BINOF=-o # set D_COMPILER one of DMD LDC or GDC: -D_COMPILER=LDC +SET_D_COMPILER=LDC -SET_DC_FLAGS_DEBUG=-unittest -debug=checkdoc -debug=summary SET_DC_FLAGS_DEBUG_EXTRA=-debug=headings -debug=bookindex -DC=$($(D_COMPILER)) -DC_FLAGS=$($(shell echo $(D_COMPILER)_FLAGS)) -DC_FLAGS_RELEASE=$($(shell echo $(D_COMPILER)_FLAGS_RELEASE)) -DC_FLAG_BINOF=$($(shell echo $(D_COMPILER)_FLAG_BINOF)) +DC=$($(SET_D_COMPILER)) +DC_FLAGS=$($(shell echo $(SET_D_COMPILER)_FLAGS)) +DC_FLAGS_RELEASE=$($(shell echo $(SET_D_COMPILER)_FLAGS_RELEASE)) +DC_FLAG_BINOF=$($(shell echo $(SET_D_COMPILER)_FLAG_BINOF)) +#DC_FLAGS=$($(shell echo $(DC)_FLAGS)) +#DC_FLAGS_RELEASE=$($(shell echo $(DC)_FLAGS_RELEASE)) +#DC_FLAG_BINOF=$($(shell echo $(DC)_FLAG_BINOF)) +DC_FLAGS_DEBUG_DEFAULT_SET=-unittest -debug=checkdoc -debug=summary +DC_FLAGS_DEBUG_SET=\ + $(shell echo $(DC_FLAGS_DEBUG_DEFAULT_SET) $(SET_DC_FLAGS_DEBUG_EXTRA)) ifeq ($(DC), $(DMD)) - DC_FLAGS_DEBUG :=$(shell echo $(SET_DC_FLAGS_DEBUG)) - DC_FLAGS_DEBUG_EXTRA :=$(shell echo $(SET_DC_FLAGS_DEBUG_EXTRA)) + DC_FLAGS_DEBUG :=$(shell echo $(DC_FLAGS_DEBUG_SET)) endif ifeq ($(DC) ,$(LDC)) - DC_FLAGS_DEBUG :=$(shell echo $(SET_DC_FLAGS_DEBUG)| sed -e "s/-debug=/-d-debug=/g") - DC_FLAGS_DEBUG_EXTRA :=$(shell echo $(SET_DC_FLAGS_DEBUG_EXTRA)| sed -e "s/-debug=/-d-debug=/g") + DC_FLAGS_DEBUG :=$(shell echo $(DC_FLAGS_DEBUG_SET)| sed -e "s/-debug=/-d-debug=/g") endif ifeq ($(DC), $(GDC)) - DC_FLAGS_DEBUG :=$(shell echo $(SET_DC_FLAGS_DEBUG)| sed -e "s/-debug/-fdebug/g") - DC_FLAGS_DEBUG_EXTRA :=$(shell echo $(SET_DC_FLAGS_DEBUG_EXTRA)| sed -e "s/-debug/-fdebug/g") + DC_FLAGS_DEBUG :=$(shell echo $(DC_FLAGS_DEBUG_SET)| sed -e "s/-debug/-fdebug/g") endif PRG_NAME=sdp @@ -62,22 +64,22 @@ build: $(PRG_SRCDIR)/$(PRG_SRC) rebuild: $(PRG_SRCDIR)/$(PRG_SRC) $(PRG_BINDIR)/$(PRG_BIN).o clean build debug: $(PRG_SRCDIR)/$(PRG_SRC) - $(DC) $(DC_FLAGS) $(DC_FLAGS_DEBUG) $(DC_FLAGS_DEBUG_EXTRA) \ + $(DC) $(DC_FLAGS) $(DC_FLAGS_DEBUG) \ $(DC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \ $(PRG_SRCDIR)/$(PRG_SRC) debug_dmd: $(PRG_SRCDIR)/$(PRG_SRC) - $(DMD) $(DMD_FLAGS) $(DMD_FLAGS_DEBUG) $(DC_FLAGS_DEBUG_EXTRA) \ + $(DMD) $(DMD_FLAGS) $(DMD_FLAGS_DEBUG) \ $(DMD_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \ $(PRG_SRCDIR)/$(PRG_SRC) debug_ldc: $(PRG_SRCDIR)/$(PRG_SRC) - $(LDC) $(LDC_FLAGS) $(LDC_FLAGS_DEBUG) $(DC_FLAGS_DEBUG_EXTRA) \ + $(LDC) $(LDC_FLAGS) $(LDC_FLAGS_DEBUG) \ $(LDC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \ $(PRG_SRCDIR)/$(PRG_SRC) debug_gdc: $(PRG_SRCDIR)/$(PRG_SRC) - $(GDC) $(GDC_FLAGS) $(GDC_FLAGS_DEBUG) $(DC_FLAGS_DEBUG_EXTRA) \ + $(GDC) $(GDC_FLAGS) $(GDC_FLAGS_DEBUG) \ $(GDC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \ $(PRG_SRCDIR)/$(PRG_SRC) diff --git a/maker.org b/maker.org index 2af2133..8adcdfc 100644 --- a/maker.org +++ b/maker.org @@ -12,7 +12,7 @@ #+TAGS: Amissah(A) Class(c) WEB(W) noexport(n) * makefile :makefile: -** settings +** settings [+2] *** alternative compilers [+1] **** dmd #+BEGIN_SRC makefile :tangle makefile @@ -40,43 +40,46 @@ GDC_FLAG_BINOF=-o #+end_src *** set/select: compiler settings [+1] -**** compiler is: +Set flags: +**** SET compiler is: Set D_COMPILER one of DMD LDC or GDC - D_COMPILER=DMD + SET_D_COMPILER=DMD #+BEGIN_SRC makefile :tangle makefile # set D_COMPILER one of DMD LDC or GDC: -D_COMPILER=LDC +SET_D_COMPILER=LDC #+end_src -**** debug flags are: +**** SET debug flags are: Set debug flags using DMD standard flag -debug= #+BEGIN_SRC makefile :tangle makefile -SET_DC_FLAGS_DEBUG=-unittest -debug=checkdoc -debug=summary SET_DC_FLAGS_DEBUG_EXTRA=-debug=headings -debug=bookindex #+end_src *** compiler settings [+1] **** compiler settings #+BEGIN_SRC makefile :tangle makefile -DC=$($(D_COMPILER)) -DC_FLAGS=$($(shell echo $(D_COMPILER)_FLAGS)) -DC_FLAGS_RELEASE=$($(shell echo $(D_COMPILER)_FLAGS_RELEASE)) -DC_FLAG_BINOF=$($(shell echo $(D_COMPILER)_FLAG_BINOF)) +DC=$($(SET_D_COMPILER)) +DC_FLAGS=$($(shell echo $(SET_D_COMPILER)_FLAGS)) +DC_FLAGS_RELEASE=$($(shell echo $(SET_D_COMPILER)_FLAGS_RELEASE)) +DC_FLAG_BINOF=$($(shell echo $(SET_D_COMPILER)_FLAG_BINOF)) +#DC_FLAGS=$($(shell echo $(DC)_FLAGS)) +#DC_FLAGS_RELEASE=$($(shell echo $(DC)_FLAGS_RELEASE)) +#DC_FLAG_BINOF=$($(shell echo $(DC)_FLAG_BINOF)) +DC_FLAGS_DEBUG_DEFAULT_SET=-unittest -debug=checkdoc -debug=summary +DC_FLAGS_DEBUG_SET=\ + $(shell echo $(DC_FLAGS_DEBUG_DEFAULT_SET) $(SET_DC_FLAGS_DEBUG_EXTRA)) #+end_src **** compiler conditional settings #+BEGIN_SRC makefile :tangle makefile ifeq ($(DC), $(DMD)) - DC_FLAGS_DEBUG :=$(shell echo $(SET_DC_FLAGS_DEBUG)) - DC_FLAGS_DEBUG_EXTRA :=$(shell echo $(SET_DC_FLAGS_DEBUG_EXTRA)) + DC_FLAGS_DEBUG :=$(shell echo $(DC_FLAGS_DEBUG_SET)) endif ifeq ($(DC) ,$(LDC)) - DC_FLAGS_DEBUG :=$(shell echo $(SET_DC_FLAGS_DEBUG)| sed -e "s/-debug=/-d-debug=/g") - DC_FLAGS_DEBUG_EXTRA :=$(shell echo $(SET_DC_FLAGS_DEBUG_EXTRA)| sed -e "s/-debug=/-d-debug=/g") + DC_FLAGS_DEBUG :=$(shell echo $(DC_FLAGS_DEBUG_SET)| sed -e "s/-debug=/-d-debug=/g") endif ifeq ($(DC), $(GDC)) - DC_FLAGS_DEBUG :=$(shell echo $(SET_DC_FLAGS_DEBUG)| sed -e "s/-debug/-fdebug/g") - DC_FLAGS_DEBUG_EXTRA :=$(shell echo $(SET_DC_FLAGS_DEBUG_EXTRA)| sed -e "s/-debug/-fdebug/g") + DC_FLAGS_DEBUG :=$(shell echo $(DC_FLAGS_DEBUG_SET)| sed -e "s/-debug/-fdebug/g") endif #+end_src @@ -100,7 +103,7 @@ ORGFILES="" ORGDIR=$(shell echo `pwd`) #+end_src -** make commands +** make commands [+2] *** build commands [+1] **** build rebuild #+BEGIN_SRC makefile :tangle makefile @@ -117,22 +120,22 @@ rebuild: $(PRG_SRCDIR)/$(PRG_SRC) $(PRG_BINDIR)/$(PRG_BIN).o clean build #+BEGIN_SRC makefile :tangle makefile debug: $(PRG_SRCDIR)/$(PRG_SRC) - $(DC) $(DC_FLAGS) $(DC_FLAGS_DEBUG) $(DC_FLAGS_DEBUG_EXTRA) \ + $(DC) $(DC_FLAGS) $(DC_FLAGS_DEBUG) \ $(DC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \ $(PRG_SRCDIR)/$(PRG_SRC) debug_dmd: $(PRG_SRCDIR)/$(PRG_SRC) - $(DMD) $(DMD_FLAGS) $(DMD_FLAGS_DEBUG) $(DC_FLAGS_DEBUG_EXTRA) \ + $(DMD) $(DMD_FLAGS) $(DMD_FLAGS_DEBUG) \ $(DMD_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \ $(PRG_SRCDIR)/$(PRG_SRC) debug_ldc: $(PRG_SRCDIR)/$(PRG_SRC) - $(LDC) $(LDC_FLAGS) $(LDC_FLAGS_DEBUG) $(DC_FLAGS_DEBUG_EXTRA) \ + $(LDC) $(LDC_FLAGS) $(LDC_FLAGS_DEBUG) \ $(LDC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \ $(PRG_SRCDIR)/$(PRG_SRC) debug_gdc: $(PRG_SRCDIR)/$(PRG_SRC) - $(GDC) $(GDC_FLAGS) $(GDC_FLAGS_DEBUG) $(DC_FLAGS_DEBUG_EXTRA) \ + $(GDC) $(GDC_FLAGS) $(GDC_FLAGS_DEBUG) \ $(GDC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \ $(PRG_SRCDIR)/$(PRG_SRC) #+end_src -- cgit v1.2.3