From aa45391808fba1c58f04e68f26ee439e67dd8355 Mon Sep 17 00:00:00 2001 From: dana Date: Sat, 2 Jun 2018 01:46:50 -0500 Subject: [PATCH] Improve Makefile --- Makefile | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 9dad973..7a66a01 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,45 @@ ## # This file is part of twigc. # -# @author dana geier +# @author dana # @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