-
Notifications
You must be signed in to change notification settings - Fork 71
/
GNUmakefile
491 lines (386 loc) · 19.5 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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
SHELL=/bin/sh
prefix?=/usr/local
pkgconfigdir?=$(libdir)/pkgconfig
PKG_CONFIG?=pkg-config
OS=$(shell uname || uname -s)
ARCH=$(shell uname -m || arch)
ifeq (, $(shell which dpkg-architecture 2>/dev/null))
libdir?=lib/
else
libdir?=lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
endif
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
# make gtkD libs and test
.DEFAULT_GOAL = default-goal
default-goal: libs test
shared: shared-libs
all: libs shared-libs test
ifeq ("$(DC)","gdc")
DCFLAGS?=-O2
LINKERFLAG?=
DDOCFLAGS=-fsyntax-only -c -fdoc -fdoc-file=$@
DDOCINC=-fdoc-inc=
output=-o $@
else
DCFLAGS?=-O
LINKERFLAG?=-L
DDOCFLAGS=-o- -Df$@
output=-of$@
endif
ifneq (,$(findstring ldc,$(DC)))
FPIC=-relocation-model=pic
else
FPIC=-fPIC
endif
ifeq ("$(OS)","Linux")
LDFLAGS+=$(LINKERFLAG)-ldl
endif
ifeq ("$(OS)","Darwin")
SO_POSTFIX=$(SO_VERSION).dylib
SONAME=$(LINKERFLAG)-dylib_install_name $(LINKERFLAG)"$@" $(LINKERFLAG)-dylib_current_version $(LINKERFLAG)$(GTKD_VERSION) $(LINKERFLAG)-dylib_compatibility_version $(LINKERFLAG)$(MAJOR).0
else
SO_POSTFIX=so
SONAME=$(LINKERFLAG)-soname=$@.$(SO_VERSION)
endif
AR=ar
RANLIB=ranlib
ifndef GIRTOD
ifneq ($(strip $(shell which girtod 2>/dev/null)),)
GIRTOD=girtod
else
GIRTOD=./wrap/girtod
endif
endif
ADRDOX?=adrdox
#######################################################################
GTKD_VERSION=3.10.0
SO_VERSION=0
MAJOR = $(word 1,$(subst ., ,$(GTKD_VERSION)))
MINOR = $(word 2,$(subst ., ,$(GTKD_VERSION)))
BUGFIX = $(word 3,$(subst ., ,$(GTKD_VERSION)))
LIBNAME_GTKD = libgtkd-$(MAJOR).a
SONAME_GTKD = libgtkd-$(MAJOR).$(SO_POSTFIX)
SOURCES_GTKD = $(wildcard generated/gtkd/*/*.d) $(wildcard generated/gtkd/*/c/*.d)
OBJECTS_GTKD = $(patsubst %.d,%.o,$(SOURCES_GTKD))
PICOBJECTS_GTKD = $(patsubst %.o,%.pic.o,$(OBJECTS_GTKD))
LIBNAME_GTKDGL = libgtkdgl-$(MAJOR).a
SONAME_GTKDGL = libgtkdgl-$(MAJOR).$(SO_POSTFIX)
SOURCES_GTKDGL = $(wildcard generated/gtkdgl/*/*.d) $(wildcard generated/gtkdgl/*/c/*.d)
OBJECTS_GTKDGL = $(patsubst %.d,%.o,$(SOURCES_GTKDGL))
PICOBJECTS_GTKDGL = $(patsubst %.o,%.pic.o,$(OBJECTS_GTKDGL))
LIBNAME_GTKDSV = libgtkdsv-$(MAJOR).a
SONAME_GTKDSV = libgtkdsv-$(MAJOR).$(SO_POSTFIX)
SOURCES_GTKDSV = $(wildcard generated/sourceview/*/*.d) $(wildcard generated/sourceview/*/c/*.d)
OBJECTS_GTKDSV = $(patsubst %.d,%.o,$(SOURCES_GTKDSV))
PICOBJECTS_GTKDSV = $(patsubst %.o,%.pic.o,$(OBJECTS_GTKDSV))
LIBNAME_GSTREAMERD = libgstreamerd-$(MAJOR).a
SONAME_GSTREAMERD = libgstreamerd-$(MAJOR).$(SO_POSTFIX)
SOURCES_GSTREAMERD = $(wildcard generated/gstreamer/*/*.d) $(wildcard generated/gstreamer/*/c/*.d) $(wildcard generated/gstreamer/gst/*/*.d) $(wildcard generated/gstreamer/gst/*/c/*.d)
OBJECTS_GSTREAMERD = $(patsubst %.d,%.o,$(SOURCES_GSTREAMERD))
PICOBJECTS_GSTREAMERD = $(patsubst %.o,%.pic.o,$(OBJECTS_GSTREAMERD))
LIBNAME_VTED = libvted-$(MAJOR).a
SONAME_VTED = libvted-$(MAJOR).$(SO_POSTFIX)
SOURCES_VTED = $(wildcard generated/vte/*/*.d) $(wildcard generated/vte/*/c/*.d)
OBJECTS_VTED = $(patsubst %.d,%.o,$(SOURCES_VTED))
PICOBJECTS_VTED = $(patsubst %.o,%.pic.o,$(OBJECTS_VTED))
LIBNAME_PEASD = libpeasd-$(MAJOR).a
SONAME_PEASD = libpeasd-$(MAJOR).$(SO_POSTFIX)
SOURCES_PEASD = $(wildcard generated/peas/*/*.d) $(wildcard generated/peas/*/c/*.d)
OBJECTS_PEASD = $(patsubst %.d,%.o,$(SOURCES_PEASD))
PICOBJECTS_PEASD = $(patsubst %.o,%.pic.o,$(OBJECTS_PEASD))
#######################################################################
USE_RUNTIME_LINKER = $(shell grep "Linker" generated/gtkd/atk/c/functions.d)
ifeq ($(USE_RUNTIME_LINKER),)
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')
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')
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')
endif
#######################################################################
BINNAME_DEMO = TestWindow
SOURCES_DEMO = $(shell find \
demos/gtkD/TestWindow \
-name '*.d' )
OBJECTS_DEMO = $(shell echo $(SOURCES_DEMO) | sed -e 's/\.d/\.o/g')
#######################################################################
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)
#######################################################################
.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/
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/
#######################################################################
# -Isrc
ifeq ("$(OS)","Darwin")
libs: gtkd
shared-libs: shared-gtkd
else
libs: gtkd sv gstreamer vte peas
shared-libs: shared-gtkd shared-sv shared-gstreamer shared-vte shared-peas
endif
gtkd: $(LIBNAME_GTKD)
gtkdgl: $(LIBNAME_GTKDGL)
sv: $(LIBNAME_GTKDSV)
gstreamer: $(LIBNAME_GSTREAMERD)
vte: $(LIBNAME_VTED)
peas: $(LIBNAME_PEASD)
shared-gtkd: $(SONAME_GTKD)
shared-gtkdgl: $(SONAME_GTKDGL)
shared-sv: $(SONAME_GTKDSV)
shared-gstreamer: $(SONAME_GSTREAMERD)
shared-vte: $(SONAME_VTED)
shared-peas: $(SONAME_PEASD)
#######################################################################
$(LIBNAME_GTKD): IMPORTS=-Igenerated/gtkd
$(LIBNAME_GTKD): $(OBJECTS_GTKD)
$(make-lib)
$(LIBNAME_GTKDGL): IMPORTS=-Igenerated/gtkd -Igenerated/gtkdgl
$(LIBNAME_GTKDGL): $(LIBNAME_GTKD) $(OBJECTS_GTKDGL)
$(make-lib)
$(LIBNAME_GTKDSV): IMPORTS=-Igenerated/gtkd -Igenerated/sourceview
$(LIBNAME_GTKDSV): $(LIBNAME_GTKD) $(OBJECTS_GTKDSV)
$(make-lib)
$(LIBNAME_GSTREAMERD): IMPORTS=-Igenerated/gtkd -Igenerated/gstreamer
$(LIBNAME_GSTREAMERD): $(LIBNAME_GTKD) $(OBJECTS_GSTREAMERD)
$(make-lib)
$(LIBNAME_VTED): IMPORTS=-Igenerated/gtkd -Igenerated/vte
$(LIBNAME_VTED): $(LIBNAME_GTKD) $(OBJECTS_VTED)
$(make-lib)
$(LIBNAME_PEASD): IMPORTS=-Igenerated/gtkd -Igenerated/peas
$(LIBNAME_PEASD): $(LIBNAME_GTKD) $(OBJECTS_PEASD)
$(make-lib)
#######################################################################
$(SONAME_GTKD): IMPORTS=-Igenerated/gtkd
$(SONAME_GTKD): $(PICOBJECTS_GTKD)
$(call make-shared-lib,$(SOFLAGS_GTKD))
$(SONAME_GTKDGL): IMPORTS=-Igenerated/gtkd -Igenerated/gtkdgl
$(SONAME_GTKDGL): $(SONAME_GTKD) $(PICOBJECTS_GTKDGL)
$(call make-shared-lib,$(SOFLAGS_GTKDGL))
$(SONAME_GTKDSV): IMPORTS=-Igenerated/gtkd -Igenerated/sourceview
$(SONAME_GTKDSV): $(SONAME_GTKD) $(PICOBJECTS_GTKDSV)
$(call make-shared-lib,$(SOFLAGS_GTKDSV))
$(SONAME_GSTREAMERD): IMPORTS=-Igenerated/gtkd -Igenerated/gstreamer
$(SONAME_GSTREAMERD): $(SONAME_GTKD) $(PICOBJECTS_GSTREAMERD)
$(call make-shared-lib,$(SOFLAGS_GSTREAMERD))
$(SONAME_VTED): IMPORTS=-Igenerated/gtkd -Igenerated/vte
$(SONAME_VTED): $(SONAME_GTKD) $(PICOBJECTS_VTED)
$(call make-shared-lib,$(SOFLAGS_VTED))
$(SONAME_PEASD): IMPORTS=-Igenerated/gtkd -Igenerated/peas
$(SONAME_PEASD): $(SONAME_GTKD) $(PICOBJECTS_PEASD)
$(call make-shared-lib,$(SOFLAGS_PEASD))
#######################################################################
# -Idemos
test: $(BINNAME_DEMO)
# 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.
$(BINNAME_DEMO): IMPORTS=-Igenerated/gtkd -Idemos/gtkD/TestWindow
$(BINNAME_DEMO): $(OBJECTS_DEMO)
$(if $(wildcard $(SONAME_GTKD)),,$(if $(wildcard $(LIBNAME_GTKD)),,$(MAKE) $(LIBNAME_GTKD)))
$(if $(wildcard $(SONAME_GTKD)),$(eval LDFLAGS+= $(LINKERFLAG)-rpath=./))
$(if $(wildcard $(SONAME_GTKD)),$(if $(findstring "gdc","$(DC)"),$(eval LDFLAGS+=-shared-libphobos)))
$(if $(wildcard $(SONAME_GTKD)),$(if $(wildcard $(SONAME_GTKD).$(SO_VERSION)),,$(shell ln -s $(SONAME_GTKD) $(SONAME_GTKD).$(SO_VERSION))))
$(DC) $(OBJECTS_DEMO) $(output) $(if $(wildcard $(SONAME_GTKD)),$(LINKERFLAG)./libgtkd-$(MAJOR).$(SO_POSTFIX),$(LINKERFLAG)./libgtkd-$(MAJOR).a) $(LDFLAGS)
#######################################################################
%.o : %.d
$(DC) $(DCFLAGS) $(IMPORTS) -c $< $(output)
%.pic.o : %.d
$(DC) $(DCFLAGS) $(FPIC) $(IMPORTS) -c $< $(output)
#######################################################################
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
pkgconfig-gstreamer: gstreamerd-$(MAJOR).pc
pkgconfig-vte: vted-$(MAJOR).pc
pkgconfig-peas: peasd-$(MAJOR).pc
gtkd-$(MAJOR).pc:
echo Name: GtkD > $@
echo Description: A D binding and OO wrapper for GTK+. >> $@
echo Version: $(GTKD_VERSION) >> $@
echo Libs: $(LINKERFLAG)-L$(prefix)/$(libdir)/ $(LINKERFLAG)-lgtkd-$(MAJOR) $(LINKERFLAG)-ldl >> $@
echo Cflags: -I$(prefix)/include/d/gtkd-$(MAJOR)/ >> $@
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 >> $@
gtkdgl-$(MAJOR).pc:
echo Name: GtkDGL > $@
echo Description: OpenGL capabilities for GtkD. >> $@
echo Version: $(GTKD_VERSION) >> $@
echo Libs: $(LINKERFLAG)-lgtkdgl-$(MAJOR) >> $@
echo Requires: gtkd-$(MAJOR), gtkglext-1.0 >> $@
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) >> $@
echo Requires: gtkd-$(MAJOR), gtksourceview-4.0 >> $@
gstreamerd-$(MAJOR).pc:
echo Name: GstreamerD > $@
echo Description: A D binding and OO wrapper for Gstreamer. >> $@
echo Version: $(GTKD_VERSION) >> $@
echo Libs: $(LINKERFLAG)-lgstreamerd-$(MAJOR) >> $@
echo Requires: gtkd-$(MAJOR), gstreamer-1.0, gstreamer-base-1.0 >> $@
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) >> $@
echo Requires: gtkd-$(MAJOR), vte-2.91 >> $@
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) >> $@
echo Requires: gtkd-$(MAJOR), libpeas-1.0, libpeas-gtk-1.0 >> $@
#######################################################################
ifeq ("$(OS)","Darwin")
install: install-gtkd
install-headers: install-headers-gtkd
install-shared: install-shared-gtkd
else
install: install-gtkd install-gtkdsv install-gstreamer install-vte install-peas
install-headers: install-headers-gtkd install-headers-gtkdsv install-headers-gstreamer install-headers-vte install-headers-peas
install-shared: install-shared-gtkd install-shared-gtkdsv install-shared-gstreamer install-shared-vte install-shared-peas
endif
install-gtkd: $(LIBNAME_GTKD) install-headers-gtkd
install -d $(DESTDIR)$(prefix)/$(libdir)
install -m 644 $(LIBNAME_GTKD) $(DESTDIR)$(prefix)/$(libdir)
install-gtkdgl: $(LIBNAME_GTKDGL) install-gtkd install-headers-gtkdgl
install -m 644 $(LIBNAME_GTKDGL) $(DESTDIR)$(prefix)/$(libdir)
install-gtkdsv: $(LIBNAME_GTKDSV) install-gtkd install-headers-gtkdsv
install -m 644 $(LIBNAME_GTKDSV) $(DESTDIR)$(prefix)/$(libdir)
install-gstreamer: $(LIBNAME_GSTREAMERD) install-gtkd install-headers-gstreamer
install -m 644 $(LIBNAME_GSTREAMERD) $(DESTDIR)$(prefix)/$(libdir)
install-vte: $(LIBNAME_VTED) install-gtkd install-headers-vte
install -m 644 $(LIBNAME_VTED) $(DESTDIR)$(prefix)/$(libdir)
install-peas: $(LIBNAME_PEASD) install-gtkd install-headers-peas
install -m 644 $(LIBNAME_PEASD) $(DESTDIR)$(prefix)/$(libdir)
install-shared-gtkd: $(SONAME_GTKD)
install -d $(DESTDIR)$(prefix)/$(libdir)
$(install-so)
install-shared-gtkdgl: $(SONAME_GTKDGL) install-shared-gtkd
$(install-so)
install-shared-gtkdsv: $(SONAME_GTKDSV) install-shared-gtkd
$(install-so)
install-shared-gstreamer: $(SONAME_GSTREAMERD) install-shared-gtkd
$(install-so)
install-shared-vte: $(SONAME_VTED) install-shared-gtkd
$(install-so)
install-shared-peas: $(SONAME_PEASD) install-shared-gtkd
$(install-so)
install-headers-gtkd: gtkd-$(MAJOR).pc
install -d $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)
install -d $(DESTDIR)$(prefix)/$(pkgconfigdir)
(cd generated/gtkd; echo $(SOURCES_GTKD) | sed -e s,generated/gtkd/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
install -m 644 gtkd-$(MAJOR).pc $(DESTDIR)$(prefix)/$(pkgconfigdir)
install-headers-gtkdgl: gtkdgl-$(MAJOR).pc install-headers-gtkd
(cd generated/gtkdgl; echo $(SOURCES_GTKDGL) | sed -e s,generated/gtkdgl/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
install -m 644 gtkdgl-$(MAJOR).pc $(DESTDIR)$(prefix)/$(pkgconfigdir)
install-headers-gtkdsv: gtkdsv-$(MAJOR).pc install-headers-gtkd
(cd generated/sourceview; echo $(SOURCES_GTKDSV) | sed -e s,generated/sourceview/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
install -m 644 gtkdsv-$(MAJOR).pc $(DESTDIR)$(prefix)/$(pkgconfigdir)
install-headers-gstreamer: gstreamerd-$(MAJOR).pc install-headers-gtkd
(cd generated/gstreamer; echo $(SOURCES_GSTREAMERD) | sed -e s,generated/gstreamer/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
install -m 644 gstreamerd-$(MAJOR).pc $(DESTDIR)$(prefix)/$(pkgconfigdir)
install-headers-vte: vted-$(MAJOR).pc install-headers-gtkd
(cd generated/vte; echo $(SOURCES_VTED) | sed -e s,generated/vte/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
install -m 644 vted-$(MAJOR).pc $(DESTDIR)$(prefix)/$(pkgconfigdir)
install-headers-peas: peasd-$(MAJOR).pc install-headers-gtkd
(cd generated/peas; echo $(SOURCES_PEASD) | sed -e s,generated/peas/,,g | xargs tar cf -) | (cd $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR); tar xvf -)
install -m 644 peasd-$(MAJOR).pc $(DESTDIR)$(prefix)/$(pkgconfigdir)
uninstall: uninstall-gtkdgl uninstall-gtkdsv uninstall-gstreamer uninstall-vte uninstall-peas
$(foreach dir,$(shell ls generated/gtkd) , rm -rf $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)/$(dir))
rm -f $(DESTDIR)$(prefix)/$(pkgconfigdir)/gtkd-$(MAJOR).pc
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_GTKD)
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKD)
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKD).$(SO_VERSION)
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKD).$(SO_VERSION).$(MINOR).$(BUGFIX)
uninstall-gtkdgl:
$(foreach dir,$(shell ls generated/gtkdgl), rm -rf $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)/$(dir))
rm -f $(DESTDIR)$(prefix)/$(pkgconfigdir)/gtkdgl-$(MAJOR).pc
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_GTKDGL)
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDGL)
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDGL).$(SO_VERSION)
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDGL).$(SO_VERSION).$(MINOR).$(BUGFIX)
uninstall-gtkdsv:
$(foreach dir,$(shell ls generated/sourceview), rm -rf $(DESTDIR)$(prefix)/include/d/$(dir))
rm -f $(DESTDIR)$(prefix)/$(pkgconfigdir)/gtkdsv-$(MAJOR).pc
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_GTKDSV)
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDSV)
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDSV).$(SO_VERSION)
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GTKDSV).$(SO_VERSION).$(MINOR).$(BUGFIX)
uninstall-gstreamer:
$(foreach dir,$(shell ls generated/gstreamer), rm -rf $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)/$(dir))
rm -f $(DESTDIR)$(prefix)/$(pkgconfigdir)/gstreamerd-$(MAJOR).pc
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(LIBNAME_GSTREAMERD)
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GSTREAMERD)
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GSTREAMERD).$(SO_VERSION)
rm -f $(DESTDIR)$(prefix)/$(libdir)/$(SONAME_GSTREAMERD).$(SO_VERSION).$(MINOR).$(BUGFIX)
uninstall-vte:
$(foreach dir,$(shell ls generated/vte), rm -rf $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)/$(dir))
rm -f $(DESTDIR)$(prefix)/$(pkgconfigdir)/vted-$(MAJOR).pc
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)
uninstall-peas:
$(foreach dir,$(shell ls generated/peas), rm -rf $(DESTDIR)$(prefix)/include/d/gtkd-$(MAJOR)/$(dir))
rm -f $(DESTDIR)$(prefix)/$(pkgconfigdir)/peasd-$(MAJOR).pc
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)
clean:
-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)
-rm -f $(LIBNAME_GSTREAMERD) $(SONAME_GSTREAMERD) gstreamerd-$(MAJOR).pc $(OBJECTS_GSTREAMERD) $(PICOBJECTS_GSTREAMERD)
-rm -f $(LIBNAME_VTED) $(SONAME_VTED) vted-$(MAJOR).pc $(OBJECTS_VTED) $(PICOBJECTS_VTED)
-rm -f $(LIBNAME_PEASD) $(SONAME_PEASD) peasd-$(MAJOR).pc $(OBJECTS_PEASD) $(PICOBJECTS_PEASD)
-rm -f $(BINNAME_DEMO) $(OBJECTS_DEMO) $(SONAME_GTKD).$(SO_VERSION)
-$(MAKE) -C wrap clean
#######################################################################
define make-lib
$(AR) rcs $@ $(subst $(LIBNAME_GTKD),,$^)
$(RANLIB) $@
endef
define make-shared-lib
$(if $(filter-out "Darwin","$(OS)"), $(if $(findstring "dmd","$(DC)"),$(eval LDFLAGS+=-defaultlib=:libphobos2.so)))
$(if $(findstring "gdc","$(DC)"),$(eval LDFLAGS+=-shared-libphobos))
$(if $(findstring "ldc","$(DC)"),$(eval LDFLAGS+=-link-defaultlib-shared))
$(DC) -shared $(output) $(LDFLAGS) $1 $(SONAME) $(subst $(SONAME_GTKD),,$^)
endef
define install-so
install -m 755 $< $(DESTDIR)$(prefix)/$(libdir)/$<.$(SO_VERSION).$(MINOR).$(BUGFIX)
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) $<
endef