Makefile 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. .PHONY: all coverage coverage-js coverage-php doc doc-js doc-php increment sign test test-js test-php help
  2. CURRENT_VERSION = 1.3.5
  3. VERSION ?= 1.3.6
  4. VERSION_FILES = index.php cfg/ *.md css/ i18n/ img/ js/privatebin.js lib/ Makefile tpl/ tst/
  5. REGEX_CURRENT_VERSION := $(shell echo $(CURRENT_VERSION) | sed "s/\./\\\./g")
  6. REGEX_VERSION := $(shell echo $(VERSION) | sed "s/\./\\\./g")
  7. all: coverage doc ## Equivalent to running `make coverage doc`.
  8. coverage: coverage-js coverage-php ## Run all unit tests and generate code coverage reports.
  9. coverage-js: ## Run JS unit tests and generate code coverage reports.
  10. cd js && nyc mocha
  11. coverage-php: ## Run PHP unit tests and generate code coverage reports.
  12. cd tst && phpunit 2> /dev/null
  13. cd log/php-coverage-report && sed -i "s#$(CURDIR)##g" *.html */*.html
  14. doc: doc-js doc-php ## Generate all code documentation.
  15. doc-js: ## Generate JS code documentation.
  16. jsdoc -p -d doc/jsdoc js/privatebin.js js/legacy.js
  17. doc-php: ## Generate JS code documentation.
  18. phpdoc --visibility public,protected,private -t doc/phpdoc -d lib/
  19. increment: ## Increment and commit new version number, set target version using `make increment VERSION=1.2.3`.
  20. for F in `grep -l -R $(REGEX_CURRENT_VERSION) $(VERSION_FILES) | grep -v -e tst/log/ -e ":0" -e CHANGELOG.md`; \
  21. do \
  22. sed -i "s/$(REGEX_CURRENT_VERSION)/$(REGEX_VERSION)/g" $$F; \
  23. done
  24. git add $(VERSION_FILES)
  25. git commit -m "incrementing version"
  26. sign: ## Sign a release.
  27. git tag $(VERSION)
  28. git push --tags
  29. signrelease.sh
  30. test: test-js test-php ## Run all unit tests.
  31. test-js: ## Run JS unit tests.
  32. cd js && mocha
  33. test-php: ## Run PHP unit tests.
  34. cd tst && phpunit --no-coverage
  35. help: ## Displays these usage instructions.
  36. @echo "Usage: make <target(s)>"
  37. @echo
  38. @echo "Specify one or multiple of the following targets and they will be processed in the given order:"
  39. @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "%-16s%s\n", $$1, $$2}' $(MAKEFILE_LIST)