-JSTEST ?= node_modules/.bin/jstest
-JSHINT ?= node_modules/.bin/jshint
-UGLIFY ?= node_modules/.bin/uglifyjs
-SOURCES = string-lerp.js
+PKGNAME := string-lerp
+
+fallback = $(firstword $(shell command -v $(1)) $(2))
+
+GIT ?= git
+git_ls-tree = $(shell $(GIT) ls-tree -r --name-only $(1))
+git_tag = $(shell $(GIT) name-rev --tags --name-only $(shell $(GIT) rev-parse $(1)))
+
+NPM ?= npm
+NPMBINDIR := ./node_modules/.bin
+JSTEST ?= $(NPMBINDIR)/jstest
+JSHINT ?= $(call fallback,jshint,$(NPMBINDIR)/jshint)
+UGLIFY ?= $(call fallback,uglifyjs,$(NPMBINDIR)/uglifyjs)
+SOURCES := string-lerp.js