2019-06-17 15:41:01 +02:00
|
|
|
.PHONY: help tests dist
|
2018-12-24 14:06:13 +01:00
|
|
|
.DEFAULT_GOAL := help
|
2019-06-20 15:32:26 +02:00
|
|
|
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
|
2019-09-28 00:42:10 +02:00
|
|
|
VERSION := $(if $(TAG),$(TAG),dev-$(BRANCH))
|
2018-12-24 14:06:13 +01:00
|
|
|
|
|
|
|
help:
|
|
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
|
|
|
|
2020-08-02 20:35:42 +02:00
|
|
|
install-dev: ## Installs the required common devtools
|
|
|
|
@echo "Downloading phpdoc"
|
|
|
|
@wget https://phpdoc.org/phpDocumentor.phar -O bin/phpdoc 2> /dev/null
|
|
|
|
@echo "Downloading phpcs"
|
|
|
|
@wget https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar -O bin/phpcs 2> /dev/null
|
|
|
|
@wget https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar -O bin/phpcbf 2> /dev/null
|
2020-08-02 21:51:59 +02:00
|
|
|
@echo "Adding execution rights on the binaries"
|
|
|
|
@chmod +x bin/phpcs bin/phpcbf bin/phpdoc
|
2020-08-02 20:35:42 +02:00
|
|
|
@echo "Installation of devtools finished"
|
|
|
|
@echo "Please add $(shell echo $(PWD))/bin to your PATH"
|
2018-12-24 14:06:13 +01:00
|
|
|
|
2020-08-02 20:35:42 +02:00
|
|
|
docs: ## Generates api-docs
|
2019-11-17 01:19:21 +01:00
|
|
|
phpdoc -d ./src -t ./doc/api
|
2019-06-17 14:58:06 +02:00
|
|
|
|
2020-11-22 17:20:25 +01:00
|
|
|
dist: ## Generates distribution
|
|
|
|
cp dist/composer* res/
|
|
|
|
mv dist/composer-dist.json dist/composer.json
|
|
|
|
sed -i -e "s%//VERSION//%$(VERSION)%g" dist/composer.json
|
|
|
|
cd dist && composer install
|
|
|
|
rm dist/composer.json
|
|
|
|
rm dist/composer.lock
|
|
|
|
mv dist/composer-dist-installed.json dist/composer.json
|
|
|
|
make api
|
|
|
|
mkdir -p dist/doc
|
|
|
|
cp -r doc/api dist/doc
|
|
|
|
cd dist && zip -r ../libpairtwo-$(VERSION)-dist.zip *
|
|
|
|
git reset --hard HEAD
|
|
|
|
mv res/composer* dist/
|
|
|
|
|
|
|
|
clean: clean-dist clean-dev clean-repo ## Cleans all assets
|
2018-12-24 14:06:13 +01:00
|
|
|
|
2020-11-22 17:20:25 +01:00
|
|
|
clean-dev: ## Cleans dev assets
|
|
|
|
rm -rf doc/api
|
|
|
|
rm -rf .idea
|
|
|
|
rm -rf .libpairtwo-distro
|
|
|
|
rm -rf vendor
|
|
|
|
rm -rf composer.lock
|
|
|
|
|
|
|
|
clean-dist: ## Cleans distribution assets
|
|
|
|
rm -rf dist/doc
|
|
|
|
rm -rf dist/vendor
|
|
|
|
rm -rf dist/composer.json
|
|
|
|
rm -rf libpairtwo-*-dist.zip
|
|
|
|
|
|
|
|
clean-repo: ## Cleans the git repository
|
|
|
|
git fsck
|
|
|
|
git prune
|
|
|
|
git gc
|
2018-12-24 14:06:13 +01:00
|
|
|
|
2019-06-17 15:41:01 +02:00
|
|
|
api: ## Generates api-docs
|
2019-11-17 01:23:11 +01:00
|
|
|
phpdoc -d ./src -t ./doc/api
|
2019-06-17 15:41:01 +02:00
|
|
|
|
|
|
|
dist: ## Generates distribution
|
|
|
|
cp dist/composer* res/
|
|
|
|
mv dist/composer-dist.json dist/composer.json
|
2019-09-28 00:42:10 +02:00
|
|
|
sed -i -e "s%//VERSION//%$(VERSION)%g" dist/composer.json
|
2019-06-17 15:41:01 +02:00
|
|
|
cd dist && composer install
|
|
|
|
rm dist/composer.json
|
|
|
|
rm dist/composer.lock
|
|
|
|
mv dist/composer-dist-installed.json dist/composer.json
|
2019-06-20 15:32:26 +02:00
|
|
|
make api
|
2019-06-17 15:41:01 +02:00
|
|
|
mkdir -p dist/doc
|
|
|
|
cp -r doc/api dist/doc
|
2019-06-20 15:32:26 +02:00
|
|
|
cd dist && zip -r ../libpairtwo-$(VERSION)-dist.zip *
|
2019-09-28 00:42:10 +02:00
|
|
|
git reset --hard HEAD
|
2019-06-17 15:41:01 +02:00
|
|
|
mv res/composer* dist/
|
|
|
|
|
2019-11-15 17:36:24 +01:00
|
|
|
clean: clean-dist clean-dev clean-repo ## Cleans all assets
|
2019-06-20 15:32:26 +02:00
|
|
|
|
2019-11-15 17:36:24 +01:00
|
|
|
clean-dev: ## Cleans dev assets
|
2019-06-17 15:41:01 +02:00
|
|
|
rm -rf doc/api
|
|
|
|
rm -rf .idea
|
|
|
|
rm -rf .libpairtwo-distro
|
|
|
|
rm -rf vendor
|
|
|
|
rm -rf composer.lock
|
2019-06-20 15:32:26 +02:00
|
|
|
|
2019-11-15 17:36:24 +01:00
|
|
|
clean-dist: ## Cleans distribution assets
|
2019-06-20 15:32:26 +02:00
|
|
|
rm -rf dist/doc
|
2019-06-17 15:41:01 +02:00
|
|
|
rm -rf dist/vendor
|
|
|
|
rm -rf dist/composer.json
|
2019-06-20 15:32:26 +02:00
|
|
|
rm -rf libpairtwo-*-dist.zip
|
2019-06-17 15:41:01 +02:00
|
|
|
|
2019-11-15 17:36:24 +01:00
|
|
|
clean-repo: ## Cleans the git repository
|
|
|
|
git fsck
|
|
|
|
git prune
|
|
|
|
git gc
|
|
|
|
|
2018-12-24 14:06:13 +01:00
|
|
|
cs: ## Fixes coding standard problems
|
2020-08-02 21:51:59 +02:00
|
|
|
php bin/phpcs || true
|
2018-12-24 14:06:13 +01:00
|
|
|
|
|
|
|
tag: ## Creates a new signed git tag
|
|
|
|
$(if $(TAG),,$(error TAG is not defined. Pass via "make tag TAG=X.X.X"))
|
|
|
|
@echo Tagging $(TAG)
|
|
|
|
git add --all
|
2019-06-20 15:32:26 +02:00
|
|
|
git commit -m 'RELEASE: $(TAG) Release'
|
|
|
|
git tag -s $(TAG) -m 'RELEASE: $(TAG) Release'
|
|
|
|
make dist
|