Improve Makefile

This commit is contained in:
dana 2018-06-02 01:46:50 -05:00
parent 97f8acb902
commit aa45391808

View file

@ -1,20 +1,45 @@
##
# This file is part of twigc.
#
# @author dana geier <dana@dana.is>
# @author dana <dana@dana.is>
# @license MIT
all: build
all: build
build: phar
phar: clean twigc.phar
test: test-unit test-integration
help:
@echo 'Available targets:'
@echo 'all ................ Equivalent to `build`'
@echo 'build .............. Equivalent to `vendor`'
@echo 'install ............ Install phar to `/usr/local/bin/twigc`'
@echo 'clean .............. Remove phar'
@echo 'distclean .......... Remove phar and vendor directory'
@echo 'phar ............... Equivalent to `twigc.phar`'
@echo 'test ............... Run unit and integration tests'
@echo 'test-integration ... Run integration tests against phar'
@echo 'test-unit .......... Run unit tests against source'
@echo 'twigc.phar ......... Build phar'
@echo 'vendor ............. Install vendor directory via Composer'
vendor:
composer install
twigc.phar: vendor
twigc.phar:
composer install -q --no-dev
php -d phar.readonly=0 bin/compile
composer install -q
build: twigc.phar
test-unit: vendor
vendor/bin/phpunit
install: build
test-integration: twigc.phar
./twigc.phar --help | grep -q -- --version
echo 'hello {{ name }}' | ./twigc.phar -j '{ "name": "foo" }' | grep -qF 'hello foo'
echo 'hello {{ name }}' | ./twigc.phar -p name=foo | grep -qF 'hello foo'
install: twigc.phar
cp twigc.phar /usr/local/bin/twigc
clean:
@ -23,5 +48,4 @@ clean:
distclean: clean
rm -rf vendor/
.PHONY: all build install clean distclean
.PHONY: all clean distclean install test test-integration test-unit