From 1ea0e7a1a554491c3b7dd21698812eba950a8eae Mon Sep 17 00:00:00 2001 From: Joseph C Wang Date: Mon, 26 Jun 2017 03:24:34 +0800 Subject: [PATCH] fix Makefile to deal with missing sass and uglify This fixes the Makefile so that it does not create bad files if sass or uglify are missing. --- Makefile | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index acf865a2..be9a4be9 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,8 @@ $(JS_FILES): %.js: src/%.ls manifest :: perl -pi -e 's/# [A-Z].*\n/# @{[`date`]}/m' manifest.appcache -./node_modules/streamline/bin/_node : +./node_modules/streamline/bin/_node \ +./node_modules/uglify-js/bin/uglifyjs : npm i --dev static/multi.js :: multi/main.ls multi/styles.styl @@ -45,16 +46,26 @@ static/multi.js :: multi/main.ls multi/styles.styl depends: app.js static/ethercalc.js static/start.css static/multi.js -static/ethercalc.js: $(ETHERCALC_FILES) ./node_modules/socialcalc/SocialCalc.js - @-mkdir .git +static/ethercalc.js: $(ETHERCALC_FILES) \ + ./node_modules/socialcalc/SocialCalc.js \ + ./node_modules/uglify-js/bin/uglifyjs + @-mkdir -p .git @echo '// Auto-generated from "make depends"; ALL CHANGES HERE WILL BE LOST!' > $@ - node node_modules/zappajs/node_modules/.bin/uglifyjs node_modules/socialcalc/SocialCalc.js $(ETHERCALC_FILES) $(UGLIFYJS_ARGS) --source-map ethercalc.js.map --source-map-include-sources >> $@ + node node_modules/uglify-js/bin/uglifyjs node_modules/socialcalc/SocialCalc.js $(ETHERCALC_FILES) $(UGLIFYJS_ARGS) --source-map ethercalc.js.map --source-map-include-sources >> $@ mv ethercalc.js.map static +COFFEE := $(shell command -v coffee 2> /dev/null) .coffee.js: +ifndef COFFEE + $(error "coffee is not available please install sass") +endif coffee -c $< +SASS := $(shell command -v sass 2> /dev/null) .sass.css: +ifndef SASS + $(error "sass is not available please install sass") +endif sass -t compressed $< > $@ clean ::