Chris@16: PSYSH_SRC = bin src box.json.dist composer.json build/stub Chris@16: PSYSH_SRC_FILES = $(shell find src -type f -name "*.php") Chris@16: VERSION = $(shell git describe --tag --always --dirty=-dev) Chris@16: Chris@16: COMPOSER_OPTS = --no-interaction --no-progress --verbose Chris@16: COMPOSER_REQUIRE_OPTS = $(COMPOSER_OPTS) --no-update Chris@16: COMPOSER_UPDATE_OPTS = $(COMPOSER_OPTS) --prefer-stable --no-dev --classmap-authoritative --prefer-dist Chris@16: Chris@16: Chris@16: # Commands Chris@16: Chris@16: .PHONY: help clean build dist Chris@16: .DEFAULT_GOAL := help Chris@16: Chris@16: help: Chris@16: @echo "\033[33mUsage:\033[0m\n make TARGET\n\n\033[33mTargets:\033[0m" Chris@16: @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-7s\033[0m %s\n", $$1, $$2}' Chris@16: Chris@16: clean: ## Clean all created artifacts Chris@16: rm -rf build/* Chris@16: rm -rf dist/* Chris@16: rm -rf vendor-bin/*/vendor/ Chris@16: Chris@16: build: ## Compile PHARs Chris@16: build: build/psysh/psysh build/psysh-compat/psysh build/psysh-php54/psysh build/psysh-php54-compat/psysh Chris@16: Chris@16: dist: ## Build tarballs for distribution Chris@16: 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: Chris@16: Chris@16: # All the composer stuffs Chris@16: Chris@16: composer.lock: composer.json Chris@16: composer install Chris@16: touch $@ Chris@16: Chris@16: vendor/autoload.php: composer.lock Chris@16: composer install Chris@16: touch $@ Chris@16: Chris@16: vendor/bin/box: vendor/autoload.php Chris@16: composer bin box install Chris@16: touch $@ Chris@16: Chris@16: Chris@16: # Lots of PHARs Chris@16: Chris@16: build/stub: bin/build-stub bin/psysh LICENSE Chris@16: bin/build-stub Chris@16: Chris@16: build/psysh: $(PSYSH_SRC) $(PSYSH_SRC_FILES) Chris@16: rm -rf $@ || true Chris@16: mkdir $@ Chris@16: cp -R $(PSYSH_SRC) $@/ Chris@16: composer config --working-dir $@ platform.php 7.0 Chris@16: composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) php:'>=7.0.0' Chris@16: composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS) Chris@16: Chris@16: build/psysh-compat: $(PSYSH_SRC) $(PSYSH_SRC_FILES) Chris@16: rm -rf $@ || true Chris@16: mkdir $@ Chris@16: cp -R $(PSYSH_SRC) $@/ Chris@16: composer config --working-dir $@ platform.php 7.0 Chris@16: composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) php:'>=7.0.0' Chris@16: composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) symfony/polyfill-iconv symfony/polyfill-mbstring hoa/console Chris@16: composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS) Chris@16: Chris@16: build/psysh-php54: $(PSYSH_SRC) $(PSYSH_SRC_FILES) Chris@16: rm -rf $@ || true Chris@16: mkdir $@ Chris@16: cp -R $(PSYSH_SRC) $@/ Chris@16: composer config --working-dir $@ platform.php 5.4 Chris@16: composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS) Chris@16: Chris@16: build/psysh-php54-compat: $(PSYSH_SRC) $(PSYSH_SRC_FILES) Chris@16: rm -rf $@ || true Chris@16: mkdir $@ Chris@16: cp -R $(PSYSH_SRC) $@/ Chris@16: composer config --working-dir $@ platform.php 5.4 Chris@16: composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) symfony/polyfill-iconv symfony/polyfill-mbstring hoa/console:^2.15 Chris@16: composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS) Chris@16: Chris@16: build/%/psysh: vendor/bin/box build/% Chris@16: vendor/bin/box compile --working-dir $(dir $@) Chris@16: Chris@16: Chris@16: # Dist packages Chris@16: Chris@16: dist/psysh-$(VERSION).tar.gz: build/psysh/psysh Chris@16: @mkdir -p $(@D) Chris@16: tar -C $(dir $<) -czf $@ $(notdir $<) Chris@16: Chris@16: dist/psysh-$(VERSION)-%.tar.gz: build/psysh-%/psysh Chris@16: @mkdir -p $(@D) Chris@16: tar -C $(dir $<) -czf $@ $(notdir $<)