GNUmakefile 19.5 KB
Newer Older
Mike Wey's avatar
Mike Wey committed
1
SHELL=/bin/sh
2
prefix?=/usr/local
3
pkgconfigdir?=$(libdir)/pkgconfig
4
PKG_CONFIG?=pkg-config
Mike Wey's avatar
Mike Wey committed
5
6

OS=$(shell uname || uname -s)
7
ARCH=$(shell uname -m || arch)
Mike Wey's avatar
Mike Wey committed
8

9
ifeq (, $(shell which dpkg-architecture 2>/dev/null))
10
11
12
13
14
	libdir?=lib/
else
	libdir?=lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
endif

Mike Wey's avatar
Mike Wey committed
15
16
17
18
19
ifndef DC
    ifneq ($(strip $(shell which dmd 2>/dev/null)),)
        DC=dmd
    else ifneq ($(strip $(shell which ldc 2>/dev/null)),)
        DC=ldc
Mike Wey's avatar
Mike Wey committed
20
21
    else ifneq ($(strip $(shell which ldc2 2>/dev/null)),)
        DC=ldc2
Mike Wey's avatar
Mike Wey committed
22
23
24
25
26
    else
        DC=gdc
    endif
endif

27
28
29
30
31
32
# make gtkD libs and test
.DEFAULT_GOAL = default-goal

default-goal: libs test
shared: shared-libs

33
all: libs shared-libs test
34

Mike Wey's avatar
Mike Wey committed
35
ifeq ("$(DC)","gdc")
36
37
    DCFLAGS?=-O2
    LINKERFLAG?=-Xlinker
38
39
    DDOCFLAGS=-fsyntax-only -c -fdoc -fdoc-file=$@
    DDOCINC=-fdoc-inc=
Mike Wey's avatar
Mike Wey committed
40
    output=-o $@
Mike Wey's avatar
Mike Wey committed
41
else
42
43
    DCFLAGS?=-O
    LINKERFLAG?=-L
44
    DDOCFLAGS=-o- -Df$@
Mike Wey's avatar
Mike Wey committed
45
    output=-of$@
Mike Wey's avatar
Mike Wey committed
46
47
endif

48
49
50
51
52
53
ifneq (,$(findstring ldc,$(DC)))
    FPIC=-relocation-model=pic
else
	FPIC=-fPIC
endif

Mike Wey's avatar
Mike Wey committed
54
ifeq ("$(OS)","Linux")
Mike Wey's avatar
Mike Wey committed
55
    LDFLAGS+=$(LINKERFLAG)-ldl
Mike Wey's avatar
Mike Wey committed
56
57
endif

58
59
ifeq ("$(OS)","Darwin")
    SO_POSTFIX=$(SO_VERSION).dylib
Timothee Cour's avatar
Timothee Cour committed
60
    SONAME=$(LINKERFLAG)-dylib_install_name $(LINKERFLAG)"$@" $(LINKERFLAG)-dylib_current_version $(LINKERFLAG)$(GTKD_VERSION) $(LINKERFLAG)-dylib_compatibility_version $(LINKERFLAG)$(MAJOR).0
61
62
63
64
65
else
    SO_POSTFIX=so
    SONAME=$(LINKERFLAG)-soname=$@.$(SO_VERSION)
endif

Mike Wey's avatar
Mike Wey committed
66
67
68
AR=ar
RANLIB=ranlib

69
70
71
72
73
74
75
76
ifndef GIRTOD
    ifneq ($(strip $(shell which girtod 2>/dev/null)),)
        GIRTOD=girtod
    else
        GIRTOD=./wrap/girtod
    endif
endif

Mike Wey's avatar
Mike Wey committed
77
ADRDOX?=adrdox
78

Mike Wey's avatar
Mike Wey committed
79
80
#######################################################################

81
GTKD_VERSION=3.9.0
82
SO_VERSION=0
83

84
85
86
87
88
MAJOR =  $(word 1,$(subst ., ,$(GTKD_VERSION)))
MINOR =  $(word 2,$(subst ., ,$(GTKD_VERSION)))
BUGFIX = $(word 3,$(subst ., ,$(GTKD_VERSION)))

