#!/usr/bin/make -f PKGNAME := string-lerp all: $(info Interesting targets:) $(info lint - validate source (with jshint)) $(info test - run tests (with jstest)) $(info ugly - generate minified source files) $(info dist - generate redistributables (if git tagged)) $(info ) $(info (Running these may download packages from npm.)) $(info ) @: include javascript.mk GIT ?= git git-describe = $(shell $(GIT) describe --tags --always $1) SOURCES := string-lerp.js UGLIFIED := $(call uglify-stampify,$(SOURCES)) JSHINTCONFIG := tests/jshint.config JSSTAMPDIR := build/stamp TESTS := $(wildcard tests/*.js) LINTS := $(call jshint-stampify,$(SOURCES) $(TESTS)) TEST_TARGETS = $(patsubst %.js,build/stamp/tests/%.js.test,$(SOURCES)) .DELETE_ON_ERROR: .PHONY: all check lint test ugly dist clean distclean install .FORCE check: lint test lint: $(LINTS) test: $(TEST_TARGETS) ugly: check $(UGLIFIED) $(PKGNAME)-%.zip $(PKGNAME)-%.tar.gz: .FORCE @mkdir -p $(@D) $(GIT) archive --prefix=$(PKGNAME)-$(*F)/ --output=$@ $(*F) dist: check $(addprefix build/dist/$(PKGNAME)-$(call git-describe),.zip .tar.gz) clean: $(RM) -r build $(RM) $(UGLIFIED) distclean: clean $(RM) -r node_modules install: check $(NPM) install -g .