summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-02-25 12:38:41 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-02-25 12:38:41 -0500
commit8ac4a803e658a199b80fd01cf32edc177bb42084 (patch)
tree093e55178debe69c25426d0973c69d0cd61254ef
parent132cba71a8a6c3f57ab57f95626d644d69392b4b (diff)
improve build system
-rw-r--r--Makefile28
1 files changed, 16 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 4856fc4..8294364 100644
--- a/Makefile
+++ b/Makefile
@@ -6,17 +6,19 @@ 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
+platforms = android browser
+
sources = \
www/FIRST_Safety_Manual.pdf \
www/pdfjs \
- \
www/css/index.css \
www/MSDS.html
+browser-targets = platforms/browser/build/package.zip
+
+android-targets = platforms/android/ant-build/CordovaApp-debug.apk
+
android-resources = \
platforms/android/res/drawable/icon.png \
platforms/android/res/drawable-ldpi/icon.png \
@@ -33,27 +35,29 @@ 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)
+targets = $(foreach platform,$(platforms),$($(platform)-targets))
+resources = $(foreach platform,$(platforms),$($(platform)-resources))
all: $(targets)
+sources: PHONY $(sources)
+resources: PHONY $(resources)
+
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
+ rm -f -- info.txt www/css/*.map pdfjs-*.zip hs_err_pid*.log
distclean: PHONY clean
rm -rf -- platforms plugins
-sources: PHONY $(sources)
-resources: PHONY $(resources)
-%-resources: PHONY
- $(if $($@),$(MAKE) $($@))
+$(foreach platform,$(platforms),\
+ $(eval clean-$(platform)-resources: PHONY; rm -f -- $$($(platform)-resources)) \
+ $(eval $(platform)-resources: PHONY $$($(platform)-resources)) \
+ $(eval build-$(platform): PHONY $$($(platform)-targets)))
DEP_DIR = $1 $(shell find $1)