From a896e33f3b4f529ed81fa06be62b9592556cd9f2 Mon Sep 17 00:00:00 2001 From: Pepijn Over Date: Thu, 7 Aug 2014 13:48:33 +0200 Subject: [PATCH] Makefile: changing export name of archives --- Makefile | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/Makefile b/Makefile index e536cb75..f4c6d585 100755 --- a/Makefile +++ b/Makefile @@ -1,8 +1,10 @@ tag = $(shell git describe) -export_name = phpservermon-$(tag) +VERSION = ${subst v,,$(tag)} +RELEASE_DIR = ./build +RELEASE_FILE = phpservermon-$(VERSION) help: - @echo ' PHP Server Monitor - $(tag) ' + @echo ' PHP Server Monitor - $(tag)' @echo ' - make export [tag=...] - create a new release from tag ' @echo ' - make install - install all dependencies ' @@ -13,31 +15,31 @@ install: export: @echo 'Building release for tag $(tag) ' - mkdir -p ./build ./build/$(export_name) - rm -rf ./build/$(export_name)/* - git archive $(tag) | tar -xf - -C ./build/$(export_name)/ - #find ./build/$(export_name) -name "*.php" -exec sed -i "" "s/@package_version@/$(tag)/" {} \; # for osx - find ./build/$(export_name) -name "*.php" -exec sed -i "s/@package_version@/$(tag)/" {} \; # for linux + mkdir -p $(RELEASE_DIR) $(RELEASE_DIR)/$(RELEASE_FILE) + rm -rf $(RELEASE_DIR)/$(RELEASE_FILE)/* + git archive $(tag) | tar -xf - -C $(RELEASE_DIR)/$(RELEASE_FILE)/ + #find $(RELEASE_DIR)/$(RELEASE_FILE) -name "*.php" -exec sed -i "" "s/@package_version@/$(tag)/" {} \; # for osx + find $(RELEASE_DIR)/$(RELEASE_FILE) -name "*.php" -exec sed -i "s/@package_version@/$(tag)/" {} \; # for linux @echo 'Testing on syntax errors (thats all the automated testing your are going to get for now..) ' - find ./build/$(export_name) -name "*.php" | xargs -I file php -l file + find $(RELEASE_DIR)/$(RELEASE_FILE) -name "*.php" | xargs -I file php -l file @echo 'Downloading dependencies' - cd ./build/$(export_name); php composer.phar install; cd ../../; - rm -f ./build/$(export_name)/composer.phar - rm -f ./build/$(export_name)/composer.json - rm -f ./build/$(export_name)/composer.lock + cd $(RELEASE_DIR)/$(RELEASE_FILE); php composer.phar install; php composer.phar dump-autoload --optimize; cd ../../; + rm -f $(RELEASE_DIR)/$(RELEASE_FILE)/composer.phar + rm -f $(RELEASE_DIR)/$(RELEASE_FILE)/composer.json + rm -f $(RELEASE_DIR)/$(RELEASE_FILE)/composer.lock @echo 'Building HTML documentation using sphinx (http://sphinx-doc.org/)' - mkdir -p ./build/$(export_name)/docs/html - cd ./build/$(export_name)/docs; make BUILDDIR=. html; cd ../../../; + mkdir -p $(RELEASE_DIR)/$(RELEASE_FILE)/docs/html + cd $(RELEASE_DIR)/$(RELEASE_FILE)/docs; make BUILDDIR=. html; cd ../../../; @echo 'Cleaning up docs dir' - rm -f ./build/$(export_name)/Makefile - rm -f ./build/$(export_name)/docs/Makefile - rm -f ./build/$(export_name)/docs/make.bat - rm -f ./build/$(export_name)/docs/conf.py + rm -f $(RELEASE_DIR)/$(RELEASE_FILE)/Makefile + rm -f $(RELEASE_DIR)/$(RELEASE_FILE)/docs/Makefile + rm -f $(RELEASE_DIR)/$(RELEASE_FILE)/docs/make.bat + rm -f $(RELEASE_DIR)/$(RELEASE_FILE)/docs/conf.py @echo 'Setting folder and file permissions' - find ./build/$(export_name) -type f | xargs chmod 0644 - find ./build/$(export_name) -type d | xargs chmod 0755 + find $(RELEASE_DIR)/$(RELEASE_FILE) -type f | xargs chmod 0644 + find $(RELEASE_DIR)/$(RELEASE_FILE) -type d | xargs chmod 0755 @echo 'Creating archives' - cd ./build; zip -rq $(export_name).zip ./$(export_name); cd ../; - cd ./build; tar -pczf $(export_name).tar.gz ./$(export_name); cd ../; - #rm -rf ./build/$(export_name) + cd $(RELEASE_DIR); zip -rq $(RELEASE_FILE).zip ./$(RELEASE_FILE); cd ../; + cd $(RELEASE_DIR); tar -pczf $(RELEASE_FILE).tar.gz ./$(RELEASE_FILE); cd ../; + #rm -rf $(RELEASE_DIR)/$(RELEASE_FILE) @echo 'Building release finished '