summaryrefslogtreecommitdiff
path: root/Makefile
blob: 576fc55ac9d3497503850b00ec30204d005c8ae5 (plain)
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
SCSS = scss
CORDOVA = cordova

targets = \
	platforms/browser/build/package.zip \
	platforms/android/ant-build/CordovaApp-debug.apk

sources = \
	www/pdfjs \
	\
	www/css/index.css \
	www/MSDS.html

android_resources = \
	platforms/android/res/drawable/icon.png \
	platforms/android/res/drawable-ldpi/icon.png \
	platforms/android/res/drawable-mdpi/icon.png \
	platforms/android/res/drawable-hdpi/icon.png \
	platforms/android/res/drawable-xhdpi/icon.png \
	\
	platforms/android/res/drawable-land-ldpi/screen.png \
	platforms/android/res/drawable-land-mdpi/screen.png \
	platforms/android/res/drawable-land-hdpi/screen.png \
	platforms/android/res/drawable-land-xhdpi/screen.png \
	\
	platforms/android/res/drawable-port-ldpi/screen.png \
	platforms/android/res/drawable-port-mdpi/screen.png \
	platforms/android/res/drawable-port-hdpi/screen.png \
	platforms/android/res/drawable-port-xhdpi/screen.png
resources = $(android_resources)

all: targets sources

%.css: %.scss
	$(SCSS) $< $@

platforms/android/res/drawable/icon.png: www/img/logo.png
	convert $< -resize 96x96 $@
platforms/android/res/drawable-ldpi/icon.png: www/img/logo.png
	convert $< -resize 36x36 $@
platforms/android/res/drawable-mdpi/icon.png: www/img/logo.png
	convert $< -resize 48x48 $@
platforms/android/res/drawable-hdpi/icon.png: www/img/logo.png
	convert $< -resize 72x72 $@
platforms/android/res/drawable-xhdpi/icon.png: www/img/logo.png
	convert $< -resize 96x96 $@

platforms/android/res/drawable-land-ldpi/screen.png: www/img/screen-landscape.png
	convert $< -resize 320x200 $@
platforms/android/res/drawable-land-mdpi/screen.png: www/img/screen-landscape.png
	convert $< -resize 480x320 $@
platforms/android/res/drawable-land-hdpi/screen.png: www/img/screen-landscape.png
	convert $< -resize 800x480 $@
platforms/android/res/drawable-land-xhdpi/screen.png: www/img/screen-landscape.png
	convert $< -resize 1280x720 $@

platforms/android/res/drawable-port-ldpi/screen.png: www/img/screen-portrait.png
	convert $< -resize 200x320 $@
platforms/android/res/drawable-port-mdpi/screen.png: www/img/screen-portrait.png
	convert $< -resize 320x480 $@
platforms/android/res/drawable-port-hdpi/screen.png: www/img/screen-portrait.png
	convert $< -resize 480x800 $@
platforms/android/res/drawable-port-xhdpi/screen.png: www/img/screen-portrait.png
	convert $< -resize 720x1280 $@

pdfjs = https://github.com/mozilla/pdf.js/releases/download/v1.0.907/pdfjs-1.0.907-dist.zip
$(notdir $(pdfjs)):
	wget --no-use-server-timestamp $(pdfjs)

www/pdfjs: $(notdir $(pdfjs))
	rm -rf -- $@
	mkdir -- $@ && bsdtar -xf $(abspath $<) -C $@ --strip-components 1 --exclude '*.pdf' || rm -rf -- $@

www/MSDS.html: www/MSDS.html.in www/MSDS Makefile
	ls www/MSDS | sed 'p;s/_/ /g' | sed -r 'N;s,^(.*)\n(.*)\.pdf,<a href="pdfjs/web/viewer.html?file=../../MSDS/\1">\2</a>,' | sed $$'/@list@/{ s/@list@//; r/dev/stdin\n}' www/MSDS.html.in > $@

info.txt: config.xml FORCE
	$(CORDOVA) info

sources: $(sources)
resources: $(resources)

clean-sources: PHONY
	rm -f -- $(sources)
clean-resources: PHONY
	rm -f -- $(resources)
clean: PHONY clean-sources clean-resources
	rm -f -- hs_err_pid*.log

distclean: PHONY
	rm -f -- $(targets)

.PHONY: PHONY FORCE
.DELETE_ON_ERROR:
.SECONDARY: