Chris@16
|
1 PSYSH_SRC = bin src box.json.dist composer.json build/stub
|
Chris@16
|
2 PSYSH_SRC_FILES = $(shell find src -type f -name "*.php")
|
Chris@16
|
3 VERSION = $(shell git describe --tag --always --dirty=-dev)
|
Chris@16
|
4
|
Chris@16
|
5 COMPOSER_OPTS = --no-interaction --no-progress --verbose
|
Chris@16
|
6 COMPOSER_REQUIRE_OPTS = $(COMPOSER_OPTS) --no-update
|
Chris@16
|
7 COMPOSER_UPDATE_OPTS = $(COMPOSER_OPTS) --prefer-stable --no-dev --classmap-authoritative --prefer-dist
|
Chris@16
|
8
|
Chris@16
|
9
|
Chris@16
|
10 # Commands
|
Chris@16
|
11
|
Chris@16
|
12 .PHONY: help clean build dist
|
Chris@16
|
13 .DEFAULT_GOAL := help
|
Chris@16
|
14
|
Chris@16
|
15 help:
|
Chris@16
|
16 @echo "\033[33mUsage:\033[0m\n make TARGET\n\n\033[33mTargets:\033[0m"
|
Chris@16
|
17 @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-7s\033[0m %s\n", $$1, $$2}'
|
Chris@16
|
18
|
Chris@16
|
19 clean: ## Clean all created artifacts
|
Chris@16
|
20 rm -rf build/*
|
Chris@16
|
21 rm -rf dist/*
|
Chris@16
|
22 rm -rf vendor-bin/*/vendor/
|
Chris@16
|
23
|
Chris@16
|
24 build: ## Compile PHARs
|
Chris@16
|
25 build: build/psysh/psysh build/psysh-compat/psysh build/psysh-php54/psysh build/psysh-php54-compat/psysh
|
Chris@16
|
26
|
Chris@16
|
27 dist: ## Build tarballs for distribution
|
Chris@16
|
28 dist: dist/psysh-$(VERSION).tar.gz dist/psysh-$(VERSION)-compat.tar.gz dist/psysh-$(VERSION)-php54.tar.gz dist/psysh-$(VERSION)-php54-compat.tar.gz
|
Chris@16
|
29
|
Chris@16
|
30
|
Chris@16
|
31 # All the composer stuffs
|
Chris@16
|
32
|
Chris@16
|
33 composer.lock: composer.json
|
Chris@16
|
34 composer install
|
Chris@16
|
35 touch $@
|
Chris@16
|
36
|
Chris@16
|
37 vendor/autoload.php: composer.lock
|
Chris@16
|
38 composer install
|
Chris@16
|
39 touch $@
|
Chris@16
|
40
|
Chris@16
|
41 vendor/bin/box: vendor/autoload.php
|
Chris@16
|
42 composer bin box install
|
Chris@16
|
43 touch $@
|
Chris@16
|
44
|
Chris@16
|
45
|
Chris@16
|
46 # Lots of PHARs
|
Chris@16
|
47
|
Chris@16
|
48 build/stub: bin/build-stub bin/psysh LICENSE
|
Chris@16
|
49 bin/build-stub
|
Chris@16
|
50
|
Chris@16
|
51 build/psysh: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
|
Chris@16
|
52 rm -rf $@ || true
|
Chris@16
|
53 mkdir $@
|
Chris@16
|
54 cp -R $(PSYSH_SRC) $@/
|
Chris@16
|
55 composer config --working-dir $@ platform.php 7.0
|
Chris@16
|
56 composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) php:'>=7.0.0'
|
Chris@16
|
57 composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
|
Chris@16
|
58
|
Chris@16
|
59 build/psysh-compat: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
|
Chris@16
|
60 rm -rf $@ || true
|
Chris@16
|
61 mkdir $@
|
Chris@16
|
62 cp -R $(PSYSH_SRC) $@/
|
Chris@16
|
63 composer config --working-dir $@ platform.php 7.0
|
Chris@16
|
64 composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) php:'>=7.0.0'
|
Chris@16
|
65 composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) symfony/polyfill-iconv symfony/polyfill-mbstring hoa/console
|
Chris@16
|
66 composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
|
Chris@16
|
67
|
Chris@16
|
68 build/psysh-php54: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
|
Chris@16
|
69 rm -rf $@ || true
|
Chris@16
|
70 mkdir $@
|
Chris@16
|
71 cp -R $(PSYSH_SRC) $@/
|
Chris@16
|
72 composer config --working-dir $@ platform.php 5.4
|
Chris@16
|
73 composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
|
Chris@16
|
74
|
Chris@16
|
75 build/psysh-php54-compat: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
|
Chris@16
|
76 rm -rf $@ || true
|
Chris@16
|
77 mkdir $@
|
Chris@16
|
78 cp -R $(PSYSH_SRC) $@/
|
Chris@16
|
79 composer config --working-dir $@ platform.php 5.4
|
Chris@16
|
80 composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) symfony/polyfill-iconv symfony/polyfill-mbstring hoa/console:^2.15
|
Chris@16
|
81 composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
|
Chris@16
|
82
|
Chris@16
|
83 build/%/psysh: vendor/bin/box build/%
|
Chris@16
|
84 vendor/bin/box compile --working-dir $(dir $@)
|
Chris@16
|
85
|
Chris@16
|
86
|
Chris@16
|
87 # Dist packages
|
Chris@16
|
88
|
Chris@16
|
89 dist/psysh-$(VERSION).tar.gz: build/psysh/psysh
|
Chris@16
|
90 @mkdir -p $(@D)
|
Chris@16
|
91 tar -C $(dir $<) -czf $@ $(notdir $<)
|
Chris@16
|
92
|
Chris@16
|
93 dist/psysh-$(VERSION)-%.tar.gz: build/psysh-%/psysh
|
Chris@16
|
94 @mkdir -p $(@D)
|
Chris@16
|
95 tar -C $(dir $<) -czf $@ $(notdir $<)
|