2012-05-11 19:07:44 -04:00
|
|
|
##
|
|
|
|
# ease.js Makefile
|
|
|
|
#
|
|
|
|
# Copyright (C) 2012 Mike Gerwitz
|
|
|
|
#
|
|
|
|
# This file is part of ease.js.
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
##
|
2010-11-10 19:38:06 -05:00
|
|
|
|
2011-05-25 22:11:50 -04:00
|
|
|
path_build=./build
|
|
|
|
path_tools=./tools
|
|
|
|
path_lib=./lib
|
|
|
|
path_combine_output=${path_build}/ease.js
|
|
|
|
path_combine_output_full=${path_build}/ease-full.js
|
|
|
|
path_browser_test=${path_tools}/browser-test.html
|
|
|
|
path_test=./test
|
|
|
|
path_perf_test=${path_test}/perf
|
|
|
|
|
|
|
|
perf_tests := $(shell find "$(path_perf_test)" -name 'perf-*.js')
|
|
|
|
|
2011-06-30 23:00:13 -04:00
|
|
|
src_js := index.js $(wildcard $(path_lib)/*.js)
|
2011-12-04 19:13:51 -05:00
|
|
|
src_tests := index.js $(shell find "$(path_test)" -name test-* \
|
|
|
|
-o -name *Test* \
|
|
|
|
-o -name inc-*.js )
|
2011-06-30 23:00:13 -04:00
|
|
|
|
2011-06-05 11:58:33 -04:00
|
|
|
path_doc := ./doc
|
2011-03-21 21:09:36 -04:00
|
|
|
|
Switched to Closure Compiler
This is nothing against uglify. Rather, here's the story on this:
Commit e4cd1e fixed an error that was causing minified files to break in IE.
This was due to how IE interprets things, not how UglifyJS was minifying them.
Indeed, Closure Compiler had the exact same problem.
The decision to move to Closure Compiler was due to a variety of factors, which
came down to primarily feature set and tests. Closure Compiler is well tested
and maintained. It also includes a number of additional, beneficial features.
UglifyJS is an excellent project and I would recommend it to anyone, but it is
not tested (no unit tests; it's tested by ensuring common libraries like jQuery
run after minification). It is, however, significantly faster.
It's likely that, in the future, once I add autoconf for the build process to
configure certain settings, that I will add UglifyJS as an option. I'm sure many
people would prefer that, especially those who dislike Java and do not wish to
have it installed. Hopefully those that do decide to install Java will go with
openjdk, not Oracle's proprietary implementation.
2011-12-06 18:28:56 -05:00
|
|
|
combine := $(path_tools)/combine
|
|
|
|
compiler := $(path_tools)/compiler.jar
|
2011-12-10 16:45:10 -05:00
|
|
|
path_externs_internal := $(path_build)/externs-internal.js
|
2010-12-19 23:51:22 -05:00
|
|
|
|
Switched to Closure Compiler
This is nothing against uglify. Rather, here's the story on this:
Commit e4cd1e fixed an error that was causing minified files to break in IE.
This was due to how IE interprets things, not how UglifyJS was minifying them.
Indeed, Closure Compiler had the exact same problem.
The decision to move to Closure Compiler was due to a variety of factors, which
came down to primarily feature set and tests. Closure Compiler is well tested
and maintained. It also includes a number of additional, beneficial features.
UglifyJS is an excellent project and I would recommend it to anyone, but it is
not tested (no unit tests; it's tested by ensuring common libraries like jQuery
run after minification). It is, however, significantly faster.
It's likely that, in the future, once I add autoconf for the build process to
configure certain settings, that I will add UglifyJS as an option. I'm sure many
people would prefer that, especially those who dislike Java and do not wish to
have it installed. Hopefully those that do decide to install Java will go with
openjdk, not Oracle's proprietary implementation.
2011-12-06 18:28:56 -05:00
|
|
|
.PHONY: combine min doc test test-combine clean distclean
|
2010-11-10 19:38:06 -05:00
|
|
|
|
2010-12-19 23:51:22 -05:00
|
|
|
|
2011-05-23 18:38:13 -04:00
|
|
|
default: combine min
|
2011-05-25 22:04:19 -04:00
|
|
|
all: combine min doc
|
2010-12-19 23:51:22 -05:00
|
|
|
|
2011-06-05 13:53:05 -04:00
|
|
|
mkbuild: $(path_build)
|
|
|
|
|
2010-12-19 23:51:22 -05:00
|
|
|
# create build dir
|
2011-05-25 22:11:50 -04:00
|
|
|
$(path_build):
|
|
|
|
mkdir -p "$(path_build)"
|
2010-12-19 23:51:22 -05:00
|
|
|
|
|
|
|
# combine all modules into easily redistributable ease.js file (intended for
|
|
|
|
# browser)
|
2011-05-25 22:11:50 -04:00
|
|
|
$(path_combine_output): $(src_js) | mkbuild
|
|
|
|
${combine} > "$(path_combine_output)"
|
|
|
|
$(path_combine_output_full): $(src_js) $(src_tests) | mkbuild
|
|
|
|
INC_TEST=1 "$(combine)" > "${path_combine_output_full}"
|
2011-12-03 12:56:37 -05:00
|
|
|
$(path_build)/browser-test.html: $(path_browser_test) | $(path_combine_output_full)
|
|
|
|
cp "$(path_browser_test)" $@
|
|
|
|
$(path_build)/browser-test-min.html: $(path_browser_test) | $(path_combine_output_full)
|
|
|
|
cat "$(path_browser_test)" | sed 's/ease-full\.js/ease-full\.min\.js/' > $@
|
2011-05-25 22:11:50 -04:00
|
|
|
combine: $(path_combine_output) $(path_build)/browser-test.html
|
2010-12-19 23:51:22 -05:00
|
|
|
|
2011-06-05 11:58:33 -04:00
|
|
|
doc:
|
|
|
|
$(MAKE) -C $(path_doc)
|
2012-05-07 21:50:13 -04:00
|
|
|
doc-html:
|
|
|
|
$(MAKE) -C $(path_doc) html
|
2011-03-20 02:28:40 -04:00
|
|
|
|
2011-03-27 01:57:55 -04:00
|
|
|
test: default
|
2011-05-25 22:11:50 -04:00
|
|
|
$(MAKE) -C $(path_test)
|
2010-12-19 23:51:22 -05:00
|
|
|
|
2011-03-10 22:55:07 -05:00
|
|
|
# performance tests
|
2011-05-25 22:11:50 -04:00
|
|
|
perf: default $(perf_tests)
|
2011-03-11 19:47:00 -05:00
|
|
|
perf-%.js: default
|
|
|
|
@node $@
|
2010-12-19 23:51:22 -05:00
|
|
|
|
2011-12-10 16:45:10 -05:00
|
|
|
# externs for compilation process
|
|
|
|
$(path_externs_internal): | mkbuild
|
|
|
|
$(path_tools)/mkexterns > $@
|
|
|
|
|
|
|
|
# minification process uses Google Closure compiler
|
Switched to Closure Compiler
This is nothing against uglify. Rather, here's the story on this:
Commit e4cd1e fixed an error that was causing minified files to break in IE.
This was due to how IE interprets things, not how UglifyJS was minifying them.
Indeed, Closure Compiler had the exact same problem.
The decision to move to Closure Compiler was due to a variety of factors, which
came down to primarily feature set and tests. Closure Compiler is well tested
and maintained. It also includes a number of additional, beneficial features.
UglifyJS is an excellent project and I would recommend it to anyone, but it is
not tested (no unit tests; it's tested by ensuring common libraries like jQuery
run after minification). It is, however, significantly faster.
It's likely that, in the future, once I add autoconf for the build process to
configure certain settings, that I will add UglifyJS as an option. I'm sure many
people would prefer that, especially those who dislike Java and do not wish to
have it installed. Hopefully those that do decide to install Java will go with
openjdk, not Oracle's proprietary implementation.
2011-12-06 18:28:56 -05:00
|
|
|
min: build/ease.min.js build/ease-full.min.js $(path_build)/browser-test-min.html \
|
2011-12-10 16:45:10 -05:00
|
|
|
| combine
|
Switched to Closure Compiler
This is nothing against uglify. Rather, here's the story on this:
Commit e4cd1e fixed an error that was causing minified files to break in IE.
This was due to how IE interprets things, not how UglifyJS was minifying them.
Indeed, Closure Compiler had the exact same problem.
The decision to move to Closure Compiler was due to a variety of factors, which
came down to primarily feature set and tests. Closure Compiler is well tested
and maintained. It also includes a number of additional, beneficial features.
UglifyJS is an excellent project and I would recommend it to anyone, but it is
not tested (no unit tests; it's tested by ensuring common libraries like jQuery
run after minification). It is, however, significantly faster.
It's likely that, in the future, once I add autoconf for the build process to
configure certain settings, that I will add UglifyJS as an option. I'm sure many
people would prefer that, especially those who dislike Java and do not wish to
have it installed. Hopefully those that do decide to install Java will go with
openjdk, not Oracle's proprietary implementation.
2011-12-06 18:28:56 -05:00
|
|
|
$(compiler):
|
|
|
|
wget -O- http://closure-compiler.googlecode.com/files/compiler-latest.tar.gz \
|
|
|
|
| tar -C $(path_tools) -xzv compiler.jar
|
2011-12-10 16:45:10 -05:00
|
|
|
build/%.min.js: build/%.js $(path_tools)/externs-global.js $(path_externs_internal) \
|
|
|
|
$(compiler)
|
2011-12-22 23:49:53 -05:00
|
|
|
cat $(path_tools)/license-min.tpl > $@
|
2011-12-10 11:06:34 -05:00
|
|
|
java -jar $(compiler) \
|
|
|
|
--externs $(path_tools)/externs-global.js \
|
2011-12-10 16:45:10 -05:00
|
|
|
--externs $(path_build)/externs-internal.js \
|
2011-12-10 11:06:34 -05:00
|
|
|
--js $< >> $@ || rm $@
|
2011-05-23 18:27:42 -04:00
|
|
|
|
2011-05-25 22:40:51 -04:00
|
|
|
install: doc-info
|
2011-05-25 22:03:36 -04:00
|
|
|
[ -d $(path_info_install) ] || mkdir -p $(path_info_install)
|
2011-05-25 22:11:50 -04:00
|
|
|
cp $(path_doc_output_info) $(path_info_install)
|
2011-05-25 22:03:36 -04:00
|
|
|
|
|
|
|
uninstall:
|
|
|
|
rm $(path_info_install)/easejs.info
|
|
|
|
|
2010-12-19 23:51:22 -05:00
|
|
|
# clean up build dir
|
2011-03-08 23:48:47 -05:00
|
|
|
clean:
|
2011-06-05 11:58:33 -04:00
|
|
|
$(MAKE) -C $(path_doc) clean
|
2011-05-25 22:11:50 -04:00
|
|
|
rm -rf "${path_build}"
|
2011-03-08 00:06:34 -05:00
|
|
|
|
Switched to Closure Compiler
This is nothing against uglify. Rather, here's the story on this:
Commit e4cd1e fixed an error that was causing minified files to break in IE.
This was due to how IE interprets things, not how UglifyJS was minifying them.
Indeed, Closure Compiler had the exact same problem.
The decision to move to Closure Compiler was due to a variety of factors, which
came down to primarily feature set and tests. Closure Compiler is well tested
and maintained. It also includes a number of additional, beneficial features.
UglifyJS is an excellent project and I would recommend it to anyone, but it is
not tested (no unit tests; it's tested by ensuring common libraries like jQuery
run after minification). It is, however, significantly faster.
It's likely that, in the future, once I add autoconf for the build process to
configure certain settings, that I will add UglifyJS as an option. I'm sure many
people would prefer that, especially those who dislike Java and do not wish to
have it installed. Hopefully those that do decide to install Java will go with
openjdk, not Oracle's proprietary implementation.
2011-12-06 18:28:56 -05:00
|
|
|
distclean: clean
|
|
|
|
rm $(compiler)
|
|
|
|
|