Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. #---- Tools
  2. NODEUNIT := ./node_modules/.bin/nodeunit
  3. SUDO := sudo
  4. ifeq ($(shell uname -s),SunOS)
  5. # On SunOS (e.g. SmartOS) we expect to run the test suite as the
  6. # root user -- necessary to run dtrace. Therefore `pfexec` isn't
  7. # necessary.
  8. SUDO :=
  9. endif
  10. DTRACE_UP_IN_HERE=
  11. ifeq ($(shell uname -s),SunOS)
  12. DTRACE_UP_IN_HERE=1
  13. endif
  14. ifeq ($(shell uname -s),Darwin)
  15. DTRACE_UP_IN_HERE=1
  16. endif
  17. NODEOPT ?= $(HOME)/opt
  18. #---- Files
  19. JSSTYLE_FILES := $(shell find lib test tools examples -name "*.js") bin/bunyan
  20. # All test files *except* dtrace.test.js.
  21. NON_DTRACE_TEST_FILES := $(shell ls -1 test/*.test.js | grep -v dtrace | xargs)
  22. #---- Targets
  23. all $(NODEUNIT):
  24. npm install $(NPM_INSTALL_FLAGS)
  25. # Ensure all version-carrying files have the same version.
  26. .PHONY: versioncheck
  27. versioncheck:
  28. @echo version is: $(shell cat package.json | json version)
  29. [[ `cat package.json | json version` == `grep '^## ' CHANGES.md | head -2 | tail -1 | awk '{print $$2}'` ]]
  30. [[ `cat package.json | json version` == `grep '^var VERSION' bin/bunyan | awk -F"'" '{print $$2}'` ]]
  31. [[ `cat package.json | json version` == `grep '^var VERSION' lib/bunyan.js | awk -F"'" '{print $$2}'` ]]
  32. @echo Version check ok.
  33. .PHONY: cutarelease
  34. cutarelease: check
  35. [[ -z `git status --short` ]] # If this fails, the working dir is dirty.
  36. @which json 2>/dev/null 1>/dev/null && \
  37. ver=$(shell json -f package.json version) && \
  38. name=$(shell json -f package.json name) && \
  39. publishedVer=$(shell npm view -j $(shell json -f package.json name)@$(shell json -f package.json version) version 2>/dev/null) && \
  40. if [[ -n "$$publishedVer" ]]; then \
  41. echo "error: $$name@$$ver is already published to npm"; \
  42. exit 1; \
  43. fi && \
  44. echo "** Are you sure you want to tag and publish $$name@$$ver to npm?" && \
  45. echo "** Enter to continue, Ctrl+C to abort." && \
  46. read
  47. ver=$(shell cat package.json | json version) && \
  48. date=$(shell date -u "+%Y-%m-%d") && \
  49. git tag -a "$$ver" -m "version $$ver ($$date)" && \
  50. git push --tags origin && \
  51. npm publish
  52. .PHONY: docs
  53. docs: toc
  54. @[[ `which ronn` ]] || (echo "No 'ronn' on your PATH. Install with 'gem install ronn'" && exit 2)
  55. mkdir -p man/man1
  56. ronn --style=toc --manual="bunyan manual" --date=$(shell git log -1 --pretty=format:%cd --date=short) --roff --html docs/bunyan.1.ronn
  57. python -c 'import sys; h = open("docs/bunyan.1.html").read(); h = h.replace(".mp dt.flush {float:left;width:8ex}", ""); open("docs/bunyan.1.html", "w").write(h)'
  58. python -c 'import sys; h = open("docs/bunyan.1.html").read(); h = h.replace("</body>", """<a href="https://github.com/trentm/node-bunyan"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a></body>"""); open("docs/bunyan.1.html", "w").write(h)'
  59. @echo "# test with 'man ./docs/bunyan.1' and 'open ./docs/bunyan.1.html'"
  60. # Re-generate the README.md table of contents.
  61. toc:
  62. ./node_modules/.bin/markdown-toc -i README.md
  63. .PHONY: publish
  64. publish:
  65. mkdir -p tmp
  66. [[ -d tmp/bunyan-gh-pages ]] || git clone git@github.com:trentm/node-bunyan.git tmp/bunyan-gh-pages
  67. cd tmp/bunyan-gh-pages && git checkout gh-pages && git pull --rebase origin gh-pages
  68. cp docs/index.html tmp/bunyan-gh-pages/index.html
  69. cp docs/bunyan.1.html tmp/bunyan-gh-pages/bunyan.1.html
  70. (cd tmp/bunyan-gh-pages \
  71. && git commit -a -m "publish latest docs" \
  72. && git push origin gh-pages || true)
  73. .PHONY: distclean
  74. distclean:
  75. rm -rf node_modules
  76. #---- test
  77. .PHONY: test
  78. test: $(NODEUNIT)
  79. test -z "$(DTRACE_UP_IN_HERE)" || test -n "$(SKIP_DTRACE)" || \
  80. (node -e 'require("dtrace-provider").createDTraceProvider("isthisthingon")' && \
  81. echo "\nNote: Use 'SKIP_DTRACE=1 make test' to skip parts of the test suite that require root." && \
  82. $(SUDO) $(NODEUNIT) test/dtrace.test.js)
  83. $(NODEUNIT) $(NON_DTRACE_TEST_FILES)
  84. # Test will all node supported versions (presumes install locations I use on
  85. # my machine -- "~/opt/node-VER"):
  86. # Note: 'test4' is last so (if all is well) I end up with a binary
  87. # dtrace-provider build for my current default node version.
  88. .PHONY: testall
  89. testall: test7 test6 test012 test010 test4
  90. .PHONY: test7
  91. test7:
  92. @echo "# Test node 7.x (with node `$(NODEOPT)/node-7/bin/node --version`)"
  93. @$(NODEOPT)/node-7/bin/node --version | grep '^v7\.'
  94. PATH="$(NODEOPT)/node-7/bin:$(PATH)" make distclean all test
  95. .PHONY: test6
  96. test6:
  97. @echo "# Test node 6.x (with node `$(NODEOPT)/node-6/bin/node --version`)"
  98. @$(NODEOPT)/node-6/bin/node --version | grep '^v6\.'
  99. PATH="$(NODEOPT)/node-6/bin:$(PATH)" make distclean all test
  100. .PHONY: test4
  101. test4:
  102. @echo "# Test node 4.x (with node `$(NODEOPT)/node-4/bin/node --version`)"
  103. @$(NODEOPT)/node-4/bin/node --version | grep '^v4\.'
  104. PATH="$(NODEOPT)/node-4/bin:$(PATH)" make distclean all test
  105. .PHONY: test012
  106. test012:
  107. @echo "# Test node 0.12.x (with node `$(NODEOPT)/node-0.12/bin/node --version`)"
  108. @$(NODEOPT)/node-0.12/bin/node --version | grep '^v0\.12\.'
  109. PATH="$(NODEOPT)/node-0.12/bin:$(PATH)" make distclean all test
  110. .PHONY: test010
  111. test010:
  112. @echo "# Test node 0.10.x (with node `$(NODEOPT)/node-0.10/bin/node --version`)"
  113. @$(NODEOPT)/node-0.10/bin/node --version | grep '^v0\.10\.'
  114. PATH="$(NODEOPT)/node-0.10/bin:$(PATH)" make distclean all test
  115. #---- check
  116. .PHONY: check-jsstyle
  117. check-jsstyle: $(JSSTYLE_FILES)
  118. ./tools/jsstyle -o indent=4,doxygen,unparenthesized-return=0,blank-after-start-comment=0,leading-right-paren-ok=1 $(JSSTYLE_FILES)
  119. .PHONY: check
  120. check: check-jsstyle versioncheck
  121. @echo "Check ok."
  122. .PHONY: prepush
  123. prepush: check testall
  124. @echo "Okay to push."