aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2015-10-04 19:08:36 -0400
committerRalph Amissah <ralph@amissah.com>2015-10-06 10:35:59 -0400
commit1a2600200a7d346dcc3419432bf63b6b4080ff24 (patch)
treeb8d8d8a106b2662e0d6e0227f14841ead24b465d
parentoutput debugs, typo fix (diff)
keep a makefile during development
-rw-r--r--.gitignore1
-rw-r--r--makefile58
2 files changed, 59 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index ead1bf3..54ad65a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
# git ls-files --others --exclude-from=.git/info/exclude
*
!.gitignore
+!makefile
!*.d
!*.rl
!*.org
diff --git a/makefile b/makefile
new file mode 100644
index 0000000..54a1a73
--- /dev/null
+++ b/makefile
@@ -0,0 +1,58 @@
+# dmd
+DMD=dmd
+DMD_FLAGS=-de -w
+DMD_FLAGS_DEBUG=-unittest -debug=checkdoc -debug=summary
+DMD_FLAGS_RELEASE=-release
+DMD_FLAG_BINOF=-of=
+# 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_FLAGS=
+GDC_FLAGS_DEBUG=-d-debug=checkdoc -d-debug=summary
+GDC_FLAGS_RELEASE=-release
+GDC_FLAG_BINOF=-o
+# D compiler
+D_COMPILER=LDC
+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))
+PRG_NAME=sdp
+PRG_SRC=$(PRG_NAME).d
+PRG_SRCDIR=./lib/$(PRG_NAME)
+PRG_BIN=$(PRG_NAME)
+PRG_BINDIR=bin
+
+all: build
+
+build: $(PRG_SRCDIR)/$(PRG_SRC)
+ $(DC) $(DC_FLAGS) \
+ $(DC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \
+ $(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_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \
+ $(PRG_SRCDIR)/$(PRG_SRC)
+
+release: $(PRG_SRCDIR)/$(PRG_SRC)
+ $(DC) $(DC_FLAGS) $(DC_FLAGS_RELEASE) \
+ $(DC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \
+ $(PRG_SRCDIR)/$(PRG_SRC)
+
+clean: $(PRG_BINDIR)/$(PRG_BIN).o
+ rm $(PRG_BINDIR)/$(PRG_NAME).o
+
+distclean: $(PRG_BINDIR)
+ rm -rf $(PRG_BINDIR)
+
+.PHONY : all build rebuild debug release \
+ clean distclean