Skip to content
Snippets Groups Projects
Makefile 4.62 KiB
Newer Older
PHPDOC ?= support/pear/phpdoc
PKG_VERSION = $(shell awk '/version/ { print $$3 }' extension/ext_emconf.php  | sed "s/'//g")
NIGHTLY_DATE = $(shell date '+%Y%m%d')
RELEASE_DATE = $(shell date '+%Y%m%d%H%M')
GIT_REVISION_SHORT = $(shell git rev-parse --short HEAD || true)
GIT_REVISION_LONG = $(shell git rev-parse HEAD || true)
EXTENSION_CONTENT = Classes Configuration Documentation qfq Resources ext_emconf.php ext_localconf.php ext_tables.php ext_icon.png ext_conf_template.txt config.qfq.example.ini RELEASE.txt
Rafael Ostertag's avatar
Rafael Ostertag committed
DISTDIR=dist
# Use by jenkins to separate temp directories used by pip in order to allow concurrent builds
PIP_TMP ?= /tmp

all: archive t3sphinx
doc: phpdoc jsdoc plantuml
maintainer-clean:
	rm -f .bowerpackages .doc_plantuml .npmpackages .phpdocinstall .plantuml_install .support .support_plantuml
	rm -rf doc/jsdoc doc/phpdoc doc/plantuml support bower_components node_modules .python_virtualenv build-dist
	cd extension; zip -r ../$@ $(EXTENSION_CONTENT)
clean:
	cd doc/diagram ; $(MAKE) $@
update-qfq-doc: 
	rsync -av --delete --exclude=_make --exclude=_static extension/Documentation/ ../qfq-doc/Documentation/; \
	cd ../qfq-doc/; \
	git commit -a; \
	git push
	
Rafael Ostertag's avatar
Rafael Ostertag committed
git-revision: make-dist-dir
Rafael Ostertag's avatar
Rafael Ostertag committed
	echo $(GIT_REVISION_LONG) > $(DISTDIR)/revision.git
Rafael Ostertag's avatar
Rafael Ostertag committed
make-dist-dir:
Rafael Ostertag's avatar
Rafael Ostertag committed
	rm -rf $(DISTDIR)/
	mkdir $(DISTDIR)

dist-move-doc:
	cd $(DISTDIR) ; \
	mkdir Documentation.tmp ;\
	mv Documentation/_make/build/html Documentation.tmp ;\
	rm -rf Documentation ; \
	mv Documentation.tmp Documentation

Rafael Ostertag's avatar
Rafael Ostertag committed
dist-copy-extension:
	cd extension ; cp -R $(EXTENSION_CONTENT) ../$(DISTDIR)/

build-dist: t3sphinx make-dist-dir dist-copy-extension dist-move-doc git-revision
	echo "Distribution made in $(DIST)"

nightly: bootstrap build-dist
	cd $(DISTDIR); zip -r ../qfq_$(VERSION)_$(RELEASE_DATE).zip  $(EXTENSION_CONTENT) revision.git -x config.ini
snapshot: bootstrap build-dist
	cd $(DISTDIR) ; zip -r ../qfq_$(VERSION)_$(RELEASE_DATE).zip $(EXTENSION_CONTENT) revision.git -x config.ini
release: bootstrap build-dist
Rafael Ostertag's avatar
Rafael Ostertag committed
	if [ -z "$(VERSION)" ] ; then  echo "Set VERSION make variable to the release version (fmt: maj.min.micro)" ; exit 1 ; fi
	cd $(DISTDIR) ; zip -r "../qfq_$(VERSION)_$(RELEASE_DATE).zip" $(EXTENSION_CONTENT) revision.git -x config.ini
t3sphinx: .virtual_env
	. .python_virtualenv/bin/activate ; cd extension/Documentation/_make; make html
plantuml:
	cd doc/diagram ; $(MAKE)
bootstrap: .phpdocinstall .npmpackages .bowerpackages .plantuml_install .virtual_env .sonar_scanner
jsdoc: .npmpackages
	$(JSDOC) -c JSDocConf.json

phpdoc: .phpdocinstall
	$(PHPDOC)

Rafael Ostertag's avatar
Rafael Ostertag committed
.phpdocinstall: .support
	if [ ! -f "`pwd`/support/pear.config" ]; then \
		pear config-create "`pwd`/support" "`pwd`/support/pear.config" ; \
		pear -c "`pwd`/support/pear.config" channel-discover pear.phpdoc.org ; \
	fi
	pear -c "`pwd`/support/pear.config" install --alldeps phpDocumentor
.sonar_scanner: .support_sonar
	cd support/sonar ;\
	wget https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$(SONAR_SCANNER_VERSION)-linux.zip ;\
	unzip -o sonar-scanner-cli-$(SONAR_SCANNER_VERSION)-linux.zip
	touch $@


.plantuml_install: .support_plantuml
	wget --no-check-certificate -O support/plantuml/plantuml.jar 'https://downloads.sourceforge.net/project/plantuml/plantuml.jar'
.npmpackages: package.json
	npm ls -g grunt-cli 2>/dev/null || { echo "Please install grunt-cli npm package using 'npm install -g grunt-cli'" 1>&2 ; exit 1; }
	npm ls -g jsdoc 2>/dev/null || { echo "Please install jsdoc npm package using 'npm install -g jsdoc'" 1>&2 ; exit 1; }
	npm ls -g bower 2>/dev/null || { echo "Please install bower npm package using 'npm install -g bower'" 1>&2 ; exit 1; }
	npm install
	touch $@

.bowerpackages: bower.json
	bower --silent install
	touch $@
.support:
	mkdir -p support
	touch $@
.support_plantuml: .support
	mkdir -p support/plantuml
	touch $@
.support_sonar: .support
	mkdir -p support/sonar
	touch $@

	. .python_virtualenv/bin/activate ; TMPDIR="$(PIP_TMP)" pip install --upgrade sphinx==1.5.5
pip-temp-directory:
	test -d "$(PIP_TMP)" || mkdir -p "$(PIP_TMP)"

sonar: .sonar_scanner
	support/sonar/sonar-scanner-$(SONAR_SCANNER_VERSION)-linux/bin/sonar-scanner


.PHONY: nightly maintainer-clean snapshot release git-revision t3sphinx build-dist make-dist-dir dist-move-doc dist-copy-extension pip-temp-directory plantuml sonar
Carsten  Rose's avatar
Carsten Rose committed
copyReleaseNotes:
	cp extension/Documentation/Release.rst extension/RELEASE.txt
	cp extension/Documentation/Release.rst CHANGELOG.md