-all: allgf allcvs allsvn
-clean: cleangf cleancvs cleansvn
-allgf: cleangf build upload
-allcvs: cleancvs buildcvs uploadcvs
-allsvn: cleansvn buildsvn uploadsvn
-gfversion=$(shell head -1 gforge/debian/changelog | sed 's/.*(\(.*\)-.*).*/\1/')
-cvsversion=$(shell head -1 gforge-plugin-scmcvs/debian/changelog | sed 's/.*(\(.*\)-.*).*/\1/')
-svnversion=$(shell head -1 gforge-plugin-scmsvn/debian/changelog | sed 's/.*(\(.*\)-.*).*/\1/')
-where=local
-where=g-rouille
-where=mercure
-documentor_path=/tmp
-documentor_vers=phpdocumentor-1.3.0rc3
+DISTDEBIAN=$(shell [ -f /etc/debian_version ] && echo debian)
+DISTREDHAT=$(shell grep -qi 'Red Hat' /etc/issue && echo rh)
+DISTSUSE=$(shell grep -qi 'SuSE' /etc/issue && echo rh)
+DIST=$(DISTDEBIAN)$(DISTREDHAT)$(DISTSUSE)
-#
-# GFORGE
-#
-cleangf:
- rm -f gforge*.deb sourceforge*.deb gforge*.changes gforge*.upload gforge*.build gforge*.dsc gforge*[^g].tar.gz gforge*.diff.gz gforge*.asc
-build:
- cd gforge ; debclean; dch ;find . -type f | grep -v '/CVS/' | grep -v rpm-specific | grep -v contrib | cpio -pdumvB ../gforge-$(gfversion)
- cd gforge-$(gfversion); debuild ; fakeroot debian/rules clean
- rm -rf gforge-$(gfversion)
-upload:
- dput $(where) gforge*.changes
+ARCHIVE=$(CURDIR)/depot
+BUILDRESULT=$(CURDIR)/result
-orig:
- cd gforge ; debclean; find . -type f | grep -v '/CVS/' | grep -v rpm-specific | grep -v contrib | cpio -pdumvB ../gforge-$(gfversion)
- tar cvzf gforge_$(gfversion).orig.tar.gz gforge-$(gfversion)
- rm -rf gforge-$(gfversion)
-#
-# CVS PLUGIN
-#
-cleancvs:
- rm -f gforge-plugin-scmcvs*deb gforge-plugin-scmcvs*upload gforge-plugin-scmcvs*build gforge-plugin-scmcvs*dsc gforge-plugin-scmcvs*[^g].tar.gz gforge-plugin-scmcvs*asc gforge-plugin-scmcvs*changes
-buildcvs:
- cd gforge-plugin-scmcvs ; debclean;dch; find . -type f | grep -v '/CVS/' | grep -v rpm-specific | grep -v contrib | cpio -pdumvB ../gforge-plugin-scmcvs-$(cvsversion)
- cd gforge-plugin-scmcvs-$(cvsversion); debuild ; fakeroot debian/rules clean
-uploadcvs:
- dput $(where) gforge-plugin-scmcvs*changes
-origcvs:
- cd gforge-plugin-scmcvs ; debclean; find . -type f | grep -v '/CVS/' | grep -v rpm-specific | grep -v contrib | cpio -pdumvB ../gforge-plugin-scmcvs-$(cvsversion)
- tar cvzf gforge-plugin-scmcvs_$(cvsversion).orig.tar.gz gforge-plugin-scmcvs-$(cvsversion)
+VER=$(shell LANG=C grep '>software_version' gforge/common/include/FusionForge.class.php | cut -d\' -f2)
+in_svn_repo:= $(wildcard .svn/)
+ifeq ($(strip $(in_svn_repo)),)
+ ID=unknown
+ URL=unknown
+ TAG=unknown
+else
+ ID=$(shell LANG=C svnversion)
+ URL=$(shell LANG=C svn info | grep 'Root:' | awk '{print $$3}')
+ TAG=$(shell LANG=C svn log $(URL) -r $(ID) -l 1 2>/dev/null | awk '{ if ($$1=="Tag-Release") print $$1}')
+endif
+ifeq ($(TAG),)
+ VERSION=fusionforge-$(VER)-$(ID)
+else
+ VERSION=fusionforge-$(VER)
+endif
-#
-# SVN PLUGIN
-#
-cleansvn:
- rm -f gforge-plugin-scmsvn*deb gforge-plugin-scmsvn*upload gforge-plugin-scmsvn*build gforge-plugin-scmsvn*dsc gforge-plugin-scmsvn*[^g].tar.gz gforge-plugin-scmsvn*asc gforge-plugin-scmsvn*changes
-buildsvn:
- cd gforge-plugin-scmsvn ; debclean; dch; find . -type f | grep -v '/CVS/' | grep -v rpm-specific | grep -v contrib | cpio -pdumvB ../gforge-plugin-scmsvn-$(svnversion)
- cd gforge-plugin-scmsvn-$(svnversion); debuild ; fakeroot debian/rules clean
-uploadsvn:
- dput $(where) gforge-plugin-scmsvn*changes
-origsvn:
- cd gforge-plugin-scmsvn ; debclean; find . -type f | grep -v '/CVS/' | grep -v rpm-specific | grep -v contrib | cpio -pdumvB ../gforge-plugin-scmsvn-$(svnversion)
- tar cvzf gforge-plugin-scmsvn_$(svnversion).orig.tar.gz gforge-plugin-scmsvn-$(svnversion)
- rm -rf gforge-plugin-scmsvn-$(svnversion)
+switch:
+ @echo "=========================================================================="
+ @echo "Use one of the following target with "
+ @echo "make -f Makefile.$(DIST) <target>"
+ @echo "=========================================================================="
+ @make -f Makefile.$(DIST)
-#
-# PHPDOCUMENTOR
-#
-phpdoc: phpdocumentor_get phpdocumentor_unapck $(documentor_path)/$(documentor_vers)/patched gforge/docs/phpdoc/docs
-
-phpdocumentor_get:
- [ ! -f $(documentor_path)/$(documentor_vers).tar.gz ] && cd $(documentor_path) && wget http://heanet.dl.sourceforge.net/sourceforge/phpdocu/$(documentor_vers).tar.gz || true
-phpdocumentor_unapck:
- [ ! -d $(documentor_path)/$(documentor_vers) ] && cd $(documentor_path) && tar xvzf $(documentor_vers).tar.gz || true
-$(documentor_path)/$(documentor_vers)/patched:
- cd $(documentor_path)/ && patch -p2 < $(CURDIR)/gforge/docs/phpdoc/manageclass.patch && touch $(documentor_path)/$(documentor_vers)/patched
-gforge/docs/phpdoc/docs:
- cd gforge/docs/phpdoc/ && ./makedoc.sh
+check:
+ cd tests ; php AllTests.php
+buildtar:
+ rm -fr /tmp/$(VERSION)
+ cd gforge; find . -type f -or -type l | grep -v '/.svn/' | grep -v '^./debian' | grep -v '^./deb-specific' | grep -v '^./rpm-specific' | grep -v '^./contrib' | grep -v '^./gforge.spec' | grep -v '^./README.setup' | grep -v '^./setup' | cpio -pdumB --quiet /tmp/$(VERSION)
+ cd /tmp/$(VERSION); utils/manage-translations.sh build
+ cd /tmp/; tar jcf $(BUILDRESULT)/$(VERSION).tar.bz2 $(VERSION)
+ cd /tmp/$(VERSION); tar zxf $(ARCHIVE)/libphp-jpgraph_1.5.2.orig.tar.gz
+ cd /tmp/$(VERSION); patch -p0 < $(ARCHIVE)/jpgraph-1.5.2-php5_and_liberation_fonts.patch
+ cd /tmp/$(VERSION); mkdir jpgraph; mv jpgraph-1.5.2/src/* jpgraph; rm -fr jpgraph-1.5.2
+ cd /tmp; tar jcf $(BUILDRESULT)/$(VERSION)-allinone.tar.bz2 $(VERSION)
+ rm -fr /tmp/$(VERSION)
+build-unit-tests:
+ mkdir -p $(BUILDDIR)/reports/coverage
+ cd tests; phpunit --log-xml $(BUILDDIR)/reports/phpunit.xml --log-pmd $(BUILDDIR)/reports/phpunit.pmd.xml --coverage-clover $(BUILDDIR)/reports/coverage/clover.xml --coverage-html $(BUILDDIR)/reports/coverage/ AllTests.php
+ cp $(BUILDDIR)/reports/phpunit.xml $(BUILDDIR)/reports/phpunit.xml.org; xalan -in $(BUILDDIR)/reports/phpunit.xml.org -xsl fix_phpunit.xslt -out $(BUILDDIR)/reports/phpunit.xml
+
+build-full-tests:
+ find $(BUILDDIR)/build/packages -type f -exec rm -f {} \;
+ mkdir -p $(BUILDDIR)/reports/coverage
+ phpdoc --title 'API Documentation' -ue on -t $(BUILDDIR)/apidocs -d gforge/common -tb '/usr/share/php/data/phpUnderControl/data/phpdoc' -o HTML:Phpuc:phpuc
+ -phpcs --tab-width=4 --standard=PEAR --report=checkstyle gforge/common > $(BUILDDIR)/reports/checkstyle.xml
+ cd tests; phpunit --log-xml $(BUILDDIR)/reports/phpunit.xml --log-pmd $(BUILDDIR)/reports/phpunit.pmd.xml --coverage-clover $(BUILDDIR)/reports/coverage/clover.xml --coverage-html $(BUILDDIR)/reports/coverage/ AllFullTests.php
+ cp $(BUILDDIR)/reports/phpunit.xml $(BUILDDIR)/reports/phpunit.xml.org; xalan -in $(BUILDDIR)/reports/phpunit.xml.org -xsl fix_phpunit.xslt -out $(BUILDDIR)/reports/phpunit.xml
+ cd tests; phpunit --log-xml $(BUILDDIR)/reports/phpunit-selenium.xml TarCentos52Tests.php
+ cp $(BUILDDIR)/reports/phpunit-selenium.xml $(BUILDDIR)/reports/phpunit-selenium.xml.org; xalan -in $(BUILDDIR)/reports/phpunit-selenium.xml.org -xsl fix_phpunit.xslt -out $(BUILDDIR)/reports/phpunit-selenium.xml
+
+%:
+ @make -f Makefile.$(DIST) $@