-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
153 lines (115 loc) · 4.53 KB
/
Makefile
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
VALAC = valac
PACKAGES ?= --all
GENERATOR_OPTS ?= --disable-devhelp --skip-existing
VALAC_VERSION := $(shell vala --api-version | awk -F. '{ print "0."$$2 }')
VAPIDIR := $(shell pkg-config --variable vapidir libvala-$(VALAC_VERSION))
VALAFLAGS = -g -X -w
PREFIX = "stable"
INSTALL_DIR ?= /usr/local/share/devhelp/books
.PHONY: install
default: generator libdoclet.so update-girs configgen valadoc-example-gen valadoc-example-tester
datadir := $(shell dirname $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
clean:
$(RM) documentation/*/wiki/example-listing.valadoc
$(RM) documentation/*/wiki/example-listing-*.valadoc
$(RM) documentation/*/wiki/widget-gallery.valadoc
$(RM) documentation/*/wiki/devhelp-index.valadoc
$(RM) documentation/*/wiki/index.valadoc
$(RM) -r documentation/*/gallery-images
$(RM) -r documentation/*/gir-images
$(RM) examples/*-examples.valadoc
$(RM) -r sphinx/storage
$(RM) valadoc-example-tester
$(RM) valadoc-example-gen
$(RM) configgen
$(RM) generator
$(RM) -r extra-vapis
$(RM) -r girs
$(RM) -r tmp
$(RM) *.so
$(RM) LOG
valadoc-example-gen: src/valadoc-example-parser.vala src/valadoc-example-gen.vala
$(VALAC) $(VALAFLAGS) -o $@ $^
valadoc-example-tester: src/valadoc-example-parser.vala src/valadoc-example-tester.vala
$(VALAC) $(VALAFLAGS) -o $@ $^
DOCLET_DEPS = gee-0.8 valadoc-$(VALAC_VERSION)
DOCLET_VALAFLAGS := $(patsubst %,--pkg=%,$(DOCLET_DEPS))
DOCLET_CFLAGS := $(shell pkg-config --cflags --libs $(DOCLET_DEPS)) -shared -fPIC -w
libdoclet.so: src/doclet.vala src/linkhelper.vala
$(VALAC) $(VALAFLAGS) $(DOCLET_VALAFLAGS) -C $^
$(CC) $(DOCLET_CFLAGS) -o $@ $(patsubst %.vala,%.c,$^)
$(RM) $(patsubst %.vala,%.c,$^)
GENERATOR_DEPS = gee-0.8 valadoc-$(VALAC_VERSION) gio-2.0
GENERATOR_VALAFLAGS := $(patsubst %,--pkg=%,$(GENERATOR_DEPS)) --enable-experimental
generator: src/doclet.vala src/linkhelper.vala src/generator.vala
$(VALAC) $(VALAFLAGS) $(GENERATOR_VALAFLAGS) -o $@ $^
configgen: src/configgen.vala
$(VALAC) $(VALAFLAGS) -o $@ $^ -X -D -X datadir=\"$(datadir)\" --vapidir src/ --pkg config --enable-experimental
update-girs:
[ -d girs ] && git -C girs pull || git clone https://github.com/nemequ/vala-girs.git girs --depth 1
[ -d extra-vapis ] && git -C extra-vapis pull || git clone https://gitlab.gnome.org/GNOME/vala-extra-vapis.git extra-vapis --depth 1
#
# Example checks:
#
check-examples: valadoc-example-tester
./valadoc-example-tester --keep-running --force \
examples/cairo/cairo.valadoc.examples \
examples/gee-0.8/gee-0.8.valadoc.examples \
examples/gio-2.0/gio-2.0.valadoc.examples \
examples/glib-2.0/glib-2.0.valadoc.examples \
examples/gmodule-2.0/gmodule-2.0.valadoc.examples \
examples/gmodule-2.0/gmodule-2.0.valadoc.examples \
examples/gobject-2.0/gobject-2.0.valadoc.examples \
examples/gstreamer-1.0/gstreamer-1.0.valadoc.examples \
examples/gstreamer-video-1.0/gstreamer-video-1.0.valadoc.examples \
examples/gtk+-3.0/gtk+-3.0.valadoc.examples \
examples/json-glib-1.0/json-glib-1.0.valadoc.examples \
examples/libnotify/libnotify.valadoc.examples \
examples/libsoup-2.4/libsoup-2.4.valadoc.examples \
examples/libxml-2.0/libxml-2.0.valadoc.examples \
examples/rest-0.7/rest-0.7.valadoc.examples \
examples/sqlite3/sqlite3.valadoc.examples
#
# Build local assets
#
build-data:
npx gulp
#
# Documentation generation:
#
build-docs: default
$(RM) -r tmp/
./generator \
--vapidir $(VAPIDIR) \
--vapidir "extra-vapis/" --vapidir "girs/vala/vapi/" \
--prefix $(PREFIX) \
--target-glib 2.98 \
--download-images \
--no-check-certificate \
$(GENERATOR_OPTS) \
$(PACKAGES)
build-docs-mini: default
make build-docs PACKAGES="glib-2.0 gio-2.0 gobject-2.0"
test-examples: valadoc-example-tester
$(RM) -r tmp/
-./valadoc-example-tester examples/*/*.valadoc.examples && $(RM) -r tmp/
#
# Run a local webserver serving valadoc.org
#
serve: build-docs build-data
FWD_SEARCH=1 FWD_TOOLTIP=1 php -S localhost:7777 -t ./valadoc.org $(PWD)/valadoc.org/router.php
serve-mini: build-docs-mini build-data
FWD_SEARCH=1 FWD_TOOLTIP=1 php -S localhost:7777 -t ./valadoc.org $(PWD)/valadoc.org/router.php
serve-search: configgen
./configgen ./valadoc.org/
mkdir -p ./sphinx/storage
indexer --config ./sphinx.conf --all
searchd --config sphinx.conf
.PHONY: install
install:
$(shell mkdir -p $(INSTALL_DIR));
$(foreach package, $(shell ls ./valadoc.org/*/*.tar.bz2), $(shell tar -xf $(package) -C $(INSTALL_DIR));)
#for package in `ls ./valadoc.org/*/*.tar.bz2`; do \
# echo $package; \
# tar -xf $package -C $INSTALL_DIR; \
# done; \