]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
improved Makefile
authorRocky Meza <rocky@fusionbox.com>
Sun, 12 Feb 2012 02:57:45 +0000 (19:57 -0700)
committerRocky Meza <rocky@fusionbox.com>
Sun, 12 Feb 2012 02:57:45 +0000 (19:57 -0700)
Makefile [new file with mode: 0644]
makefile [deleted file]
test/moment/add_subtract.js [moved from test/non-lang/add_subtract.js with 100% similarity]
test/moment/create.js [moved from test/non-lang/create.js with 100% similarity]
test/moment/diff.js [moved from test/non-lang/diff.js with 100% similarity]
test/moment/format.js [moved from test/non-lang/format.js with 100% similarity]
test/moment/getters_setters.js [moved from test/non-lang/getters_setters.js with 100% similarity]
test/moment/leapyear.js [moved from test/non-lang/leapyear.js with 100% similarity]
test/moment/sod_eod.js [moved from test/non-lang/sod_eod.js with 100% similarity]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..400d818
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,66 @@
+LANG_ALL = $(wildcard lang/*.js)
+MIN_LANG_ALL = $(addprefix min/,$(LANG_ALL))
+LANGTESTS = $(wildcard test/lang/*.js)
+TEST_ALL = test/prefix/prefix.js test/non-lang-tests.js test/lang/*.js test/prefix/suffix.js 
+
+MIN_DIR = min/
+
+
+.PHONY: all
+all: moment langs
+
+min/:
+       mkdir min/
+
+min/lang/:
+       mkdir -p min/lang/
+
+.PHONY: moment pretty
+moment: min/ min/moment.min.js pretty
+
+pretty: min/ min/moment.min.pretty.js
+
+min/moment.min.js: moment.js
+       node_modules/.bin/uglifyjs -o $@ $<
+
+min/moment.min.pretty.js: moment.js
+       node_modules/.bin/uglifyjs -b -o $@ $<
+
+min/lang/%: lang/%
+       node_modules/.bin/uglifyjs -o $@ $<
+
+min/lang-all.min.js: $(LANG_ALL)
+       cat $(LANG_ALL) | node_modules/.bin/uglifyjs -o $@
+
+.PHONY: langs
+langs: min/lang/ $(MIN_LANG_ALL) min/lang-all.min.js
+
+.PHONY: size
+size: moment langs
+       # FILESIZE FOR ALL LANGS
+       cp min/lang-all.min.js min/lang-all.min.gzip.js
+       gzip min/lang-all.min.gzip.js
+       gzip -l min/lang-all.min.gzip.js.gz
+       rm min/lang-all.min.gzip.js.gz
+       # FILESIZE FOR LIBRARY
+       cp min/moment.min.js min/moment.min.gzip.js
+       gzip min/moment.min.gzip.js
+       gzip -l min/moment.min.gzip.js.gz
+       rm min/moment.min.gzip.js.gz
+
+
+.PHONY: test hint test-moment test-lang
+test: hint test-moment test-lang
+
+hint:
+       node_modules/.bin/jshint moment.js
+
+test-moment:
+       node_modules/.bin/nodeunit ./test/moment
+
+test-lang:
+       node_modules/.bin/nodeunit ./test/lang
+
+.PHONY: clean
+clean:
+       rm -rf min/
diff --git a/makefile b/makefile
deleted file mode 100644 (file)
index 47007d8..0000000
--- a/makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-LANG_ALL = lang/*.js
-TEST_ALL = test/prefix/prefix.js test/non-lang-tests.js test/lang/*.js test/prefix/suffix.js 
-
-all: langs moment
-
-moment:
-       uglifyjs -o min/moment.min.js moment.js
-
-langs: langtests
-       cat $(LANG_ALL) | uglifyjs -o min/lang-all.min.js
-       find lang -name "*.js" -exec uglifyjs -o min/'{}' '{}' \;
-
-langtests:
-       cat $(TEST_ALL) > test/all-tests.js
-
-size: moment langs
-# FILESIZE FOR ALL LANGS
-       cp min/lang-all.min.js min/lang-all.min.gzip.js
-       gzip min/lang-all.min.gzip.js
-       gzip -l min/lang-all.min.gzip.js.gz
-       rm min/lang-all.min.gzip.js.gz
-# FILESIZE FOR LIBRARY
-       cp min/moment.min.js min/moment.min.gzip.js
-       gzip min/moment.min.gzip.js
-       gzip -l min/moment.min.gzip.js.gz
-       rm min/moment.min.gzip.js.gz
-
-test: moment
-       nodeunit ./test/non-lang ./test/lang
-
-testmoment: moment
-       nodeunit ./test/non-lang
-
-testlang: 
-       nodeunit ./test/lang
\ No newline at end of file
similarity index 100%
rename from test/non-lang/diff.js
rename to test/moment/diff.js