From 8ac4a803e658a199b80fd01cf32edc177bb42084 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 25 Feb 2015 12:38:41 -0500 Subject: improve build system --- Makefile | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'Makefile') 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) -- cgit v1.2.3-54-g00ecf