aboutsummaryrefslogtreecommitdiffhomepage
path: root/makefile
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2015-10-21 10:35:31 -0400
committerRalph Amissah <ralph@amissah.com>2015-10-21 10:44:27 -0400
commitf20c8a6621e682c5700084c62f3a7a52e5e2b49f (patch)
tree62ee4a8d4e55a3d624cb21a813201c8677119bb8 /makefile
parent.d files made, emacs org babel tangle run on .org files (diff)
maker.org make setting debug flags more straightforward
Diffstat (limited to 'makefile')
-rw-r--r--makefile36
1 files changed, 22 insertions, 14 deletions
diff --git a/makefile b/makefile
index 250f1fb..d8bee00 100644
--- a/makefile
+++ b/makefile
@@ -1,35 +1,43 @@
-#DMD=dmd
DMD=dmd
DMD_FLAGS=-de -w
-DMD_FLAGS_DEBUG=-unittest -debug=checkdoc -debug=summary
DMD_FLAGS_RELEASE=-release
DMD_FLAG_BINOF=-of
-#LDC=ldc2
LDC=ldc2
LDC_FLAGS=-w
-LDC_FLAGS_DEBUG=-unittest -d-debug=checkdoc -d-debug=summary
LDC_FLAGS_RELEASE=-release
LDC_FLAG_BINOF=-of=
-#GDC=gdc
GDC=gdc
#GDC=gdc-5
GDC_FLAGS=
-GDC_FLAGS_DEBUG=-fdebug=checkdoc -fdebug=summary
GDC_FLAGS_RELEASE=-frelease
GDC_FLAG_BINOF=-o
-## D_COMPILER=DMD
-## D_COMPILER=LDC
-## D_COMPILER=GDC
+# set D_COMPILER one of DMD LDC or GDC:
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_DEBUG=$($(shell echo $(D_COMPILER)_FLAGS_DEBUG))
DC_FLAGS_RELEASE=$($(shell echo $(D_COMPILER)_FLAGS_RELEASE))
DC_FLAG_BINOF=$($(shell echo $(D_COMPILER)_FLAG_BINOF))
+ifeq ($(DC), $(DMD))
+ DC_FLAGS_DEBUG :=$(shell echo $(SET_DC_FLAGS_DEBUG))
+ DC_FLAGS_DEBUG_EXTRA :=$(shell echo $(SET_DC_FLAGS_DEBUG_EXTRA))
+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")
+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")
+endif
+
PRG_NAME=sdp
PRG_SRC=$(PRG_NAME).d
PRG_SRCDIR=./lib/$(PRG_NAME)
@@ -54,22 +62,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) $(DC_FLAGS) $(DC_FLAGS_DEBUG) $(DC_FLAGS_DEBUG_EXTRA) \
$(DC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \
$(PRG_SRCDIR)/$(PRG_SRC)
debug_dmd: $(PRG_SRCDIR)/$(PRG_SRC)
- $(DMD) $(DMD_FLAGS) $(DMD_FLAGS_DEBUG) \
+ $(DMD) $(DMD_FLAGS) $(DMD_FLAGS_DEBUG) $(DC_FLAGS_DEBUG_EXTRA) \
$(DMD_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \
$(PRG_SRCDIR)/$(PRG_SRC)
debug_ldc: $(PRG_SRCDIR)/$(PRG_SRC)
- $(LDC) $(LDC_FLAGS) $(LDC_FLAGS_DEBUG) \
+ $(LDC) $(LDC_FLAGS) $(LDC_FLAGS_DEBUG) $(DC_FLAGS_DEBUG_EXTRA) \
$(LDC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \
$(PRG_SRCDIR)/$(PRG_SRC)
debug_gdc: $(PRG_SRCDIR)/$(PRG_SRC)
- $(GDC) $(GDC_FLAGS) $(GDC_FLAGS_DEBUG) \
+ $(GDC) $(GDC_FLAGS) $(GDC_FLAGS_DEBUG) $(DC_FLAGS_DEBUG_EXTRA) \
$(GDC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \
$(PRG_SRCDIR)/$(PRG_SRC)