-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathGNUmakefile
51 lines (41 loc) · 1.08 KB
/
GNUmakefile
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
SHELL=/bin/sh
OS=$(shell uname || uname -s)
ARCH=$(shell arch || uname -m)
GIR_TO_D_VERSION=v0.23.1
ifndef DC
ifneq ($(strip $(shell which dmd 2>/dev/null)),)
DC=dmd
else ifneq ($(strip $(shell which ldc 2>/dev/null)),)
DC=ldc
else ifneq ($(strip $(shell which ldc2 2>/dev/null)),)
DC=ldc2
else
DC=gdc
endif
endif
ifeq ("$(DC)","gdc")
DCFLAGS=-O2
INCLUDEFLAG=-J
LINKERFLAG=-Xlinker
DDOCFLAGS=-fsyntax-only -c -fdoc -fdoc-file=$@
DDOCINC=-fdoc-inc=
output=-o $@
else
DCFLAGS=-O
INCLUDEFLAG=-J
LINKERFLAG=-L
DDOCFLAGS=-o- -Df$@
output=-of$@
endif
#######################################################################
.DEFAULT_GOAL = $(BINNAME)
SOURCES = $(wildcard source/*.d) $(wildcard source/gtd/*.d)
BINNAME = girtod
$(BINNAME): VERSION $(SOURCES)
$(DC) $(filter-out $<,$^) $(output) $(INCLUDEFLAG)./ $(DCFLAGS) $(LDFLAGS)
rm -f *.o
VERSION: VERSION.in
sed 's/@VCS_TAG@/$(shell git describe --dirty=+ --tags || echo $(GIR_TO_D_VERSION))/g' $< > $@
clean:
-rm -f $(BINNAME)
-rm -f VERSION