chiark / gitweb /
changelog: document further make-release changes
[otter.git] / Makefile
1 # Copyright 2020-2021 Ian Jackson and contributors to Otter
2 # SPDX-License-Identifier: AGPL-3.0-or-later
3 # There is NO WARRANTY.
4
5 # make -j8
6 # make -j8 release
7 # make -j8 shapelib
8
9 SHELL=/bin/bash
10 src=.
11
12 default: all check
13 all: debug
14 full-check: all check cargo-syntaxcheck-release shapelib doc-sphinx
15 full-check: for-deploy release
16 everything: debug doc release check bundled-sources
17
18 shapelib: templates/shapelib.html docs/html/index.html
19         @echo 'Shape library preview and docs can now be found here:'
20         @for f in $^; do echo '  file://$(PWD)/'$$f; done
21
22 MAKEFILE_DEP ?= Makefile
23 MAKEFILE_FIND_X ?=
24 # ^ set this to "x" to debug the $rsrcs rune
25
26 #---------- funky macros etc. ----------
27
28 cr = $(addprefix --,$(filter-out debug,$1))
29 rsrcs = $(shell $(foreach x,$(MAKEFILE_FIND_X),set -$x;)\
30     find -H $1 \( -name Cargo.toml -o -name Cargo.lock -o -name Cargo.lock.example -o -name \*.rs \) \! -path '*/build/*' )
31 stamp=@mkdir -p stamp; touch $@
32
33 BUNDLED_SOURCES_LIT = README.md LICENCE
34 BUNDLED_SOURCES_FILES = index.html $(BUNDLED_SOURCES_LIT)
35 BUNDLED_SOURCES_LINKS += $(BUNDLED_SOURCES_LIT) otter/
36 BUNDLED_SOURCES += $(BUNDLED_SOURCES_FILES)
37
38 #---------- programs and config variables ----------
39
40 TARGET_DIR ?= target
41
42 WASM_BINDGEN = $(TARGET_DIR)/debug/wasm-bindgen
43 WASM_BINDGEN_OPTIONS =                                          \
44         --remove-name-section --remove-producers-section        \
45         --typescript
46
47 BUNDLE_SOURCES ?= bundle-rust-sources
48
49 SPHINXBUILD   ?= sphinx-build
50
51 ifndef INKSCAPE_EXTENSIONS
52 INKSCAPE ?= inkscape
53 INKSCAPE_SDD_QUIETEN ?= 2>/dev/null
54 # inkscape 0.92.4: --extension-directory works, no --system-data-directory
55 # inkscape 1.0.2: --system-data-directory, no --extension-directory
56 INKSCAPE_EXTENSIONS := $(shell set -e; { sdd=$$( $(INKSCAPE) --system-data-directory $(INKSCAPE_SDD_QUIETEN) ) && echo "$$sdd/extensions"; } || $(INKSCAPE) --extension-directory )
57 endif
58 RECOLOUR_SVG ?= ./run-inkscape-extension $(INKSCAPE_EXTENSIONS)/color_replace.py
59
60 DEPLOY_ARCH=x86_64-unknown-linux-musl
61 DEPLOY_RELEASE=release
62 DEPLOY_TARGET_DIR=$(TARGET_DIR)/$(addsuffix /,$(DEPLOY_ARCH))$(DEPLOY_RELEASE)
63 DEPLOYED_BRANCH=deployed
64 PUBLISHED_BRANCH=published
65
66 RUST_CLIPPY_OPTIONS ?= $(shell perl -pe 's/\#.*//; s/\n/ /' clippy-options)
67 RUST_CLIPPY ?= clippy
68 RUST_CLIPPY_CMD := clippy $(RUST_CLIPPY_OPTIONS)
69
70 #---------- nailing-cargo ----------
71
72 ifneq (,$(wildcard ../Cargo.nail))
73
74 NAILING_CARGO ?= nailing-cargo
75 CARGO_CMD ?= $(NAILING_CARGO)
76 BUILD_SUBDIR ?= ../Build
77 TARGET_DIR = $(BUILD_SUBDIR)/$(notdir $(PWD))/target
78
79 NAILING_CARGO_JUST_RUN ?= $(NAILING_CARGO) --just-run -q ---
80 BUNDLE_SOURCES_CMD ?= $(NAILING_CARGO) --- $(BUNDLE_SOURCES)
81 USVG_CMD ?= $(NAILING_CARGO_JUST_RUN) $(USVG)
82 WASM_BINDGEN_CLI_CARGO_OPTS ?= --subcommand-props=!manifest-path
83
84 CARGO_DOCUMENT_PRIVATE_ITEMS ?= --document-private-items
85 CARGO_DOC_OPTS += $(CARGO_DOCUMENT_PRIVATE_ITEMS)
86
87 clean-nailing:
88         $(NAILING_CARGO_JUST_RUN) \
89  sh -c 'cd "$1"; find -mindepth 1 -maxdepth 1 -print0 | xargs -0r rm -rf --' \
90                 $(abspath $(BUILD_SUBDIR)/$(notdir $(PWD)))
91
92 else
93 CARGO_CMD ?= cargo
94 clean-nailing:
95 endif # Cargo.nail
96
97 BUILD_SUBDIR ?= ../Build
98 BUNDLE_SOURCES_CMD ?= $(BUNDLE_SOURCES)
99 USVG_CMD ?= $(USVG)
100
101 WASM_PACKED=$(TARGET_DIR)/packed-wasm
102
103 #---------- local programs ----------
104
105 define lp
106 stamp/cargo.$2: $(call rsrcs, ! -name \*.rs)
107         $$(CARGO) build $(call cr,$3) -p $2
108         $$(stamp)
109 $1 := $(abspath $(TARGET_DIR)/$3/$4)
110 endef
111
112 $(eval $(call lp,BUNDLE_SOURCES,bundle-sources,debug,bundle-rust-sources))
113 $(eval $(call lp,USVG,usvg,release,usvg))
114
115 #---------- variables defining bits of source etc. ----------
116
117 PROGRAMS=daemon-otter otter
118
119 WASM_ASSETS := $(addprefix otter_wasm,.js _bg.wasm)
120 WASM_OUTPUTS := $(addprefix otter_wasm,.d.ts)
121
122 TS_SRCS= script
123 TS_SRC_FILES= \
124         $(addprefix templates/,$(addsuffix .ts,$(TS_SRCS))) \
125         webassembly-types/webassembly.d.ts \
126         $(WASM_PACKED)/otter_wasm.d.ts
127
128 LITFILES= LICENCE AGPLv3
129 TXTFILES= CC-BY-SA-3.0 CC-BY-SA-4.0
130
131 NWTEMPLATEASSETS = nwtemplates/die-overlay.tera
132 FILEASSETS =    $(addprefix templates/, libre shapelib.html script.js \
133                         $(LITFILES) $(TXTFILES)) \
134                 $(wildcard templates/*.tera) \
135                 $(NWTEMPLATEASSETS)
136
137 WASM := wasm32-unknown-unknown
138 # ^ todo: Is this still right after
139 #     Use correct ABI for wasm32 by default
140 #     https://github.com/rust-lang/rust/pull/79998
141 # ?  But maybe it doesn't matter since we're very conservative and
142 # only pass JsValue and a few strings across the WASM ABI.
143
144 RUST_NIGHTLY_VERSION ?= +nightly
145 CARGO = $(CARGO_CMD) $(RUST_VERSION)
146
147 #---------- toplevel aggregate targets ----------
148
149 check: stamp/cargo.debug-check at wdt jstest
150         @echo 'Tests passed.'
151
152 full-check: stamp/cargo.release-check
153 full-check: stamp/cargo.release-miri stamp/cargo.debug-miri
154
155 full-check:
156         @echo 'Full tests passed.'
157
158 doc: cargo-doc doc-sphinx examples
159
160 debug release:: %: stamp/cargo.% assets libraries extra-%
161
162 cargo: cargo-debug cargo-wasm-release
163
164 cargo-debug cargo-release cargo-check cargo-doc \
165 cargo-wasm-debug cargo-wasm-release:: \
166 cargo-%: stamp/cargo.%
167
168 EXAMPLE_BUNDLES = test-bundle big-bundle
169 EXAMPLE_BUNDLE_FILES = $(foreach f, $(EXAMPLE_BUNDLES), examples/$f.zip)
170
171 examples: $(EXAMPLE_BUNDLE_FILES)
172 .PHONY: examples
173
174 cargo-wasm: cargo-wasm-release
175
176 wasm: stamp/wasm-bindgen
177
178 assets: js stamp/wasm-bindgen $(FILEASSETS)
179
180 js: templates/script.js
181
182 extra-debug:
183 extra-release: bundled-sources
184
185 cargo-syntaxcheck: cargo-syntaxcheck-host cargo-syntaxcheck-wasm
186 cargo-syntaxcheck-host:
187         $(CARGO) check --workspace
188 cargo-syntaxcheck-wasm:
189         $(CARGO) check --target $(WASM) -p otter-wasm --release
190 cargo-syntaxcheck-release:
191         $(CARGO) check --workspace --release
192
193 cargo-clippy: cargo-clippy-host cargo-clippy-wasm
194 cargo-clippy-host: clippy-options
195         $(CARGO) $(RUST_CLIPPY) --workspace $(RUST_CLIPPY_OPTIONS)
196 cargo-clippy-wasm: clippy-options
197         $(CARGO) $(RUST_CLIPPY) --target $(WASM) -p otter-wasm $(RUST_CLIPPY_OPTIONS)
198
199 #---------- cargo ----------
200
201 DR=debug release
202 CARGOES=$(foreach t, wasm-,$(addprefix $t,check $(DR)))
203
204 $(addprefix stamp/cargo.,$(DR)):: \
205 stamp/cargo.%: $(call rsrcs,. ! -path './wasm/*')
206         $(CARGO) build --workspace $(call cr,$*) -p otter -p otter-daemon -p otter-cli
207         $(NAILING_CARGO_JUST_RUN) \
208         ln -sf otter $(abspath $(TARGET_DIR))/$*/otter-ssh-proxy
209         $(stamp)
210
211 $(TARGET_DIR)/debug/%: $(call rsrcs, ! -path './wasm/*')
212         $(CARGO) build --workspace -p otter-cli
213         $(NAILING_CARGO_JUST_RUN) touch $(abspath $@)
214
215 stamp/cargo.wasm-bindgen: $(call rsrcs, ! -name \*.rs)
216         $(CARGO_CMD) $(WASM_BINDGEN_CLI_CARGO_OPTS) $(RUST_VERSION) \
217                 build --target-dir=target \
218                 --manifest-path=$(abspath wasm/Cargo.toml) -p wasm-bindgen-cli
219         $(stamp)
220
221 stamp/cargo.%-check: $(call rsrcs,.)
222         $(CARGO) test --workspace $(call cr,$*)
223         $(stamp)
224
225 stamp/cargo.%-miri: $(call rsrcs,.)
226         $(CARGO_CMD) $(RUST_NIGHTLY_VERSION) \
227                 miri test --workspace $(call cr,$*)
228         $(stamp)
229
230 stamp/cargo-at.debug: $(call rsrcs,.)
231         $(CARGO) build --workspace $(call cr,$*) -p otter-api-tests
232         $(stamp)
233
234 stamp/cargo-wdt.debug: $(call rsrcs,.)
235         $(CARGO) build --workspace $(call cr,$*) -p otter-webdriver-tests
236         $(stamp)
237
238 stamp/cargo-jstest.debug: $(call rsrcs,.)
239         $(CARGO) build --workspace $(call cr,$*) -p otter-nodejs-tests
240         $(stamp)
241
242 stamp/cargo.doc: $(call rsrcs,.)
243         set -o pipefail -e; \
244         $(CARGO) doc $(CARGO_DOC_OPTS) --workspace 2>&1 \
245                 |egrep -vf .cargo-doc-suppress-errors
246         $(stamp)
247
248 $(addprefix stamp/cargo.wasm-,$(DR)):: \
249 stamp/cargo.wasm-%: $(call rsrcs, base wasm Cargo.*)
250         $(CARGO) build --target $(WASM) -p otter-wasm $(call cr,$*)
251         $(stamp)
252
253 stamp/cargo.deploy-build: $(call rsrcs,.)
254         $(CARGO) build --target $(DEPLOY_ARCH) $(call cr,$(DEPLOY_RELEASE)) -p otter -p otter-cli -p otter-daemon -p usvg
255         $(NAILING_CARGO_JUST_RUN) \
256         ln -sf otter $(abspath $(TARGET_DIR)/$(DEPLOY_ARCH))/$(DEPLOY_RELEASE)/otter-ssh-proxy
257         $(stamp)
258
259 #---------- sphnix ----------
260
261 doc-sphinx:     docs/html/index.html \
262         $(foreach f, $(EXAMPLE_BUNDLES), docs/html/examples/$f.zip) \
263         $(addprefix docs/html/examples/, $(notdir $(wildcard specs/*.toml)))
264         @echo 'Documentation can now be found here:'
265         @echo '  file://$(PWD)/$<'
266
267 docs/html/index.html: docs/conf.py $(wildcard docs/*.md docs/*.rst docs/*.png)
268         $(SPHINXBUILD) -M html docs docs $(SPHINXOPTS)
269
270 docs/html/examples/%.zip: examples/%.zip
271         mkdir -p docs/html/examples
272         rm -f $@ && ln $< $@
273
274 docs/html/examples/%.toml: specs/%.toml
275         mkdir -p docs/html/examples
276         rm -f $@ && ln $< $@
277
278 #---------- jstest ----------
279
280 JSTESTS= basic lower
281
282 .PHONY: jstest
283 jstest jstests: $(foreach t,$(JSTESTS),stamp/$t.jstest)
284
285 stamp/%.jstest: jstest/run1 jstest/%.nodejs templates/script.js \
286                 stamp/wasm-bindgen-jstest stamp/cargo-jstest.debug
287         $(NAILING_CARGO_JUST_RUN) $(abspath $(filter-out stamp/%,$^))
288         $(stamp)
289
290 #---------- wasm ----------
291
292 $(addprefix $(WASM_PACKED)/,$(WASM_ASSETS) $(WASM_OUTPUTS)): stamp/wasm-bindgen
293 stamp/wasm-bindgen: stamp/cargo.wasm-bindgen stamp/cargo.wasm-release
294         $(NAILING_CARGO_JUST_RUN) $(abspath $(WASM_BINDGEN)) \
295                 $(WASM_BINDGEN_OPTIONS) --no-modules \
296                 --out-dir target/packed-wasm \
297                 target/$(WASM)/release/otter_wasm.wasm
298         $(stamp)
299
300 stamp/wasm-bindgen-jstest: stamp/cargo.wasm-bindgen stamp/cargo.wasm-release
301         $(NAILING_CARGO_JUST_RUN) $(abspath $(WASM_BINDGEN)) \
302                 $(WASM_BINDGEN_OPTIONS) --nodejs \
303                 --out-dir target/jstest \
304                 target/$(WASM)/release/otter_wasm.wasm
305         $(stamp)
306
307 #---------- bundle-sources ----------
308
309 BUNDLED_SOURCES_DIRS += otter
310
311 bundled-sources:: $(addprefix bundled-sources/, $(BUNDLED_SOURCES_DIRS))
312
313 TARGET_BUNDLED=$(TARGET_DIR)/bundled-sources
314
315 $(TARGET_BUNDLED):
316         $(NAILING_CARGO_JUST_RUN) mkdir -p $(abspath $@)
317
318 $(addprefix bundled-sources/, $(BUNDLED_SOURCES_DIRS)): \
319 bundled-sources/%: stamp/cargo.bundle-sources $(TARGET_BUNDLED)
320         set -e; d=$(abspath $(TARGET_BUNDLED)); \
321         $(if $(filter-out otter,$*), cd ../$*;) \
322         $(BUNDLE_SOURCES_CMD) --output $$d/$*
323
324 bundled-sources:: $(addprefix $(TARGET_BUNDLED)/, $(BUNDLED_SOURCES_FILES))
325
326 $(addprefix $(TARGET_BUNDLED)/, $(BUNDLED_SOURCES_LIT)): \
327 $(TARGET_BUNDLED)/%: % $(TARGET_BUNDLED)
328         $(NAILING_CARGO_JUST_RUN) cp $(abspath $(src))/$< $(abspath $@)
329
330 $(TARGET_BUNDLED)/index.html: bundled-sources-make-index \
331                 $(MAKEFILE_DEP) $(TARGET_BUNDLED)
332         $(NAILING_CARGO_JUST_RUN) sh -ec '                      \
333                 cd $(abspath $(src)); mkdir -p $(dir $@);       \
334                 ./$< >$@.tmp $(BUNDLED_SOURCES_LINKS);          \
335                 mv -f $@.tmp $@;                                \
336         '
337
338 bundled-sources::
339         @echo Bundled sources.
340
341 #---------- svg processing ----------
342
343 LIBRARIES ?= $(basename $(wildcard library/*.toml))
344 USVG_DEP = stamp/cargo.usvg src/USVG_DEFAULT_ARGS.txt
345
346 include $(addsuffix /files.make, $(LIBRARIES))
347
348 USVG_PROCESSOR = usvg-processor
349 LIBRARY_PROCESS_SVG = ./$(USVG_PROCESSOR) $@ $(wordlist 1,2,$^) '$(USVG_CMD) $(USVG_OPTIONS)'
350 $(LIBRARY_FILES): $(USVG_PROCESSOR) $(USVG_DEP) $(MAKEFILE_DEP)
351
352 # actual command for each of $(LIBRARY_FILES) is in one of the files.make
353
354 library/%/files.make: media-scraper library/%.toml
355         ./$< --offline library/$*.toml
356
357 #---------- typescript ----------
358
359 templates/%.js: tsc-wrap tsconfig.json
360         ./tsc-wrap $@ tsconfig.json $(filter %.ts,$^)
361
362 templates/script.js: $(TS_SRC_FILES) stamp/wasm-bindgen
363
364 #---------- other templates ----------
365
366 $(addprefix templates/,$(LITFILES)): templates/%: %
367         cp $< $@.new && mv -f $@.new $@
368
369 $(addprefix templates/,$(TXTFILES)): templates/%: %.txt
370         cp $< $@.new && mv -f $@.new $@
371
372 libraries: $(LIBRARY_FILES)
373
374 templates/shapelib.html: $(TARGET_DIR)/debug/otterlib $(LIBRARY_FILES) \
375                         $(NWTEMPLATEASSETS)
376         $(NAILING_CARGO_JUST_RUN) $(abspath $<) \
377         --nwtemplates $(abspath nwtemplates) \
378         --libs '$(addprefix $(PWD)/, $(addsuffix .toml, $(LIBRARIES)))' \
379                 preview >$@.tmp && mv -f $@.tmp $@
380
381 nwtemplates/die-overlay.tera: dice/overlay-template-extractor dice/die.svg
382         ./$< <dice/die.svg >$@.tmp && mv -f $@.tmp $@
383
384 library/edited/die-image-d6-_c.svg: dice/extract-image-only dice/die.svg
385         ./$< <dice/die.svg >$@.tmp && mv -f $@.tmp $@
386
387 #---------- examples ----------
388
389 EXAMPLE_BUNDLE_INPUT_DEPS := $(shell                                    \
390         cd examples/test-bundle/ && find \! \( -name '*~' -o -name '.*' \) \
391 )
392
393 examples/%.zip: $(MAKEFILE_DEP)
394         set -e; rm -f $@.tmp; cd examples/$*/; \
395         zip $(ZIPFLAGS) -DX ../$(notdir $@).tmp $(ZIP_INPUTS)
396         mv -f $@.tmp $@
397
398 examples/test-bundle.zip: ZIP_INPUTS=$(EXAMPLE_BUNDLE_INPUT_DEPS)
399 examples/test-bundle.zip: \
400  $(addprefix examples/test-bundle/, $(EXAMPLE_BUNDLE_INPUT_DEPS))
401
402 examples/big-bundle.zip: examples/big-bundle/otter.toml
403 examples/big-bundle.zip: ZIPFLAGS+= -0 -r -q
404 examples/big-bundle.zip: ZIP_INPUTS=.
405 examples/big-bundle/otter.toml: $(LIBRARY_FILES) $(MAKEFILE_DEP)
406         rm -rf examples/big-bundle
407         mkdir examples/big-bundle examples/big-bundle/library
408         @set -e; echo 'MKDIR for $@'; \
409         for l in $(LIBRARIES); do \
410                 mkdir examples/big-bundle/$$l; \
411                 perl -p \
412  -e 'BEGIN { print "# -- AUTOGENERATED FROM COPY IN OTTER SOURCE --\n" }' \
413  -e 'if (m/^\[scraper]/..0) { unless (m/^\[(?!scraper)/..0) { s/^/\#/ } }' \
414  -e 's/(?<=\s)\w\S*(?=\s)/-/ if m/^files = """/..m/^"""|^:/;' \
415                         <$$l.toml >examples/big-bundle/$$l.toml; done
416         @set -e; echo 'LN for $@'; \
417         for e in $(LIBRARY_FILE_INPUTS); do \
418                 ln $${e#*:} examples/big-bundle/$${e%%.usvg:*}.svg; done;
419         @set -e; echo 'MV for $@'; \
420         cd examples/big-bundle/library/; for x in '' .toml; do \
421                 mv wikimedia$$x duped-example$$x; done
422         @set -e; mkdir examples/big-bundle/specs/; \
423         perl -pe <specs/demo.game.toml \
424                 >examples/big-bundle/specs/Modded-spec.game.toml \
425                 's/chess-b-/chess-purple-/; s/chess-w-/chess-yellow-/'
426         @set -e; echo 'ECHO for $@'; \
427         echo 'title = "Autogenerated test bundle - do not distribute"' \
428                 >$@.tmp
429         mv -f $@.tmp $@
430
431 #---------- webdriver tests (wdt) ----------
432
433 AT_TESTS := $(basename $(notdir $(wildcard apitest/at-*.rs)))
434 WDT_TESTS := $(basename $(notdir $(wildcard wdriver/wdt-*.rs)))
435
436 WDT_LANDSCAPE_TESTS = wdt-altergame
437
438 at:     $(foreach f, $(AT_TESTS), stamp/$f.check)
439
440 wdt:    $(foreach f, $(WDT_TESTS), stamp/$f.check) \
441         $(foreach f, $(WDT_LANDSCAPE_TESTS), stamp/$f.lcheck) \
442
443 RUNTEST_DEPS =  apitest/run1 stamp/cargo.debug $(FILEASSETS) \
444                 $(wildcard specs/*.toml) examples/test-bundle.zip \
445                 $(wildcard libraries/*.toml) $(LIBRARY_FILES)
446
447 AT_DEPS =       $(filter-out templates/script.js, $(RUNTEST_DEPS)) \
448                 examples/big-bundle.zip \
449                 stamp/cargo-at.debug
450
451 WDT_DEPS =      $(RUNTEST_DEPS) wdriver/firefox-wrapper \
452                 stamp/cargo-wdt.debug
453
454 AT_WDT_RUN = $(NAILING_CARGO_JUST_RUN) $(abspath $<)
455
456 AT_RUN = $(AT_WDT_RUN) apitest --test=$(basename $(notdir $@))
457 WDT_RUN = $(AT_WDT_RUN) wdriver --test=$(basename $(notdir $@))
458
459 for-at:                 $(AT_DEPS)
460 stamp/at-%.check:       $(AT_DEPS)
461         $(AT_RUN)
462         $(stamp)
463
464 for-wdt:                $(WDT_DEPS)
465 stamp/wdt-%.check:      $(WDT_DEPS)
466         $(WDT_RUN)
467         $(stamp)
468
469 stamp/wdt-%.lcheck:     $(WDT_DEPS)
470         $(WDT_RUN) --as-if=lwdt-$* --layout=Landscape
471         $(stamp)
472
473 #---------- docs publication ----------
474
475 PUBLISH_VERSION=unreleased
476 PUBLISH_USER=ianmdlvl@login.chiark.greenend.org.uk
477 PUBLISH_DOC_SPHINX_BASE=public-html/otter
478 PUBLISH_DOC_SPHINX_TAIL=$(PUBLISH_VERSION)/docs
479 PUBLISH_DOC_SPHINX=$(PUBLISH_USER):$(PUBLISH_DOC_SPHINX_BASE)/$(PUBLISH_DOC_SPHINX_TAIL)
480
481 publish: doc-sphinx
482         ssh $(PUBLISH_USER) 'cd $(PUBLISH_DOC_SPHINX_BASE) && mkdir -p $(PUBLISH_DOC_SPHINX_TAIL)'
483         rsync -r --delete-delay docs/html/. $(PUBLISH_DOC_SPHINX)/.
484         git branch -f $(PUBLISHED_BRANCH)
485
486 publish-make-current:
487         ssh $(PUBLISH_USER) 'set -e; cd $(PUBLISH_DOC_SPHINX_BASE); rm -f current.tmp; ln -s $(PUBLISH_VERSION) current.tmp; mv -T current.tmp current'
488
489 #---------- deployment ----------
490
491 DEPLOY_USER=ian@login.chiark.greenend.org.uk
492 DEPLOY_BASE=$(DEPLOY_USER):/volatile/Otter
493 DEPLOY_FINISH=/home/Otter/etc/deploy-finish
494
495 for-deploy: stamp/cargo.deploy-build
496 deploy: for-deploy bundled-sources assets libraries
497         rsync -zvl --progress $(addprefix $(DEPLOY_TARGET_DIR)/,$(PROGRAMS) otter-ssh-proxy) $(DEPLOY_BASE)/bin/
498         rsync -zv --progress $(DEPLOY_TARGET_DIR)/usvg $(DEPLOY_BASE)/libexec/
499         rsync -rv --progress $(TARGET_DIR)/bundled-sources/. $(DEPLOY_BASE)/bundled-sources
500         rsync -r README.md $(DEPLOY_BASE)/.
501         rsync -r --delete --exclude=\*~ library specs $(DEPLOY_BASE)/.
502         rsync -r $(FILEASSETS) $(addprefix $(WASM_PACKED)/, $(WASM_ASSETS)) \
503                 $(DEPLOY_BASE)/assets/
504         rsync -r nwtemplates/*.tera $(DEPLOY_BASE)/nwtemplates/
505         ssh -o BatchMode=true $(DEPLOY_USER) $(DEPLOY_FINISH)
506         git branch -f $(DEPLOYED_BRANCH)
507         -git push origin main
508         -git push chiark main
509
510 #$(DEPLOY_BASE)/bundled-sources
511
512 #---------- clean ----------
513
514 clean-for-retest:
515         rm -f templates/script.js library/*/*.usvg stamp/*
516         rm -rf $(LIBRARY_CLEAN)
517         rm -rf examples/big-bundle examples/big-bundle.zip
518         rm -f examples/test-bundle.zip
519         find * \( -name '*~' -o -name '*.tmp' \) -print0 | xargs -0r rm --
520
521 clean: clean-nailing clean-for-retest
522         rm -rf target
523         $(NAILING_CARGO_JUST_RUN) rm -rf target