Makefile: changing export name of archives

This commit is contained in:
Pepijn Over 2014-08-07 13:48:33 +02:00
parent 55714e4208
commit a896e33f3b
1 changed files with 25 additions and 23 deletions

View File

@ -1,8 +1,10 @@
tag = $(shell git describe) tag = $(shell git describe)
export_name = phpservermon-$(tag) VERSION = ${subst v,,$(tag)}
RELEASE_DIR = ./build
RELEASE_FILE = phpservermon-$(VERSION)
help: help:
@echo ' PHP Server Monitor - $(tag) ' @echo ' PHP Server Monitor - $(tag)'
@echo ' - make export [tag=...] - create a new release from tag ' @echo ' - make export [tag=...] - create a new release from tag '
@echo ' - make install - install all dependencies ' @echo ' - make install - install all dependencies '
@ -13,31 +15,31 @@ install:
export: export:
@echo 'Building release for tag $(tag) ' @echo 'Building release for tag $(tag) '
mkdir -p ./build ./build/$(export_name) mkdir -p $(RELEASE_DIR) $(RELEASE_DIR)/$(RELEASE_FILE)
rm -rf ./build/$(export_name)/* rm -rf $(RELEASE_DIR)/$(RELEASE_FILE)/*
git archive $(tag) | tar -xf - -C ./build/$(export_name)/ git archive $(tag) | tar -xf - -C $(RELEASE_DIR)/$(RELEASE_FILE)/
#find ./build/$(export_name) -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 osx
find ./build/$(export_name) -name "*.php" -exec sed -i "s/@package_version@/$(tag)/" {} \; # for linux 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..) ' @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' @echo 'Downloading dependencies'
cd ./build/$(export_name); php composer.phar install; cd ../../; cd $(RELEASE_DIR)/$(RELEASE_FILE); php composer.phar install; php composer.phar dump-autoload --optimize; cd ../../;
rm -f ./build/$(export_name)/composer.phar rm -f $(RELEASE_DIR)/$(RELEASE_FILE)/composer.phar
rm -f ./build/$(export_name)/composer.json rm -f $(RELEASE_DIR)/$(RELEASE_FILE)/composer.json
rm -f ./build/$(export_name)/composer.lock rm -f $(RELEASE_DIR)/$(RELEASE_FILE)/composer.lock
@echo 'Building HTML documentation using sphinx (http://sphinx-doc.org/)' @echo 'Building HTML documentation using sphinx (http://sphinx-doc.org/)'
mkdir -p ./build/$(export_name)/docs/html mkdir -p $(RELEASE_DIR)/$(RELEASE_FILE)/docs/html
cd ./build/$(export_name)/docs; make BUILDDIR=. html; cd ../../../; cd $(RELEASE_DIR)/$(RELEASE_FILE)/docs; make BUILDDIR=. html; cd ../../../;
@echo 'Cleaning up docs dir' @echo 'Cleaning up docs dir'
rm -f ./build/$(export_name)/Makefile rm -f $(RELEASE_DIR)/$(RELEASE_FILE)/Makefile
rm -f ./build/$(export_name)/docs/Makefile rm -f $(RELEASE_DIR)/$(RELEASE_FILE)/docs/Makefile
rm -f ./build/$(export_name)/docs/make.bat rm -f $(RELEASE_DIR)/$(RELEASE_FILE)/docs/make.bat
rm -f ./build/$(export_name)/docs/conf.py rm -f $(RELEASE_DIR)/$(RELEASE_FILE)/docs/conf.py
@echo 'Setting folder and file permissions' @echo 'Setting folder and file permissions'
find ./build/$(export_name) -type f | xargs chmod 0644 find $(RELEASE_DIR)/$(RELEASE_FILE) -type f | xargs chmod 0644
find ./build/$(export_name) -type d | xargs chmod 0755 find $(RELEASE_DIR)/$(RELEASE_FILE) -type d | xargs chmod 0755
@echo 'Creating archives' @echo 'Creating archives'
cd ./build; zip -rq $(export_name).zip ./$(export_name); cd ../; cd $(RELEASE_DIR); zip -rq $(RELEASE_FILE).zip ./$(RELEASE_FILE); cd ../;
cd ./build; tar -pczf $(export_name).tar.gz ./$(export_name); cd ../; cd $(RELEASE_DIR); tar -pczf $(RELEASE_FILE).tar.gz ./$(RELEASE_FILE); cd ../;
#rm -rf ./build/$(export_name) #rm -rf $(RELEASE_DIR)/$(RELEASE_FILE)
@echo 'Building release finished ' @echo 'Building release finished '