blob: 08edd98cc53023dc17b6d4e2c95048b85c341c2b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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=-fdebug=checkdoc -fdebug=summary
GDC_FLAGS_RELEASE=-frelease
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
|