Fix old project name.
[rrr.git] / Makefile
1 #!/usr/bin/make -f
2
3 PKGNAME := rrr
4
5 all:
6 $(info Interesting targets:)
7 $(info lint - validate source (with jshint))
8 $(info test - run tests (with jstest))
9 $(info ugly - generate minified source files)
10 $(info dist - generate redistributables (if git tagged))
11 $(info )
12 $(info (Running these may download packages from npm.))
13 $(info )
14 @:
15
16
17 SOURCES := rrr.js term.js
18 JSTEST_SOURCES += $(SOURCES)
19
20 include javascript.mk
21
22 GIT ?= git
23 git-describe = $(shell $(GIT) describe --tags --always $1)
24
25 UGLIFIED := $(call uglify-stampify,$(SOURCES))
26
27 JSHINTCONFIG := tests/jshint.config
28 JSSTAMPDIR := build/stamp
29
30 TESTS := $(wildcard tests/*.js)
31 LINTS := $(call jshint-stampify,$(SOURCES) $(TESTS))
32 TEST_TARGETS = $(patsubst %.js,build/stamp/tests/%.js.test,$(SOURCES))
33
34 .DELETE_ON_ERROR:
35 .PHONY: all check lint test ugly dist clean distclean install
36
37 check: lint test
38
39 lint: $(LINTS)
40
41 test: $(TEST_TARGETS)
42
43 ugly: check $(UGLIFIED)
44
45 dist: check
46
47 clean:
48 $(RM) -r build
49 $(RM) $(UGLIFIED)
50
51 distclean: clean
52 $(RM) -r node_modules
53
54 install: check
55 $(NPM) install -g .
56
57 dist: check build/dist/$(PKGNAME)-$(call git-describe).tar.gz
58
59 $(PKGNAME)-%.tar.gz: | .git
60 @mkdir -p $(@D)
61 $(GIT) archive --prefix=$(PKGNAME)-$(*F)/ --output=$@ $(*F)