forked from bobthecow/psysh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
107 lines (79 loc) · 3.23 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
PSYSH_SRC = bin src box.json.dist composer.json build/stub scoper.inc.php
PSYSH_SRC_FILES = $(shell find src -type f -name "*.php")
VERSION = $(shell git describe --tag --always --dirty=-dev)
COMPOSER_OPTS = --no-interaction --no-progress --verbose
COMPOSER_REQUIRE_OPTS = $(COMPOSER_OPTS) --no-update
COMPOSER_UPDATE_OPTS = $(COMPOSER_OPTS) --prefer-stable --no-dev --classmap-authoritative --prefer-dist
ifneq ($(CI),)
PHPUNIT_OPTS = --verbose --coverage-clover=coverage.xml
endif
# Commands
.PHONY: help build clean dist test
.DEFAULT_GOAL := help
help:
@echo "\033[33mUsage:\033[0m\n make TARGET\n\n\033[33mTargets:\033[0m"
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-7s\033[0m %s\n", $$1, $$2}'
build: ## Compile PHARs (use `build/psysh/psysh` for just the default build!)
build: build/psysh/psysh build/psysh-compat/psysh build/psysh-php55/psysh build/psysh-php55-compat/psysh
clean: ## Clean all created artifacts
rm -rf build/*
rm -rf dist/*
rm -rf vendor-bin/*/vendor/
dist: ## Build tarballs for distribution
dist: dist/psysh-$(VERSION).tar.gz dist/psysh-$(VERSION)-compat.tar.gz dist/psysh-$(VERSION)-php55.tar.gz dist/psysh-$(VERSION)-php55-compat.tar.gz
test: ## Run unit tests
test: vendor/bin/phpunit
$< $(PHPUNIT_OPTS)
# All the composer stuffs
composer.lock: composer.json
composer install
touch $@
vendor/autoload.php: composer.lock
composer install
touch $@
vendor/bin/box: vendor/autoload.php
composer bin box install
touch $@
vendor/bin/phpunit: vendor/autoload.php
composer bin phpunit install --ignore-platform-reqs
touch $@
# Lots of PHARs
build/stub: bin/build-stub bin/psysh LICENSE
bin/build-stub
build/psysh: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
rm -rf $@ || true
mkdir $@
cp -R $(PSYSH_SRC) $@/
composer config --working-dir $@ platform.php 7.2.5
composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) php:'>=7.2.5'
composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
build/psysh-compat: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
rm -rf $@ || true
mkdir $@
cp -R $(PSYSH_SRC) $@/
composer config --working-dir $@ platform.php 7.2.5
composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) php:'>=7.2.5'
composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) symfony/polyfill-iconv symfony/polyfill-mbstring hoa/console
composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
build/psysh-php55: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
rm -rf $@ || true
mkdir $@
cp -R $(PSYSH_SRC) $@/
composer config --working-dir $@ platform.php 5.5.9
composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
build/psysh-php55-compat: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
rm -rf $@ || true
mkdir $@
cp -R $(PSYSH_SRC) $@/
composer config --working-dir $@ platform.php 5.5.9
composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) symfony/polyfill-iconv symfony/polyfill-mbstring hoa/console:^2.15
composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
build/%/psysh: vendor/bin/box build/%
vendor/bin/box compile --working-dir $(dir $@)
# Dist packages
dist/psysh-$(VERSION).tar.gz: build/psysh/psysh
@mkdir -p $(@D)
tar -C $(dir $<) -czf $@ $(notdir $<)
dist/psysh-$(VERSION)-%.tar.gz: build/psysh-%/psysh
@mkdir -p $(@D)
tar -C $(dir $<) -czf $@ $(notdir $<)