forked from daisy/pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
300 lines (249 loc) · 11.6 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
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
.PHONY : all
all : check dist
MVN_WORKSPACE := .maven-workspace
MVN_CACHE := .maven-cache
# -----------------------------------
TARGET_DIR := .make-target
MVN_SETTINGS := settings.xml
MVN_PROPERTIES := -Dworkspace="$(CURDIR)/$(MVN_WORKSPACE)" \
-Dcache="$(CURDIR)/$(MVN_CACHE)" \
-Dorg.ops4j.pax.url.mvn.localRepository="$(CURDIR)/$(MVN_WORKSPACE)" \
-Dorg.daisy.org.ops4j.pax.url.mvn.settings="$(CURDIR)/settings.xml"
MVN_RELEASE_CACHE_REPO := $(MVN_CACHE)
GRADLE := $(CURDIR)/libs/dotify/dotify.api/gradlew
ifneq ($(MAKECMDGOALS), dump-maven-cmd)
ifneq ($(MAKECMDGOALS), dump-gradle-cmd)
ifneq ($(MAKECMDGOALS), clean-website)
include .make/main.mk
endif
endif
endif
# -----------------------------------
.PHONY : dist
dist: dist-dmg dist-exe dist-zip-linux dist-zip-minimal dist-deb dist-rpm dist-webui-deb dist-webui-rpm
.PHONY : dist-dmg
dist-dmg : assembly/.dependencies | .maven-init
cd assembly && \
$(MVN) clean package -Pmac | $(MVN_LOG)
mv assembly/target/*.dmg .
.PHONY : dist-exe
dist-exe : assembly/.dependencies | .maven-init
cd assembly && \
$(MVN) clean package -Pwin | $(MVN_LOG)
mv assembly/target/*.exe .
.PHONY : dist-zip-linux
dist-zip-linux : assembly/.dependencies | .maven-init
cd assembly && \
$(MVN) clean package -Plinux | $(MVN_LOG)
mv assembly/target/*.zip .
.PHONY : dist-zip-minimal
dist-zip-minimal : assembly/.dependencies | .maven-init
cd assembly && \
$(MVN) clean package -Pminimal | $(MVN_LOG)
mv assembly/target/*.zip .
.PHONY : dist-deb
dist-deb : assembly/.dependencies | .maven-init
cd assembly && \
$(MVN) clean package -Pdeb | $(MVN_LOG)
mv assembly/target/*.deb .
.PHONY : dist-rpm
dist-rpm : assembly/.dependencies | .maven-init
if [ -f /etc/redhat-release ]; then \
cd assembly && \
$(MVN) clean package -Prpm | $(MVN_LOG) && \
mv assembly/target/rpm/pipeline2/RPMS/*/*.rpm .; \
else \
echo "Skipping RPM because not running RedHat/CentOS"; \
fi
.PHONY : dist-docker-image
dist-docker-image : dist-zip-linux
cd assembly && \
$(MAKE) docker
.PHONY : dist-webui-deb
dist-webui-deb : assembly/.dependencies
# see webui README for instructions on how to make a signed package for distribution
cd webui && \
./activator clean debian:packageBin | $(MVN_LOG)
mv webui/target/*deb .
.PHONY : dist-webui-rpm
dist-webui-rpm : assembly/.dependencies
# see webui README for instructions on how to make a signed package for distribution
cd webui && \
./activator clean rpm:packageBin
mv webui/target/rpm/RPMS/noarch/*.rpm .
.PHONY : run
run : assembly/target/dev-launcher/bin/pipeline2
$<
.PHONY : run-gui
run-gui : assembly/target/dev-launcher/bin/pipeline2
$< gui
.PHONY : run-webui
run-webui : # webui/.dependencies
if [ ! -d webui/dp2webui ]; then cp -r webui/dp2webui-cleandb webui/dp2webui ; fi
cd webui && \
./activator run
.PHONY : run-docker
run-docker : dist-docker-image
cd assembly && \
docker run --name pipeline --detach \
-e PIPELINE2_WS_HOST=0.0.0.0 \
-p 8181:8181 daisyorg/pipeline2
.PHONY : check
.PHONY : release
release : assembly/.release
.PHONY : $(addprefix check-,$(MODULES))
$(addprefix check-,$(MODULES)) : check-% : %/.last-tested
assembly/target/dev-launcher/bin/pipeline2 : assembly/pom.xml assembly/.dependencies $(call rwildcard,assembly/src/main/,*) | .maven-init
cd assembly && \
$(MVN) clean package -Pdev-launcher | $(MVN_LOG)
rm assembly/target/dev-launcher/etc/*windows*
if [ "$$(uname)" == Darwin ]; then \
rm assembly/target/dev-launcher/etc/*linux*; \
else \
rm assembly/target/dev-launcher/etc/*mac*; \
fi
.SECONDARY : cli/.install.zip
cli/.install.zip : cli/.install
cli/.install : cli/cli/*.go
updater/cli/.install : updater/cli/*.go
.SECONDARY : libs/jstyleparser/.install-sources.jar
libs/jstyleparser/.install-sources.jar : libs/jstyleparser/.install
modules/scripts/dtbook-to-odt/.install-doc.jar : $(call rwildcard,modules/scripts/dtbook-to-odt/src/test/,*)
.SECONDARY : \
modules/braille/liblouis-utils/liblouis-native/.install-mac.jar \
modules/braille/liblouis-utils/liblouis-native/.install-linux.jar \
modules/braille/liblouis-utils/liblouis-native/.install-windows.jar
modules/braille/liblouis-utils/liblouis-native/.install-mac.jar \
modules/braille/liblouis-utils/liblouis-native/.install-linux.jar \
modules/braille/liblouis-utils/liblouis-native/.install-windows.jar: \
modules/braille/liblouis-utils/liblouis-native/.install
.SECONDARY : .dependencies-init
.dependencies-init :
echo "Recomputing dependencies between modules..." >&2
$(addsuffix /.deps.mk,$(MODULES)) .maven-deps.mk \
$(SUPER_BUILD_SCRIPT_TARGET_DIR)/effective-pom.xml \
$(SUPER_BUILD_SCRIPT_TARGET_DIR)/maven-modules : | .dependencies-init
.maven-init : | $(MVN_WORKSPACE)
# the purpose of the test is for making "make -B" not affect this rule (to speed thing up)
$(MVN_WORKSPACE) :
if ! [ -e $(MVN_WORKSPACE) ]; then \
mkdir -p $(MVN_CACHE) && \
cp -r $(MVN_CACHE) $@; \
fi
.PHONY : cache
cache :
if [ -e $(MVN_WORKSPACE) ]; then \
echo "Caching downloaded artifacts..." >&2 && \
rm -rf $(MVN_CACHE) && \
rsync -mr --exclude "*-SNAPSHOT" --exclude "maven-metadata-*.xml" $(MVN_WORKSPACE)/ $(MVN_CACHE); \
fi
clean : cache clean-workspace clean-old clean-website
.PHONY : clean-workspace
clean-workspace :
rm -rf $(MVN_WORKSPACE)
# clean files generated by previous versions of this Makefile
.PHONY : clean-old
clean-old :
rm -f .maven-modules
rm -f .effective-pom.xml
rm -f .gradle-pom.xml
rm -f .maven-build.mk
find . -name .build.mk -exec rm -r "{}" \;
find * -name .maven-to-install -exec rm -r "{}" \;
find * -name .maven-to-test -exec rm -r "{}" \;
find * -name .maven-to-test-dependents -exec rm -r "{}" \;
find * -name .maven-snapshot-dependencies -exec rm -r "{}" \;
find * -name .maven-effective-pom.xml -exec rm -r "{}" \;
find * -name .maven-dependencies-to-install -exec rm -r "{}" \;
find * -name .maven-dependencies-to-test -exec rm -r "{}" \;
find * -name .maven-dependencies-to-test-dependents -exec rm -r "{}" \;
find * -name .gradle-to-test -exec rm -r "{}" \;
find * -name .gradle-snapshot-dependencies -exec rm -r "{}" \;
find * -name .gradle-dependencies-to-install -exec rm -r "{}" \;
find * -name .gradle-dependencies-to-test -exec rm -r "{}" \;
.PHONY : gradle-clean
gradle-clean :
$(GRADLE) clean
PHONY : $(addprefix eclipse-,$(MODULES))
$(addprefix eclipse-,$(MODULES)) : eclipse-% : %/.project
TEMP_REPOS := modules/scripts/dtbook-to-daisy3/target/test/local-repo
.PHONY : go-offline
go-offline :
if [ -e $(MVN_WORKSPACE) ]; then \
for repo in $(TEMP_REPOS); do \
if [ -e $$repo ]; then \
rsync -mr --exclude "*-SNAPSHOT" --exclude "maven-metadata-*.xml" $$repo/ $(MVN_WORKSPACE); \
fi \
done \
fi
.PHONY : checked
checked :
touch $(addsuffix /.last-tested,$(MODULES))
website/target/maven/pom.xml : $(addprefix website/src/_data/,modules.yml api.yml versions.yml)
cd website && \
$(MAKE) target/maven/pom.xml
export MVN_OPTS = --settings '$(CURDIR)/settings.xml' -Dworkspace='$(CURDIR)/$(MVN_WORKSPACE)' -Dcache='$(CURDIR)/$(MVN_CACHE)' -Pstaged-releases
$(addprefix website/target/maven/,javadoc doc sources xprocdoc) : website/target/maven/.deps.mk website/target/maven/.dependencies
rm -rf $@
cd website && \
target=$@ && \
$(MAKE) $${target#website/}
.PHONY : website
website : | $(addprefix website/target/maven/,javadoc doc sources xprocdoc)
cd website && \
make
.PHONY : serve-website
serve-website : | $(addprefix website/target/maven/,javadoc doc sources xprocdoc)
cd website && \
$(MAKE) serve
.PHONY : publish-website
publish-website : | $(addprefix website/target/maven/,javadoc doc sources xprocdoc)
cd website && \
$(MAKE) publish
.PHONY : clean-website
clean-website :
cd website && \
$(MAKE) clean
.PHONY : dump-maven-cmd
dump-maven-cmd :
echo "mvn () { $(shell dirname "$$(which mvn)")/mvn --settings \"$(CURDIR)/$(MVN_SETTINGS)\" $(MVN_PROPERTIES) \"\$$@\"; }"
echo '# Run this command to configure your shell: '
echo '# eval $$(make $@)'
.PHONY : dump-gradle-cmd
dump-gradle-cmd :
echo M2_HOME=$(CURDIR)/$(SUPER_BUILD_SCRIPT_TARGET_DIR)/.gradle-settings $(GRADLE) $(MVN_PROPERTIES)
.PHONY : help
help :
echo "make all:" >&2
echo " Incrementally compile and test code and package into a DMG, a EXE, a ZIP (for Linux), a DEB and a RPM" >&2
echo "make check:" >&2
echo " Incrementally compile and test code" >&2
echo "make dist:" >&2
echo " Incrementally compile code and package into a DMG, a EXE, a ZIP (for Linux), a DEB and a RPM" >&2
echo "make dist-dmg:" >&2
echo " Incrementally compile code and package into a DMG" >&2
echo "make dist-exe:" >&2
echo " Incrementally compile code and package into a EXE" >&2
echo "make dist-zip-linux:" >&2
echo " Incrementally compile code and package into a ZIP (for Linux)" >&2
echo "make dist-deb:" >&2
echo " Incrementally compile code and package into a DEB" >&2
echo "make dist-rpm:" >&2
echo " Incrementally compile code and package into a RPM" >&2
echo "make dist-webui-deb:" >&2
echo " Compile Web UI and package into a DEB" >&2
echo "make dist-webui-rpm:" >&2
echo " Compile Web UI and package into a RPM" >&2
echo "make run:" >&2
echo " Incrementally compile code and run locally" >&2
echo "make run-gui:" >&2
echo " Incrementally compile code and run GUI locally" >&2
echo "make run-webui:" >&2
echo " Compile and run web UI locally" >&2
echo "make website:" >&2
echo " Build the website" >&2
echo "make dump-maven-cmd:" >&2
echo ' Get the Maven command used. To configure your shell: eval $$(make dump-maven-cmd)' >&2
ifndef VERBOSE
.SILENT:
endif