Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 Apr 17, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 15 additions & 5 deletions Makefile
@@ -1,3 +1,4 @@
UGLIFYJS=$(shell which uglifyjs)


kal=src/main.js \ kal=src/main.js \
src/util.js \ src/util.js \
Expand All @@ -10,13 +11,15 @@ kal=src/main.js \


all: build/kalendae.js all: build/kalendae.js


clean:
rm -f build/*.js

minified: build/kalendae.min.js minified: build/kalendae.min.js


minified-test: build/kalendae.min.errors minified-test: build/kalendae.min.errors




build/kalendae.js: $(kal) build/kalendae.js: $(kal)
rm -f $@
cat src/header.js >> $@ cat src/header.js >> $@
echo "(function (undefined) {" >> $@ echo "(function (undefined) {" >> $@
echo "" >> $@ echo "" >> $@
Expand All @@ -25,21 +28,28 @@ build/kalendae.js: $(kal)
echo "})();" >> $@ echo "})();" >> $@


build/kalendae.min.js: build/kalendae.js build/kalendae.min.js: build/kalendae.js
rm -f $@
cat src/header.js >> $@ cat src/header.js >> $@
ifneq ($(UGLIFYJS), "")
$(UGLIFYJS) build/kalendae.js >> $@
else
curl -s \ curl -s \
--data-urlencode 'js_code@build/kalendae.js' \ --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 'output_info=compiled_code' \
#--data-urlencode 'compilation_level=ADVANCED_OPTIMIZATIONS' \
http://closure-compiler.appspot.com/compile \ http://closure-compiler.appspot.com/compile \
>> $@ >> $@
endif
gzip -c build/kalendae.min.js | wc -c gzip -c build/kalendae.min.js | wc -c


#--data-urlencode 'compilation_level=ADVANCED_OPTIMIZATIONS' \


build/kalendae.min.errors: build/kalendae.js build/kalendae.min.errors: build/kalendae.js
ifneq ($(UGLIFYJS), "")
$(UGLIFYJS) build/kalendae.js 1>/dev/null
else
curl -s \ curl -s \
--data-urlencode 'js_code@build/kalendae.js' \ --data-urlencode 'js_code@build/kalendae.js' \
--data-urlencode 'output_format=text' \ --data-urlencode 'output_format=text' \
--data-urlencode 'output_info=errors' \ --data-urlencode 'output_info=errors' \
http://closure-compiler.appspot.com/compile http://closure-compiler.appspot.com/compile
endif