LIBNAME_GTKD = libgtkd-$(MAJOR).a
89
SONAME_GTKD = libgtkd-$(MAJOR).$(SO_POSTFIX)
Mike Wey's avatar
Mike Wey committed
90
SOURCES_GTKD = $(wildcard generated/gtkd/*/*.d) $(wildcard generated/gtkd/*/c/*.d)
91
92
OBJECTS_GTKD = $(patsubst %.d,%.o,$(SOURCES_GTKD))
PICOBJECTS_GTKD = $(patsubst %.o,%.pic.o,$(OBJECTS_GTKD))
Mike Wey's avatar
Mike Wey committed
93

94
LIBNAME_GTKDGL = libgtkdgl-$(MAJOR).a
95
SONAME_GTKDGL = libgtkdgl-$(MAJOR).$(SO_POSTFIX)
Mike Wey's avatar
Mike Wey committed
96
SOURCES_GTKDGL = $(wildcard generated/gtkdgl/*/*.d) $(wildcard generated/gtkdgl/*/c/*.d)
Mike Wey's avatar
Mike Wey committed
97
98
99
OBJECTS_GTKDGL = $(patsubst %.d,%.o,$(SOURCES_GTKDGL))
PICOBJECTS_GTKDGL = $(patsubst %.o,%.pic.o,$(OBJECTS_GTKDGL))

100
LIBNAME_GTKDSV = libgtkdsv-$(MAJOR).a
101
SONAME_GTKDSV = libgtkdsv-$(MAJOR).$(SO_POSTFIX)
Mike Wey's avatar
Mike Wey committed
102
SOURCES_GTKDSV = $(wildcard generated/sourceview/*/*.d) $(wildcard generated/sourceview/*/c/*.d)
103
104
OBJECTS_GTKDSV = $(patsubst %.d,%.o,$(SOURCES_GTKDSV))
PICOBJECTS_GTKDSV = $(patsubst %.o,%.pic.o,$(OBJECTS_GTKDSV))
Mike Wey's avatar
Mike Wey committed
105

106
LIBNAME_GSTREAMERD = libgstreamerd-$(MAJOR).a
107
SONAME_GSTREAMERD = libgstreamerd-$(MAJOR).$(SO_POSTFIX)
Mike Wey's avatar
Mike Wey committed
108
SOURCES_GSTREAMERD = $(wildcard generated/gstreamer/*/*.d) $(wildcard generated/gstreamer/*/c/*.d) $(wildcard generated/gstreamer/gst/*/*.d) $(wildcard generated/gstreamer/gst/*/c/*.d)
109
110
OBJECTS_GSTREAMERD = $(patsubst %.d,%.o,$(SOURCES_GSTREAMERD))
PICOBJECTS_GSTREAMERD = $(patsubst %.o,%.pic.o,$(OBJECTS_GSTREAMERD))
Mike Wey's avatar
Mike Wey committed
111

deadalnix's avatar
deadalnix committed
112
LIBNAME_VTED = libvted-$(MAJOR).a
113
SONAME_VTED = libvted-$(MAJOR).$(SO_POSTFIX)
Mike Wey's avatar
Mike Wey committed
114
SOURCES_VTED = $(wildcard generated/vte/*/*.d) $(wildcard generated/vte/*/c/*.d)
deadalnix's avatar
deadalnix committed
115
116
117
OBJECTS_VTED = $(patsubst %.d,%.o,$(SOURCES_VTED))
PICOBJECTS_VTED = $(patsubst %.o,%.pic.o,$(OBJECTS_VTED))

Mike Wey's avatar
Mike Wey committed
118
LIBNAME_PEASD = libpeasd-$(MAJOR).a
119
SONAME_PEASD = libpeasd-$(MAJOR).$(SO_POSTFIX)
Mike Wey's avatar
Mike Wey committed
120
SOURCES_PEASD = $(wildcard generated/peas/*/*.d) $(wildcard generated/peas/*/c/*.d)
Mike Wey's avatar
Mike Wey committed
121
122
123
OBJECTS_PEASD = $(patsubst %.d,%.o,$(SOURCES_PEASD))
PICOBJECTS_PEASD = $(patsubst %.o,%.pic.o,$(OBJECTS_PEASD))

Mike Wey's avatar
Mike Wey committed
124
125
#######################################################################

126
USE_RUNTIME_LINKER = $(shell grep "Linker" generated/gtkd/atk/c/functions.d)
127

128
ifeq ($(USE_RUNTIME_LINKER),)
Greg V's avatar
Greg V committed
129
130
    SOFLAGS_GTKD = $(shell ${PKG_CONFIG} --libs-only-l --libs-only-L gtk+-3.0 librsvg-2.0 gmodule-2.0 | sed 's/-[lL]/$(LINKERFLAG)&/g')
    SOFLAGS_GTKDGL = $(LINKERFLAG)-L. $(LINKERFLAG)./libgtkd-$(MAJOR).$(SO_POSTFIX) $(shell ${PKG_CONFIG} --libs-only-l --libs-only-L gtkglext-3.0 | sed 's/-[lL]/$(LINKERFLAG)&/g')
131
    SOFLAGS_GTKDSV = $(LINKERFLAG)-L. $(LINKERFLAG)./libgtkd-$(MAJOR).$(SO_POSTFIX) $(shell ${PKG_CONFIG} --libs-only-l --libs-only-L gtksourceview-4.0 | sed 's/-[lL]/$(LINKERFLAG)&/g')
Greg V's avatar
Greg V committed
132
133
134
    SOFLAGS_GSTREAMERD = $(LINKERFLAG)-L. $(LINKERFLAG)./libgtkd-$(MAJOR).$(SO_POSTFIX) $(shell ${PKG_CONFIG} --libs-only-l --libs-only-L gstreamer-base-1.0 | sed 's/-[lL]/$(LINKERFLAG)&/g')
    SOFLAGS_VTED = $(LINKERFLAG)-L. $(LINKERFLAG)./libgtkd-$(MAJOR).$(SO_POSTFIX) $(shell ${PKG_CONFIG} --libs-only-l --libs-only-L vte-2.91 | sed 's/-[lL]/$(LINKERFLAG)&/g')
    SOFLAGS_PEASD = $(LINKERFLAG)-L. $(LINKERFLAG)./libgtkd-$(MAJOR).$(SO_POSTFIX) $(shell ${PKG_CONFIG} --libs-only-l --libs-only-L libpeas-1.0 | sed -e 's/-[lL]/$(LINKERFLAG)&/g')
135
136
137
138
endif

#######################################################################

Mike Wey's avatar
Mike Wey committed
139
140
141
142
143
144
145
146
BINNAME_DEMO = TestWindow
SOURCES_DEMO = $(shell find \
        demos/gtkD/TestWindow \
        -name '*.d' )
OBJECTS_DEMO = $(shell echo $(SOURCES_DEMO) | sed -e 's/\.d/\.o/g') 

#######################################################################

147
148
149
150
151
152
153
154
155
156
157
158
159
generate: generate-runtime

generate-runtime: $(GIRTOD)
	$(GIRTOD) -i src --use-runtime-linker --use-bind-dir

generate-compiletime: $(GIRTOD)
	$(GIRTOD) -i src --use-bind-dir

$(GIRTOD):
	$(if $(findstring "./wrap/girtod","$(GIRTOD)"),$(MAKE) -C wrap)

#######################################################################

160
161
162
163
164
165
.PHONY: docs
docs:
	$(ADRDOX) --genSearchIndex --skeleton=docs/adrdox/skeleton.html --directory=docs/api/ --special-preprocessor=gtk generated/
	cp -f docs/adrdox/style.css docs/api/
	cp -f docs/adrdox/Logo.png docs/api/

Mike Wey's avatar
Mike Wey committed
166
167
168
169
170
171
docs-online:
	$(ADRDOX) --jobs=1 --skeleton=docs/adrdox/skeleton-online.html --directory=docs/api/ --special-preprocessor=gtk generated/
	cp -f docs/adrdox/style.css docs/api/
	cp -f docs/adrdox/Logo.png docs/api/
	cp -fr docs/adrdox/fonts/ docs/api/

172
173
#######################################################################

Mike Wey's avatar
Mike Wey committed
174
175
# -Isrc

Mike Wey's avatar
Mike Wey committed
176
177
ifeq ("$(OS)","Darwin")
    libs: gtkd
178
    shared-libs: shared-gtkd
Mike Wey's avatar
Mike Wey committed
179
else
180
    libs: gtkd sv gstreamer vte peas
181
    shared-libs: shared-gtkd shared-sv shared-gstreamer shared-vte shared-peas
Mike Wey's avatar
Mike Wey committed
182
endif
Mike Wey's avatar
Mike Wey committed
183
184

gtkd:      $(LIBNAME_GTKD)
Mike Wey's avatar
Mike Wey committed
185
gtkdgl:    $(LIBNAME_GTKDGL)
Mike Wey's avatar
Mike Wey committed
186
sv:        $(LIBNAME_GTKDSV)
187
gstreamer: $(LIBNAME_GSTREAMERD)
deadalnix's avatar
deadalnix committed
188
vte:       $(LIBNAME_VTED)
Mike Wey's avatar
Mike Wey committed
189
peas:      $(LIBNAME_PEASD)
Mike Wey's avatar
Mike Wey committed
190

191
shared-gtkd:      $(SONAME_GTKD)
Mike Wey's avatar
Mike Wey committed
192
shared-gtkdgl:    $(SONAME_GTKDGL)
193
194
shared-sv:        $(SONAME_GTKDSV)
shared-gstreamer: $(SONAME_GSTREAMERD)
deadalnix's avatar
deadalnix committed
195
shared-vte:       $(SONAME_VTED)
Mike Wey's avatar
Mike Wey committed
196
shared-peas:      $(SONAME_PEASD)
197
198
199

#######################################################################

200
$(LIBNAME_GTKD): IMPORTS=-Igenerated/gtkd
Mike Wey's avatar
Mike Wey committed
201
202
203
$(LIBNAME_GTKD): $(OBJECTS_GTKD)
	$(make-lib)

204
$(LIBNAME_GTKDGL): IMPORTS=-Igenerated/gtkd -Igenerated/gtkdgl
Mike Wey's avatar
Mike Wey committed
205
$(LIBNAME_GTKDGL): $(LIBNAME_GTKD) $(OBJECTS_GTKDGL)
Mike Wey's avatar
Mike Wey committed
206
207
	$(make-lib)

208
$(LIBNAME_GTKDSV): IMPORTS=-Igenerated/gtkd -Igenerated/sourceview
Mike Wey's avatar
Mike Wey committed
209
$(LIBNAME_GTKDSV): $(LIBNAME_GTKD) $(OBJECTS_GTKDSV)
Mike Wey's avatar
Mike Wey committed
210
211
	$(make-lib)

212
$(LIBNAME_GSTREAMERD): IMPORTS=-Igenerated/gtkd -Igenerated/gstreamer
Mike Wey's avatar
Mike Wey committed
213
$(LIBNAME_GSTREAMERD): $(LIBNAME_GTKD) $(OBJECTS_GSTREAMERD)
Mike Wey's avatar
Mike Wey committed
214
215
	$(make-lib)

216
$(LIBNAME_VTED): IMPORTS=-Igenerated/gtkd -Igenerated/vte
Mike Wey's avatar
Mike Wey committed
217
$(LIBNAME_VTED): $(LIBNAME_GTKD) $(OBJECTS_VTED)
deadalnix's avatar
deadalnix committed
218
219
	$(make-lib)

220
$(LIBNAME_PEASD): IMPORTS=-Igenerated/gtkd -Igenerated/peas
Mike Wey's avatar
Mike Wey committed
221
$(LIBNAME_PEASD): $(LIBNAME_GTKD) $(OBJECTS_PEASD)
Mike Wey's avatar
Mike Wey committed
222
223
	$(make-lib)

Mike Wey's avatar
Mike Wey committed
224
225
#######################################################################

226
$(SONAME_GTKD): IMPORTS=-Igenerated/gtkd 
227
$(SONAME_GTKD): $(PICOBJECTS_GTKD)
228
	$(call make-shared-lib,$(SOFLAGS_GTKD))
229

230
$(SONAME_GTKDGL): IMPORTS=-Igenerated/gtkd -Igenerated/gtkdgl
Mike Wey's avatar
Mike Wey committed
231
$(SONAME_GTKDGL): $(SONAME_GTKD) $(PICOBJECTS_GTKDGL)
232
	$(call make-shared-lib,$(SOFLAGS_GTKDGL))
Mike Wey's avatar
Mike Wey committed
233

234
$(SONAME_GTKDSV): IMPORTS=-Igenerated/gtkd -Igenerated/sourceview
Mike Wey's avatar
Mike Wey committed
235
$(SONAME_GTKDSV): $(SONAME_GTKD) $(PICOBJECTS_GTKDSV)
236
	$(call make-shared-lib,$(SOFLAGS_GTKDSV))
237

238
$(SONAME_GSTREAMERD): IMPORTS=-Igenerated/gtkd -Igenerated/gstreamer
Mike Wey's avatar
Mike Wey committed
239
$(SONAME_GSTREAMERD): $(SONAME_GTKD) $(PICOBJECTS_GSTREAMERD)
240
	$(call make-shared-lib,$(SOFLAGS_GSTREAMERD))
241

242
$(SONAME_VTED): IMPORTS=-Igenerated/gtkd -Igenerated/vte
Mike Wey's avatar
Mike Wey committed
243
$(SONAME_VTED): $(SONAME_GTKD) $(PICOBJECTS_VTED)
244
	$(call make-shared-lib,$(SOFLAGS_VTED))
deadalnix's avatar
deadalnix committed
245

246
$(SONAME_PEASD): IMPORTS=-Igenerated/gtkd -Igenerated/peas
Mike Wey's avatar
Mike Wey committed
247
$(SONAME_PEASD): $(SONAME_GTKD) $(PICOBJECTS_PEASD)
248
	$(call make-shared-lib,$(SOFLAGS_PEASD))
Mike Wey's avatar
Mike Wey committed
249

250
251
#######################################################################

Mike Wey's avatar
Mike Wey committed
252
253
254
255
# -Idemos

test: $(BINNAME_DEMO)

256
257
258
259
260
261
# Build libgtkd.a when neigther neither libgtkd.so and libgtkd.a are pressend.

# Use -rpath for the demo so that the shard libs don't need to
# be installed for it to run. 

# Create a versioned symlink so the demo is able to load it.
262

263
$(BINNAME_DEMO): IMPORTS=-Igenerated/gtkd -Idemos/gtkD/TestWindow
264
$(BINNAME_DEMO): $(OBJECTS_DEMO)
265
266
	$(if $(wildcard $(SONAME_GTKD)),,$(if $(wildcard $(LIBNAME_GTKD)),,$(MAKE) $(LIBNAME_GTKD)))
	$(if $(wildcard $(SONAME_GTKD)),$(eval LDFLAGS+= $(LINKERFLAG)-rpath=./))
267
	$(if $(wildcard $(SONAME_GTKD)),$(if $(findstring "gdc","$(DC)"),$(eval LDFLAGS+=-shared-libphobos)))
268
	$(if $(wildcard $(SONAME_GTKD)),$(if $(wildcard $(SONAME_GTKD).$(SO_VERSION)),,$(shell ln -s $(SONAME_GTKD) $(SONAME_GTKD).$(SO_VERSION))))
269
	$(DC) $(OBJECTS_DEMO) $(output) $(if $(wildcard $(SONAME_GTKD)),$(LINKERFLAG)./libgtkd-$(MAJOR).$(SO_POSTFIX),$(LINKERFLAG)./libgtkd-$(MAJOR).a) $(LDFLAGS)
Mike Wey's avatar
Mike Wey committed
270
271
272
273

#######################################################################

%.o : %.d
274
	$(DC) $(DCFLAGS) $(IMPORTS) -c $< $(output)
Mike Wey's avatar
Mike Wey committed
275

276
277
%.pic.o : %.d
	$(DC) $(DCFLAGS) $(FPIC) $(IMPORTS) -c $< $(output)
278

Mike Wey's avatar
Mike Wey committed
279
280
#######################################################################

281
282
283
284
285
286
287
288
289
ifeq ("$(OS)","Darwin")
    pkgconfig: pkgconfig-gtkd
else
    pkgconfig: pkgconfig-gtkd pkgconfig-gtkdgl pkgconfig-sv
endif

pkgconfig-gtkd:      gtkd-$(MAJOR).pc
pkgconfig-gtkdgl:    gtkdgl-$(MAJOR).pc
pkgconfig-sv:        gtkdsv-$(MAJOR).pc
290
pkgconfig-gstreamer: gstreamerd-$(MAJOR).pc
deadalnix's avatar
deadalnix committed
291
pkgconfig-vte:       vted-$(MAJOR).pc
Mike Wey's avatar
Mike Wey committed
292
pkgconfig-peas:      peasd-$(MAJOR).pc
293
294
295
296
297

gtkd-$(MAJOR).pc:
	echo Name: GtkD > $@
	echo Description: A D binding and OO wrapper for GTK+. >> $@
	echo Version: $(GTKD_VERSION) >> $@
298
	echo Libs: $(LINKERFLAG)-L$(prefix)/$(libdir)/ $(LINKERFLAG)-lgtkd-$(MAJOR) $(LINKERFLAG)-ldl >> $@
299
	echo Cflags: -I$(prefix)/include/d/gtkd-$(MAJOR)/ >> $@
Greg V's avatar
Greg V committed
300
	echo Requires: gtk+-3.0, gdk-3.0, atk, pango, cairo, cairo-gobject, pangocairo, librsvg-2.0, gio-2.0, glib-2.0, gobject-2.0 >> $@
301
302
303
304
305
306

gtkdgl-$(MAJOR).pc:
	echo Name: GtkDGL > $@
	echo Description: OpenGL capabilities for GtkD. >> $@
	echo Version: $(GTKD_VERSION) >> $@
	echo Libs: $(LINKERFLAG)-lgtkdgl-$(MAJOR) >> $@
Greg V's avatar
Greg V committed
307
	echo Requires: gtkd-$(MAJOR), gtkglext-1.0 >> $@
308
309
310
311
312
313

gtkdsv-$(MAJOR).pc:
	echo Name: GtkD SourceView > $@
	echo Description: A D binding and OO wrapper for GtkSourceView. >> $@
	echo Version: $(GTKD_VERSION) >> $@
	echo Libs: $(LINKERFLAG)-lgtkdsv-$(MAJOR) >> $@
314
	echo Requires: gtkd-$(MAJOR), gtksourceview-4.0 >> $@
315

316
gstreamerd-$(MAJOR).pc:
317
318
	echo Name: GstreamerD > $@
	echo Description: A D binding and OO wrapper for Gstreamer. >> $@
319
320
	echo Version: $(GTKD_VERSION) >> $@
	echo Libs: $(LINKERFLAG)-lgstreamerd-$(MAJOR) >> $@
Greg V's avatar
Greg V committed
321
	echo Requires: gtkd-$(MAJOR), gstreamer-1.0, gstreamer-base-1.0 >> $@
322

deadalnix's avatar
deadalnix committed
323
324
325
326
327
vted-$(MAJOR).pc:
	echo Name: VteD > $@
	echo Description: A D binding and OO wrapper for Vte. >> $@
	echo Version: $(GTKD_VERSION) >> $@
	echo Libs: $(LINKERFLAG)-lvted-$(MAJOR) >> $@
Greg V's avatar
Greg V committed
328
	echo Requires: gtkd-$(MAJOR), vte-2.91 >> $@
deadalnix's avatar
deadalnix committed
329

Mike Wey's avatar
Mike Wey committed
330
331
332
333
334
peasd-$(MAJOR).pc:
	echo Name: PeasD > $@
	echo Description: A D binding and OO wrapper for Peas. >> $@
	echo Version: $(GTKD_VERSION) >> $@
	echo Libs: $(LINKERFLAG)-lpeasd-$(MAJOR) >> $@
Greg V's avatar
Greg V committed
335
	echo Requires: gtkd-$(MAJOR), libpeas-1.0, libpeas-gtk-1.0 >> $@
Mike Wey's avatar
Mike Wey committed
336

337
338
#######################################################################

Mike Wey's avatar
Mike Wey committed
339
340
ifeq ("$(OS)","Darwin")
    install: install-gtkd
341
    install-headers: install-headers-gtkd
342
    install-shared: install-shared-gtkd
Mike Wey's avatar
Mike Wey committed
343
else
344
    install: install-gtkd install-gtkdsv install-gstreamer install-vte install-peas
345
    install-headers: install-headers-gtkd install-headers-gtkdsv install-headers-gstreamer install-headers-vte install-headers-peas
346
    install-shared: install-shared-gtkd install-shared-gtkdsv install-shared-gstreamer install-shared-vte install-shared-peas
Mike Wey's avatar
Mike Wey committed
347
348
endif

349
install-gtkd: $(LIBNAME_GTKD) install-headers-gtkd
350
351
	install -d $(DESTDIR)$(prefix)/$(libdir)
	install -m 644 $(LIBNAME_GTKD)   $(DESTDIR)$(prefix)/$(libdir)
Mike Wey's avatar
Mike Wey committed
352

Mike Wey's avatar
Mike Wey committed
353
354
355
install-gtkdgl: $(LIBNAME_GTKDGL) install-gtkd install-headers-gtkdgl
	install -m 644 $(LIBNAME_GTKDGL) $(DESTDIR)$(prefix)/$(libdir)

356
install-gtkdsv: $(LIBNAME_GTKDSV) install-gtkd install-headers-gtkdsv
357
	install -m 644 $(LIBNAME_GTKDSV) $(DESTDIR)$(prefix)/$(libdir)
Mike Wey's avatar
Mike Wey committed
358

359
install-gstreamer: $(LIBNAME_GSTREAMERD) install-gtkd install-headers-gstreamer
360
	install -m 644 $(LIBNAME_GSTREAMERD) $(DESTDIR)$(prefix)/$(libdir)
Mike Wey's avatar
Mike Wey committed
361

Mike Wey's avatar
Mike Wey committed
362
install-vte: $(LIBNAME_VTED) install-gtkd install-headers-vte
363
364
	install -m 644 $(LIBNAME_VTED) $(DESTDIR)$(prefix)/$(libdir)

Mike Wey's avatar
Mike Wey committed
365
366
367
install-peas: $(LIBNAME_PEASD) install-gtkd install-headers-peas
	install -m 644 $(LIBNAME_PEASD) $(DESTDIR)$(prefix)/$(libdir)

368
369
370
install-shared-gtkd: $(SONAME_GTKD)
	install -d $(DESTDIR)$(prefix)/$(libdir)
	$(install-so)
371

Mike Wey's avatar
Mike Wey committed
372
373
374
install-shared-gtkdgl: $(SONAME_GTKDGL) install-shared-gtkd
	$(install-so)

375
install-shared-gtkdsv: $(SONAME_GTKDSV) install-shared-gtkd
376
	$(install-so)
377

378
install-shared-gstreamer: $(SONAME_GSTREAMERD) install-shared-gtkd
379
380
	$(install-so)

Mike Wey's avatar
Mike Wey committed
381
install-shared-vte: $(SONAME_VTED) install-shared-gtkd
382
	$(install-so)
383

Mike Wey's avatar
Mike Wey committed
384
385
386
install-shared-peas: $(SONAME_PEASD) install-shared-gtkd
	$(install-so)

387
install-headers-gtkd: gtkd-$(MAJOR).pc
388
	install -d $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)
389
	install -d $(DESTDIR)$(prefix)/$(pkgconfigdir)
390
	(cd generated/gtkd;   echo $(SOURCES_GTKD)   | sed -e s,generated/gtkd/,,g   | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
391
	install -m 644 gtkd-$(MAJOR).pc $(DESTDIR)$(prefix)/$(pkgconfigdir)
392

393
install-headers-gtkdgl: gtkdgl-$(MAJOR).pc install-headers-gtkd
394
	(cd generated/gtkdgl; echo $(SOURCES_GTKDGL) | sed -e s,generated/gtkdgl/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
395
	install -m 644 gtkdgl-$(MAJOR).pc $(DESTDIR)$(prefix)/$(pkgconfigdir)
Mike Wey's avatar
Mike Wey committed
396

397
install-headers-gtkdsv: gtkdsv-$(MAJOR).pc install-headers-gtkd
398
	(cd generated/sourceview; echo $(SOURCES_GTKDSV) | sed -e s,generated/sourceview/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
399
	install -m 644 gtkdsv-$(MAJOR).pc $(DESTDIR)$(prefix)/$(pkgconfigdir)
400

401
install-headers-gstreamer: gstreamerd-$(MAJOR).pc install-headers-gtkd
402
	(cd generated/gstreamer; echo $(SOURCES_GSTREAMERD) | sed -e s,generated/gstreamer/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
403
	install -m 644 gstreamerd-$(MAJOR).pc $(DESTDIR)$(prefix)/$(pkgconfigdir)
404

Mike Wey's avatar
Mike Wey committed
405
install-headers-vte: vted-$(MAJOR).pc install-headers-gtkd
406
	(cd generated/vte; echo $(SOURCES_VTED) | sed -e s,generated/vte/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
407
	install -m 644 vted-$(MAJOR).pc $(DESTDIR)$(prefix)/$(pkgconfigdir)
408

Mike Wey's avatar
Mike Wey committed
409
install-headers-peas: peasd-$(MAJOR).pc install-headers-gtkd
410
	(cd generated/peas; echo $(SOURCES_PEASD) | sed -e s,generated/peas/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
411
	install -m 644 peasd-$(MAJOR).pc $(DESTDIR)$(prefix)/$(pkgconfigdir)
Mike Wey's avatar
Mike Wey committed
412

413
uninstall: uninstall-gtkdgl uninstall-gtkdsv uninstall-gstreamer uninstall-vte uninstall-peas
414
	$(foreach dir,$(shell ls generated/gtkd)  , rm -rf $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)/$(dir))
415
	rm -f $(DESTDIR)$(prefix)/$(pkgconfigdir)/gtkd-$(MAJOR).pc
416
417
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_GTKD)
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKD)
418
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKD).$(SO_VERSION)
419
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKD).$(SO_VERSION).$(MINOR).$(BUGFIX)
Mike Wey's avatar
Mike Wey committed
420

Mike Wey's avatar
Mike Wey committed
421
uninstall-gtkdgl:
422
	$(foreach dir,$(shell ls generated/gtkdgl), rm -rf $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)/$(dir))
423
	rm -f $(DESTDIR)$(prefix)/$(pkgconfigdir)/gtkdgl-$(MAJOR).pc
Mike Wey's avatar
Mike Wey committed
424
425
426
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_GTKDGL)
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDGL)
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDGL).$(SO_VERSION)
427
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDGL).$(SO_VERSION).$(MINOR).$(BUGFIX)
Mike Wey's avatar
Mike Wey committed
428

Mike Wey's avatar
Mike Wey committed
429
uninstall-gtkdsv:
430
	$(foreach dir,$(shell ls generated/sourceview), rm -rf $(DESTDIR)$(prefix)/include/d/$(dir))
431
	rm -f $(DESTDIR)$(prefix)/$(pkgconfigdir)/gtkdsv-$(MAJOR).pc
432
433
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_GTKDSV)
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDSV)
434
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDSV).$(SO_VERSION)
435
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDSV).$(SO_VERSION).$(MINOR).$(BUGFIX)
Mike Wey's avatar
Mike Wey committed
436
437

uninstall-gstreamer:
438
	$(foreach dir,$(shell ls generated/gstreamer), rm -rf $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)/$(dir))
439
	rm -f $(DESTDIR)$(prefix)/$(pkgconfigdir)/gstreamerd-$(MAJOR).pc
440
441
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_GSTREAMERD)
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GSTREAMERD)
442
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GSTREAMERD).$(SO_VERSION)
443
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GSTREAMERD).$(SO_VERSION).$(MINOR).$(BUGFIX)
Mike Wey's avatar
Mike Wey committed
444

445
uninstall-vte:
446
	$(foreach dir,$(shell ls generated/vte), rm -rf $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)/$(dir))
447
	rm -f $(DESTDIR)$(prefix)/$(pkgconfigdir)/vted-$(MAJOR).pc
448
449
450
451
452
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_VTED)
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_VTED)
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_VTED).$(SO_VERSION)
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_VTED).$(SO_VERSION).$(MINOR).$(BUGFIX)

Mike Wey's avatar
Mike Wey committed
453
uninstall-peas:
454
	$(foreach dir,$(shell ls generated/peas), rm -rf $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)/$(dir))
455
	rm -f $(DESTDIR)$(prefix)/$(pkgconfigdir)/peasd-$(MAJOR).pc
Mike Wey's avatar
Mike Wey committed
456
457
458
459
460
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_PEASD)
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_PEASD)
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_PEASD).$(SO_VERSION)
	rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_PEASD).$(SO_VERSION).$(MINOR).$(BUGFIX)

Mike Wey's avatar
Mike Wey committed
461
clean:
Mike Wey's avatar
Fixup    
Mike Wey committed
462
463
464
	-rm -f $(LIBNAME_GTKD)       $(SONAME_GTKD)       gtkd-$(MAJOR).pc     $(OBJECTS_GTKD)       $(PICOBJECTS_GTKD)
	-rm -f $(LIBNAME_GTKDGL)     $(SONAME_GTKDGL)     gtkdgl-$(MAJOR).pc   $(OBJECTS_GTKDGL)     $(PICOBJECTS_GTKDGL)
	-rm -f $(LIBNAME_GTKDSV)     $(SONAME_GTKDSV)     gtkdsv-$(MAJOR).pc   $(OBJECTS_GTKDSV)     $(PICOBJECTS_GTKDSV)
465
	-rm -f $(LIBNAME_GSTREAMERD) $(SONAME_GSTREAMERD) gstreamerd-$(MAJOR).pc      $(OBJECTS_GSTREAMERD) $(PICOBJECTS_GSTREAMERD)
466
	-rm -f $(LIBNAME_VTED)       $(SONAME_VTED)       vted-$(MAJOR).pc     $(OBJECTS_VTED)       $(PICOBJECTS_VTED)
Mike Wey's avatar
Mike Wey committed
467
	-rm -f $(LIBNAME_PEASD)      $(SONAME_PEASD)      peasd-$(MAJOR).pc    $(OBJECTS_PEASD)      $(PICOBJECTS_PEASD)
468
	-rm -f $(BINNAME_DEMO)       $(OBJECTS_DEMO)      $(SONAME_GTKD).$(SO_VERSION)
469
	-$(MAKE) -C wrap clean
470
471
472
473

#######################################################################

define make-lib
Mike Wey's avatar
Mike Wey committed
474
    $(AR) rcs $@ $(subst $(LIBNAME_GTKD),,$^)
475
476
477
478
    $(RANLIB) $@
endef

define make-shared-lib
479
	$(if $(filter-out "Darwin","$(OS)"), $(if $(findstring "dmd","$(DC)"),$(eval LDFLAGS+=-defaultlib=:libphobos2.so)))
480
	$(if $(findstring "gdc","$(DC)"),$(eval LDFLAGS+=-shared-libphobos))
481
482
483
	$(if $(findstring "ldc","$(DC)"),$(eval LDFLAGS+=-link-defaultlib-shared))

	$(DC) -shared $(output) $(LDFLAGS) $1 $(SONAME) $(subst $(SONAME_GTKD),,$^)
484
485
486
endef

define install-so
487
    install -m 755 $< $(DESTDIR)$(prefix)/$(libdir)/$<.$(SO_VERSION).$(MINOR).$(BUGFIX)
488
489
490
	ldconfig -n $(DESTDIR)$(prefix)/$(libdir)/
    cd $(DESTDIR)$(prefix)/$(libdir)/; ln -sf $<.$(SO_VERSION).$(MINOR).$(BUGFIX) $<.$(SO_VERSION) 
    cd $(DESTDIR)$(prefix)/$(libdir)/; ln -sf $<.$(SO_VERSION) $<
491
endef