Makefile 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # get Makefile directory name: http://stackoverflow.com/a/5982798/376773
  2. THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
  3. THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd)
  4. # BIN directory
  5. BIN := $(THIS_DIR)/node_modules/.bin
  6. # applications
  7. NODE ?= node
  8. NPM ?= $(NODE) $(shell which npm)
  9. BROWSERIFY ?= $(NODE) $(BIN)/browserify
  10. MOCHA ?= $(NODE) $(BIN)/mocha
  11. ZUUL ?= $(NODE) $(BIN)/zuul
  12. REPORTER ?= spec
  13. all: dist/plist.js dist/plist-build.js dist/plist-parse.js
  14. install: node_modules
  15. clean:
  16. @rm -rf node_modules dist
  17. dist:
  18. @mkdir -p $@
  19. dist/plist-build.js: node_modules lib/build.js dist
  20. @$(BROWSERIFY) \
  21. --standalone plist \
  22. lib/build.js > $@
  23. dist/plist-parse.js: node_modules lib/parse.js dist
  24. @$(BROWSERIFY) \
  25. --standalone plist \
  26. lib/parse.js > $@
  27. dist/plist.js: node_modules lib/*.js dist
  28. @$(BROWSERIFY) \
  29. --standalone plist \
  30. --ignore lib/node.js \
  31. lib/plist.js > $@
  32. node_modules: package.json
  33. @NODE_ENV= $(NPM) install
  34. @touch node_modules
  35. test:
  36. @if [ "x$(BROWSER_NAME)" = "x" ]; then \
  37. $(MAKE) test-node; \
  38. else \
  39. $(MAKE) test-zuul; \
  40. fi
  41. test-node:
  42. @$(MOCHA) \
  43. --reporter $(REPORTER) \
  44. test/*.js
  45. test-zuul:
  46. @if [ "x$(BROWSER_PLATFORM)" = "x" ]; then \
  47. $(ZUUL) \
  48. --ui mocha-bdd \
  49. --browser-name $(BROWSER_NAME) \
  50. --browser-version $(BROWSER_VERSION) \
  51. test/*.js; \
  52. else \
  53. $(ZUUL) \
  54. --ui mocha-bdd \
  55. --browser-name $(BROWSER_NAME) \
  56. --browser-version $(BROWSER_VERSION) \
  57. --browser-platform "$(BROWSER_PLATFORM)" \
  58. test/*.js; \
  59. fi
  60. .PHONY: all install clean test test-node test-zuul