forked from olivernn/lunr.js
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
68 lines (51 loc) · 1.45 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
SRC = lib/lunr.js \
lib/utils.js \
lib/event_emitter.js \
lib/tokenizer.js \
lib/pipeline.js \
lib/vector.js \
lib/sorted_set.js \
lib/index.js \
lib/document_store.js \
lib/stemmer.js \
lib/stop_word_filter.js \
lib/trimmer.js \
lib/token_store.js \
YEAR = $(shell date +%Y)
VERSION = $(shell cat VERSION)
SERVER_PORT ?= 3000
TEST_PORT ?= 32423
DOX ?= ./node_modules/.bin/dox
DOX_TEMPLATE ?= ./node_modules/.bin/dox-template
NODE ?= /usr/local/bin/node
NPM ?= /usr/local/bin/npm
PHANTOMJS ?= ./node_modules/.bin/phantomjs
UGLIFYJS ?= ./node_modules/.bin/uglifyjs
all: node_modules lunr.js lunr.min.js docs bower.json package.json component.json example
lunr.js: $(SRC)
cat build/wrapper_start $^ build/wrapper_end | \
sed "s/@YEAR/${YEAR}/" | \
sed "s/@VERSION/${VERSION}/" > $@
lunr.min.js: lunr.js
${UGLIFYJS} --compress --mangle --comments < $< > $@
%.json: build/%.json.template
cat $< | sed "s/@VERSION/${VERSION}/" > $@
size: lunr.min.js
@gzip -c lunr.min.js | wc -c
server:
${NODE} server.js ${SERVER_PORT}
test: node_modules
@./test/runner.sh ${TEST_PORT}
docs: node_modules
${DOX} < lunr.js | ${DOX_TEMPLATE} -n lunr.js -r ${VERSION} > docs/index.html
clean:
rm -f lunr{.min,}.js
rm *.json
rm example/example_index.json
reset:
git checkout lunr.* *.json docs/index.html example/example_index.json
example: lunr.min.js
${NODE} example/index_builder.js
node_modules: package.json
${NPM} -s install
.PHONY: test clean docs reset example