summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-02-25 12:20:48 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-02-25 12:20:48 -0500
commit132cba71a8a6c3f57ab57f95626d644d69392b4b (patch)
tree782dca78b3ba963cbf5fc27bb3f003aa12095167
parent4a62fe6388e75ed11f61dab23c63721fa52aa54e (diff)
clean up build system
-rw-r--r--.gitignore3
-rw-r--r--Makefile113
-rwxr-xr-xhooks/after_prepare/gen_resources10
-rw-r--r--www/2015 FRC Team Safety Manual- FINAL 2.6.15.pdfbin1113019 -> 0 bytes
l---------www/FIRST_Safety_Manual.pdf1
-rw-r--r--www/js/index.js51
6 files changed, 78 insertions, 100 deletions
diff --git a/.gitignore b/.gitignore
index 5b5b618..d1517e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
-/www/css/index.css
+/www/FIRST_Safety_Manual.pdf
/www/MSDS.html
+/www/css/index.css
/www/pdfjs
*.css.map
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:
diff --git a/hooks/after_prepare/gen_resources b/hooks/after_prepare/gen_resources
index ac86515..c98c905 100755
--- a/hooks/after_prepare/gen_resources
+++ b/hooks/after_prepare/gen_resources
@@ -1,3 +1,7 @@
-#!/bin/sh
-make clean-resources
-make resources
+#! /usr/bin/env bash
+IFS=,
+platforms=($CORDOVA_PLATFORMS)
+
+resources=("${platforms[@]/%/-resources}")
+make "${resources[@]/#/clean-}"
+make "${resources[@]}"
diff --git a/www/2015 FRC Team Safety Manual- FINAL 2.6.15.pdf b/www/2015 FRC Team Safety Manual- FINAL 2.6.15.pdf
deleted file mode 100644
index d244936..0000000
--- a/www/2015 FRC Team Safety Manual- FINAL 2.6.15.pdf
+++ /dev/null
Binary files differ
diff --git a/www/FIRST_Safety_Manual.pdf b/www/FIRST_Safety_Manual.pdf
deleted file mode 120000
index 918ba1a..0000000
--- a/www/FIRST_Safety_Manual.pdf
+++ /dev/null
@@ -1 +0,0 @@
-2015 FRC Team Safety Manual- FINAL 2.6.15.pdf \ No newline at end of file
diff --git a/www/js/index.js b/www/js/index.js
deleted file mode 100644
index c31cd83..0000000
--- a/www/js/index.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-var app = {
- // Application Constructor
- initialize: function() {
- this.bindEvents();
- },
- // Bind Event Listeners
- //
- // Bind any events that are required on startup. Common events are:
- // 'load', 'deviceready', 'offline', and 'online'.
- bindEvents: function() {
- document.addEventListener('deviceready', this.onDeviceReady, false);
- },
- // deviceready Event Handler
- //
- // The scope of 'this' is the event. In order to call the 'receivedEvent'
- // function, we must explicitly call 'app.receivedEvent(...);'
- onDeviceReady: function() {
- app.receivedEvent('deviceready');
- },
- // Update DOM on a Received Event
- receivedEvent: function(id) {
- var parentElement = document.getElementById(id);
- var listeningElement = parentElement.querySelector('.listening');
- var receivedElement = parentElement.querySelector('.received');
-
- listeningElement.setAttribute('style', 'display:none;');
- receivedElement.setAttribute('style', 'display:block;');
-
- console.log('Received Event: ' + id);
- }
-};
-
-app.initialize(); \ No newline at end of file