2016-07-24 20:28:55 +02:00
|
|
|
##
|
|
|
|
# This file is part of twigc.
|
|
|
|
#
|
2018-06-02 08:46:50 +02:00
|
|
|
# @author dana <dana@dana.is>
|
2016-07-24 20:28:55 +02:00
|
|
|
# @license MIT
|
|
|
|
|
2020-04-22 19:43:40 +02:00
|
|
|
prefix ?= /usr/local
|
|
|
|
bindir ?= $(prefix)/bin
|
|
|
|
|
2018-06-02 08:46:50 +02:00
|
|
|
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'
|
2016-07-24 20:28:55 +02:00
|
|
|
|
|
|
|
vendor:
|
|
|
|
composer install
|
|
|
|
|
2018-06-02 08:46:50 +02:00
|
|
|
twigc.phar:
|
|
|
|
composer install -q --no-dev
|
2018-01-14 21:53:07 +01:00
|
|
|
php -d phar.readonly=0 bin/compile
|
2018-06-02 08:46:50 +02:00
|
|
|
composer install -q
|
2016-07-24 20:28:55 +02:00
|
|
|
|
2018-06-02 08:46:50 +02:00
|
|
|
test-unit: vendor
|
|
|
|
vendor/bin/phpunit
|
2016-07-24 20:28:55 +02:00
|
|
|
|
2018-06-02 08:46:50 +02:00
|
|
|
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
|
2020-04-22 19:43:40 +02:00
|
|
|
cp twigc.phar $(DESTDIR)$(bindir)/twigc
|
2016-07-24 20:28:55 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f twigc.phar
|
|
|
|
|
|
|
|
distclean: clean
|
|
|
|
rm -rf vendor/
|
|
|
|
|
2020-04-22 19:43:40 +02:00
|
|
|
.PHONY: all build clean distclean help install phar test test-integration test-unit
|