forked from dlang/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
posix.mak
119 lines (98 loc) · 2.33 KB
/
posix.mak
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
DMD ?= dmd
CC ?= gcc
PREFIX ?= /usr/local/bin
WITH_DOC ?= no
DOC ?= ../dlang.org/web
OS:=
uname_S:=$(shell uname -s)
ifeq (Darwin,$(uname_S))
OS:=osx
endif
ifeq (Linux,$(uname_S))
OS:=linux
endif
ifeq (FreeBSD,$(uname_S))
OS:=freebsd
endif
ifeq (OpenBSD,$(uname_S))
OS:=openbsd
endif
ifeq (Solaris,$(uname_S))
OS:=solaris
endif
ifeq (SunOS,$(uname_S))
OS:=solaris
endif
ifeq (,$(OS))
$(error Unrecognized or unsupported OS for uname: $(uname_S))
endif
MODEL:=default
ifneq (default,$(MODEL))
MODEL_FLAG:=-m$(MODEL)
endif
ROOT_OF_THEM_ALL = generated
ROOT = $(ROOT_OF_THEM_ALL)/$(OS)/$(MODEL)
TOOLS = \
$(ROOT)/rdmd \
$(ROOT)/ddemangle \
$(ROOT)/catdoc \
$(ROOT)/detab \
$(ROOT)/tolf
CURL_TOOLS = \
$(ROOT)/dget \
$(ROOT)/changed
DOC_TOOLS = \
$(ROOT)/findtags \
$(ROOT)/dman
TAGS:= \
expression.tag \
statement.tag
PHOBOS_TAGS:= \
std_algorithm.tag \
std_array.tag \
std_file.tag \
std_format.tag \
std_math.tag \
std_parallelism.tag \
std_path.tag \
std_random.tag \
std_range.tag \
std_regex.tag \
std_stdio.tag \
std_string.tag \
std_traits.tag \
std_typetuple.tag
all: $(TOOLS) $(CURL_TOOLS) $(ROOT)/dustmite
rdmd: $(ROOT)/rdmd
ddemangle: $(ROOT)/ddemangle
catdoc: $(ROOT)/catdoc
detab: $(ROOT)/detab
tolf: $(ROOT)/tolf
dget: $(ROOT)/dget
changed: $(ROOT)/changed
findtags: $(ROOT)/findtags
dman: $(ROOT)/dman
dustmite: $(ROOT)/dustmite
$(ROOT)/dustmite: DustMite/dustmite.d DustMite/dsplit.d
$(DMD) $(MODEL_FLAG) DustMite/dustmite.d DustMite/dsplit.d -of$(@)
#dreadful custom step because of libcurl dmd linking problem (Bugzilla 7044)
$(CURL_TOOLS): $(ROOT)/%: %.d
$(DMD) -c -of$(@).o $(<)
($(DMD) -v -of$(@) $(@).o 2>&1 | grep gcc | cut -f2- -d' ' ; echo -lcurl ) | xargs $(CC)
$(TOOLS) $(DOC_TOOLS): $(ROOT)/%: %.d
$(DMD) $(MODEL_FLAG) $(DFLAGS) -of$(@) $(<)
$(TAGS): %.tag: $(DOC)/%.html $(ROOT)/findtags
$(ROOT)/findtags $< > $@
$(PHOBOS_TAGS): %.tag: $(DOC)/phobos/%.html $(ROOT)/findtags
$(ROOT)/findtags $< > $@
$(ROOT)/dman: $(TAGS) $(PHOBOS_TAGS)
$(ROOT)/dman: DFLAGS += -J.
install: $(TOOLS) $(CURL_TOOLS)
install -d $(DESTDIR)$(PREFIX)
install -t $(DESTDIR)$(PREFIX) $(^)
clean:
rm -f $(ROOT)/dustmite $(TOOLS) $(CURL_TOOLS) $(DOC_TOOLS) $(TAGS) *.o $(ROOT)/*.o
ifeq ($(WITH_DOC),yes)
all install: $(DOC_TOOLS)
endif
.PHONY: all install clean