summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile91
1 files changed, 90 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 1c1ed6c..576fc55 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,95 @@
SCSS = scss
+CORDOVA = cordova
-all: www/css/index.css
+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: