-
Notifications
You must be signed in to change notification settings - Fork 2
/
GNUmakefile
65 lines (42 loc) · 2.42 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
ORIGIN ?= https://pwa2uwp.fragara.com
HTTPGET ?= curl --fail --show-error --silent --location
UNZIP ?= $(shell command -v unzip || (command -v jar && echo xf))
.PHONY: build devserve stage deploy clean cleanall
.DELETE_ON_ERROR:
.INTERMEDIATE: dst/tile-icons.js dst/appx-manifest.js dst/package.js
DST := dst/index.html \
dst/tile-icons.html \
dst/appx-manifest.html \
dst/package.html \
dst/404.html \
dst/robots.txt \
dst/sitemap.txt \
dst/favicon.ico \
dst/apple-touch-icon.png \
dst/msft-partner-pkg.png
build: $(DST)
$(DST): | dst/
%/: ; mkdir -p $@
dst/%: src/%; cp $< $@
dst/404.html: src/404.html; <$< tr -s " \n" >$@
dst/robots.txt: ; echo "Sitemap: $(ORIGIN)/sitemap.txt" >$@
dst/sitemap.txt: ; for p in / /tile-icons.html /appx-manifest.html /package.html; do echo "$(ORIGIN)$$p"; done >$@
dst/tile-icons.html dst/appx-manifest.html dst/package.html: dst/%.html: dst/%.js src/app.css
dst/%.html: src/%.html src/site.css postprod.xsl | 3p/saxon9he.jar 3p/htmlcompressor.jar 3p/yuicompressor.jar
java -jar 3p/saxon9he.jar -s:$< -o:$@ -xsl:$(word 3,$^) basecssuri="file:$(CURDIR)/src/" basejsuri="file:$(CURDIR)/dst/" siteorigin="$(ORIGIN)"
java -jar 3p/htmlcompressor.jar --compress-css --simple-bool-attr --simple-doctype --remove-surrounding-spaces html,meta,link,style,script,noscript -o $@ $@
dst/tile-icons.js dst/package.js: src/zip.js
dst/%.js: src/%.js src/app.js | 3p/closure-compiler.jar
java -jar 3p/closure-compiler.jar --language_out ES5_STRICT --charset UTF-8 --rewrite_polyfills false --isolation_mode IIFE --dependency_mode PRUNE --entry_point src/$* --js_output_file $@ $^
3p/yuicompressor.jar: | 3p/; $(HTTPGET) "https://github.com/yui/yuicompressor/releases/download/v2.4.8/yuicompressor-2.4.8.jar" >$@
3p/htmlcompressor.jar: | 3p/; $(HTTPGET) "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/htmlcompressor/htmlcompressor-1.5.3.jar" >$@
3p/closure-compiler.jar: | 3p/; $(HTTPGET) "https://dl.google.com/closure-compiler/compiler-20200719.tar.gz" | tar -Oxzf - closure-compiler-v20200719.jar >$@
3p/saxon9he.jar: | 3p/
$(HTTPGET) "https://master.dl.sourceforge.net/project/saxon/Saxon-HE/9.9/SaxonHE9-9-1-8J.zip" >saxon.zip
cd $(dir $@) && $(UNZIP) ../saxon.zip $(notdir $@)
rm saxon.zip
devserve: ; cd src && python3 -m http.server
stage: $(DST); cd dst && python3 -m http.server
deploy: $(DST); netlify deploy --prod --dir=dst
clean: ; rm -rf dst
cleanall: clean; rm -rf 3p