JSHINT ?= node_modules/.bin/jshint
UGLIFY ?= node_modules/.bin/uglifyjs
SOURCES = string-lerp.js
-MINIFIED = $(SOURCES:.js=.min.js)
+UGLIFIED = $(SOURCES:.js=.min.js)
TESTS = $(wildcard tests/*.js);
LINT_TARGETS = $(addprefix build/stamp/,$(addsuffix .lint,$(SOURCES)))
TEST_TARGETS = $(addprefix build/stamp/,$(addsuffix .test,$(SOURCES)))
-.PHONY: all check lint test
+.PHONY: all check lint test min
-all: $(MINIFIED)
+all:
+ @echo "Interesting targets:"
+ @echo " lint - validate source (with jshint)"
+ @echo " test - run tests (with jstest)"
+ @echo " ugly - generate minified/mangled source files"
+ @echo
+ @echo "(Running these will download packages from NPM.)"
+ @echo
%.min.js: %.js $(UGLIFY)
$(UGLIFY) -m < $< > $@
@$(JSTEST) $< > $@ || (cat $@ && rm -f $@ && exit 1)
@touch $@
+ugly: $(UGLIFIED)
+
check: lint test
lint: $(JSHINT) $(LINT_TARGETS)
clean:
rm -rf build
- rm -f $(MINIFIED)
+ rm -f $(UGLIFIED)
distclean: clean
rm -rf node_modules