summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile113
1 files changed, 69 insertions, 44 deletions
diff --git a/Makefile b/Makefile
index 576fc55..4856fc4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,17 +1,23 @@
SCSS = scss
CORDOVA = cordova
+GSED = sed
+WGET = wget -c --no-use-server-timestamp
+
+pdfjs = https://github.com/mozilla/pdf.js/releases/download/v1.0.907/pdfjs-1.0.907-dist.zip
+frc_safety_manual = http://www.usfirst.org/sites/default/files/uploadedFiles/Robotics_Programs/FRC/Resources/2015%20FRC%20Team%20Safety%20Manual-%20FINAL%202.6.15.pdf
targets = \
platforms/browser/build/package.zip \
platforms/android/ant-build/CordovaApp-debug.apk
sources = \
+ www/FIRST_Safety_Manual.pdf \
www/pdfjs \
\
www/css/index.css \
www/MSDS.html
-android_resources = \
+android-resources = \
platforms/android/res/drawable/icon.png \
platforms/android/res/drawable-ldpi/icon.png \
platforms/android/res/drawable-mdpi/icon.png \
@@ -27,69 +33,88 @@ android_resources = \
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)
+resources = $(android-resources)
-all: targets sources
+
+all: $(targets)
-%.css: %.scss
- $(SCSS) $< $@
+clean-sources: PHONY
+ rm -rf -- www/pdfjs
+ rm -f -- $(sources)
+clean-resources: PHONY
+ rm -f -- $(resources)
+clean-%-resources: PHONY
+ rm -f -- $($*-resources)
+clean: PHONY clean-sources clean-resources
+ rm -f -- info.txt pdfjs-*.zip hs_err_pid*.log
+distclean: PHONY clean
+ rm -rf -- platforms plugins
+
+sources: PHONY $(sources)
+resources: PHONY $(resources)
+%-resources: PHONY
+ $(if $($@),$(MAKE) $($@))
+
+
+DEP_DIR = $1 $(shell find $1)
-platforms/android/res/drawable/icon.png: www/img/logo.png
+platforms/browser/build/package.zip: platforms/browser $(sources) $(call DEP_DIR,www)
+ $(CORDOVA) build browser
+
+platforms/android/ant-build/CordovaApp-debug.apk: platforms/android $(sources) $(call DEP_DIR,www)
+ $(CORDOVA) build android
+
+platforms/%:
+ $(CORDOVA) platform add $*
+
+www/FIRST_Safety_Manual.pdf:
+ $(WGET) -O $@ $(frc_safety_manual)
+
+$(notdir $(pdfjs)):
+ $(WGET) $(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 | $(GSED) 'p;s/_/ /g' | $(GSED) -r 'N;s,^(.*)\n(.*)\.pdf,<a href="pdfjs/web/viewer.html?file=../../MSDS/\1">\2</a>,' | $(GSED) $$'/@list@/{ s/@list@//; r/dev/stdin\n}' www/MSDS.html.in > $@
+
+
+platforms/android/res/drawable/icon.png: www/img/logo.png | platforms/android
convert $< -resize 96x96 $@
-platforms/android/res/drawable-ldpi/icon.png: www/img/logo.png
+platforms/android/res/drawable-ldpi/icon.png: www/img/logo.png | platforms/android
convert $< -resize 36x36 $@
-platforms/android/res/drawable-mdpi/icon.png: www/img/logo.png
+platforms/android/res/drawable-mdpi/icon.png: www/img/logo.png | platforms/android
convert $< -resize 48x48 $@
-platforms/android/res/drawable-hdpi/icon.png: www/img/logo.png
+platforms/android/res/drawable-hdpi/icon.png: www/img/logo.png | platforms/android
convert $< -resize 72x72 $@
-platforms/android/res/drawable-xhdpi/icon.png: www/img/logo.png
+platforms/android/res/drawable-xhdpi/icon.png: www/img/logo.png | platforms/android
convert $< -resize 96x96 $@
-platforms/android/res/drawable-land-ldpi/screen.png: www/img/screen-landscape.png
+platforms/android/res/drawable-land-ldpi/screen.png: www/img/screen-landscape.png | platforms/android
convert $< -resize 320x200 $@
-platforms/android/res/drawable-land-mdpi/screen.png: www/img/screen-landscape.png
+platforms/android/res/drawable-land-mdpi/screen.png: www/img/screen-landscape.png | platforms/android
convert $< -resize 480x320 $@
-platforms/android/res/drawable-land-hdpi/screen.png: www/img/screen-landscape.png
+platforms/android/res/drawable-land-hdpi/screen.png: www/img/screen-landscape.png | platforms/android
convert $< -resize 800x480 $@
-platforms/android/res/drawable-land-xhdpi/screen.png: www/img/screen-landscape.png
+platforms/android/res/drawable-land-xhdpi/screen.png: www/img/screen-landscape.png | platforms/android
convert $< -resize 1280x720 $@
-platforms/android/res/drawable-port-ldpi/screen.png: www/img/screen-portrait.png
+platforms/android/res/drawable-port-ldpi/screen.png: www/img/screen-portrait.png | platforms/android
convert $< -resize 200x320 $@
-platforms/android/res/drawable-port-mdpi/screen.png: www/img/screen-portrait.png
+platforms/android/res/drawable-port-mdpi/screen.png: www/img/screen-portrait.png | platforms/android
convert $< -resize 320x480 $@
-platforms/android/res/drawable-port-hdpi/screen.png: www/img/screen-portrait.png
+platforms/android/res/drawable-port-hdpi/screen.png: www/img/screen-portrait.png | platforms/android
convert $< -resize 480x800 $@
-platforms/android/res/drawable-port-xhdpi/screen.png: www/img/screen-portrait.png
+platforms/android/res/drawable-port-xhdpi/screen.png: www/img/screen-portrait.png | platforms/android
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)
+
+%.css: %.scss
+ $(SCSS) $< $@
+
.PHONY: PHONY FORCE
.DELETE_ON_ERROR:
.SECONDARY: