Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add a clean target and attempt to build with uglifyjs if it exists locally before going out to the public Internet #34

Merged
merged 2 commits into from

2 participants

Tim Jarvis Badgley
Tim

I'm okay if you decide not to accept this pull request, but there's something about depending on the public Internet to build JS that I do not like, especially since I already have a local build environment. Also, once the JS files were built they could not be re-built (with make) until the files were actually removed from build/, so I added a clean target to do that.

Jarvis Badgley ChiperSoft merged commit 3bf01e9 into from
Jarvis Badgley
Owner

I didn't realize I had left out a clean target. Good stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 5 deletions.
  1. +15 −5 Makefile
20 Makefile
View
@@ -1,3 +1,4 @@
+UGLIFYJS=$(shell which uglifyjs)
kal=src/main.js \
src/util.js \
@@ -10,13 +11,15 @@ kal=src/main.js \
all: build/kalendae.js
+clean:
+ rm -f build/*.js
+
minified: build/kalendae.min.js
minified-test: build/kalendae.min.errors
build/kalendae.js: $(kal)
- rm -f $@
cat src/header.js >> $@
echo "(function (undefined) {" >> $@
echo "" >> $@
@@ -25,21 +28,28 @@ build/kalendae.js: $(kal)
echo "})();" >> $@
build/kalendae.min.js: build/kalendae.js
- rm -f $@
cat src/header.js >> $@
+ifneq ($(UGLIFYJS), "")
+ $(UGLIFYJS) build/kalendae.js >> $@
+else
curl -s \
--data-urlencode 'js_code@build/kalendae.js' \
- --data-urlencode 'output_format=text' \
+ --data-urlencode 'output_format=text' \
--data-urlencode 'output_info=compiled_code' \
+ #--data-urlencode 'compilation_level=ADVANCED_OPTIMIZATIONS' \
http://closure-compiler.appspot.com/compile \
>> $@
+endif
gzip -c build/kalendae.min.js | wc -c
- #--data-urlencode 'compilation_level=ADVANCED_OPTIMIZATIONS' \
build/kalendae.min.errors: build/kalendae.js
+ifneq ($(UGLIFYJS), "")
+ $(UGLIFYJS) build/kalendae.js 1>/dev/null
+else
curl -s \
--data-urlencode 'js_code@build/kalendae.js' \
- --data-urlencode 'output_format=text' \
+ --data-urlencode 'output_format=text' \
--data-urlencode 'output_info=errors' \
http://closure-compiler.appspot.com/compile
+endif
Something went wrong with that request. Please try again.