Makefile 1.5 KB

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