Setting tag plcapi-5.4-2
[plcapi.git] / Makefile
index 5a04c35..f05c06f 100644 (file)
--- a/Makefile
+++ b/Makefile
-# Makefile for phpxmlrpc library\r
-# $Id: Makefile,v 1.37 2008/03/06 22:37:19 ggiunta Exp $\r
-\r
-### USER EDITABLE VARS ###\r
-\r
-# path to PHP executable, preferably CLI version\r
-PHP=/usr/local/bin/php\r
-\r
-# path were xmlrpc lib files will be copied to\r
-PHPINCLUDEDIR=/usr/local/lib/php\r
-\r
-# mkdir is a thorny beast under windows: make sure we can not use the cmd version, running eg. "make MKDIR=mkdir.exe"\r
-MKDIR=mkdir\r
-\r
-\r
-#### DO NOT TOUCH FROM HERE ONWARDS ###\r
-\r
-# recover version number from code\r
-# thanks to Firman Pribadi for unix command line help\r
-export VERSION=$(shell egrep "\$GLOBALS *\[ *'xmlrpcVersion' *\] *= *'" xmlrpc.inc | sed -r s/"(.*= *' *)([0-9a-zA-Z.-]+)(.*)"/\\2/g )\r
-\r
-LIBFILES=xmlrpc.inc xmlrpcs.inc xmlrpc_wrappers.inc compat/*.php\r
-\r
-EXTRAFILES=test.pl \\r
- test.py \\r
- rsakey.pem \\r
- workspace.testPhpServer.fttb\r
-\r
-DEMOFILES=vardemo.php \\r
- demo1.txt \\r
- demo2.txt \\r
- demo3.txt\r
-\r
-DEMOSFILES=discuss.php \\r
- server.php \\r
- proxy.php\r
-\r
-DEMOCFILES=agesort.php \\r
- client.php \\r
- comment.php \\r
- introspect.php \\r
- mail.php \\r
- simple_call.php \\r
- which.php \\r
- wrap.php \\r
- zopetest.php\r
-\r
-TESTFILES=testsuite.php \\r
- benchmark.php \\r
- parse_args.php \\r
- phpunit.php \\r
- verify_compat.php \\r
- PHPUnit/*.php\r
-\r
-INFOFILES=Changelog \\r
- Makefile \\r
- NEWS \\r
- README\r
-\r
-DEBUGGERFILES=debugger/index.php \\r
- debugger/action.php \\r
- debugger/common.php \\r
- debugger/controller.php\r
-\r
-\r
-all: install\r
-\r
-install:\r
-       cd lib && cp ${LIBFILES} ${PHPINCLUDEDIR}\r
-       @echo Lib files have been copied to ${PHPINCLUDEDIR}\r
-       cd doc && $(MAKE) install\r
-\r
-test:\r
-       cd test && ${PHP} -q testsuite.php\r
-\r
-\r
-### the following targets are to be used for library development ###\r
-\r
-# make tag target: tag existing working copy as release in cvs.\r
-# todo: convert dots in underscore in $VERSION\r
-tag:\r
-       cvs -q tag -p release_${VERSION}\r
-\r
-dist: xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz\r
-\r
-xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz: ${LIBFILES} ${DEBUGGERFILES} ${INFOFILES} ${TESTFILES} ${EXTRAFILES} ${DEMOFILES} ${DEMOSFILES} ${DEMOCFILES}\r
-       @echo ---${VERSION}---\r
-       rm -rf xmlrpc-${VERSION}\r
-       ${MKDIR} xmlrpc-${VERSION}\r
-       ${MKDIR} xmlrpc-${VERSION}/demo\r
-       ${MKDIR} xmlrpc-${VERSION}/demo/client\r
-       ${MKDIR} xmlrpc-${VERSION}/demo/server\r
-       cp --parents ${DEMOFILES} xmlrpc-${VERSION}/demo\r
-       cp --parents ${DEMOCFILES} xmlrpc-${VERSION}/demo/client\r
-       cp --parents ${DEMOSFILES} xmlrpc-${VERSION}/demo/server\r
-       ${MKDIR} xmlrpc-${VERSION}/test\r
-       ${MKDIR} xmlrpc-${VERSION}/test/PHPUnit\r
-       cp --parents ${TESTFILES} xmlrpc-${VERSION}/test\r
-       ${MKDIR} xmlrpc-${VERSION}/extras\r
-       cp --parents ${EXTRAFILES} xmlrpc-${VERSION}/extras\r
-       ${MKDIR} xmlrpc-${VERSION}/lib\r
-       ${MKDIR} xmlrpc-${VERSION}/lib/compat\r
-       cp --parents ${LIBFILES} xmlrpc-${VERSION}/lib\r
-       ${MKDIR} xmlrpc-${VERSION}/debugger\r
-       cp ${DEBUGGERFILES} xmlrpc-${VERSION}/debugger\r
-       cp ${INFOFILES} xmlrpc-${VERSION}\r
-       cd doc && $(MAKE) dist\r
-       find xmlrpc-${VERSION} -type f ! -name "*.fttb" ! -name "*.pdf" ! -name "*.gif" -exec dos2unix {} \;\r
-       -rm xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz\r
-       tar -cvf xmlrpc-${VERSION}.tar xmlrpc-${VERSION}\r
-       gzip xmlrpc-${VERSION}.tar\r
-       zip -r xmlrpc-${VERSION}.zip xmlrpc-${VERSION}\r
-\r
-doc:\r
-       cd doc && $(MAKE) doc\r
-\r
-clean:\r
-       rm -rf xmlrpc-${VERSION} xmlrpc-${VERSION}.zip xmlrpc-${VERSION}.tar.gz\r
-       cd doc && $(MAKE) clean\r
+#
+# (Re)builds Python metafiles (__init__.py) and documentation
+#
+# Mark Huang <mlhuang@cs.princeton.edu>
+# Copyright (C) 2005 The Trustees of Princeton University
+#
+
+# python-pycurl and python-psycopg2 avail. from fedora 5
+# we used to ship our own version of psycopg2 and pycurl, for fedora4
+# starting with 5.0, support for these two modules is taken out
+
+# Other stuff - doc not implicit, it's redone by myplc-docs
+
+# autoconf compatible variables
+DESTDIR := /
+datadir := /usr/share
+bindir := /usr/bin
+
+PWD := $(shell pwd)
+
+all: 
+       python setup.py build
+
+install: install-python install-phpxmlrpc
+
+install-python:
+       python setup.py install \
+           --install-purelib=$(DESTDIR)/$(datadir)/plc_api \
+           --install-scripts=$(DESTDIR)/$(datadir)/plc_api \
+           --install-data=$(DESTDIR)/$(datadir)/plc_api
+
+# phpxmlrpc is a git subtree; we just ship all its contents
+# under /usr/share/plc_api/php/phpxmlrpc
+install-phpxmlrpc:
+       mkdir -p $(DESTDIR)/$(datadir)/plc_api/php/phpxmlrpc/
+       rsync --exclude .git -ai php/phpxmlrpc/ $(DESTDIR)/$(datadir)/plc_api/php/phpxmlrpc/
+
+clean: 
+       find . -name '*.pyc' | xargs rm -f
+       python setup.py clean && rm -rf build
+
+index:
+       echo "This step is obsolete"
+
+##########
+
+force:
+
+.PHONY: all install force clean index tags
+
+#################### devel tools
+tags:
+       find . '(' -name '*.py' -o -name '*.sql' -o -name '*.php' -o -name Makefile -o -name '[0-9][0-9][0-9]*' ')' | fgrep -v '.git/' | xargs etags
+
+.PHONY: tags
+
+########## sync
+# 2 forms are supported
+# (*) if your plc root context has direct ssh access:
+# make sync PLC=private.one-lab.org
+# (*) otherwise, for test deployments, use on your testmaster
+# $ run export
+# and cut'n paste the export lines before you run make sync
+
+ifdef PLC
+SSHURL:=root@$(PLC):/
+SSHCOMMAND:=ssh root@$(PLC)
+else
+ifdef PLCHOSTLXC
+SSHURL:=root@$(PLCHOSTLXC):/vservers/$(GUESTNAME)
+SSHCOMMAND:=ssh root@$(PLCHOSTLXC) ssh -o StrictHostKeyChecking=no -o LogLevel=quiet $(GUESTHOSTNAME)
+endif
+endif
+
+LOCAL_RSYNC_EXCLUDES   := --exclude '*.pyc' --exclude Accessors_site.py
+RSYNC_EXCLUDES         := --exclude .svn --exclude .git --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
+RSYNC_COND_DRY_RUN     := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
+RSYNC                  := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
+
+sync:
+ifeq (,$(SSHURL))
+       @echo "sync: I need more info from the command line, e.g."
+       @echo "  make sync PLC=boot.planetlab.eu"
+       @echo "  make sync PLCHOSTLXC=.. GUESTHOSTNAME=.. GUESTNAME=.."
+       @exit 1
+else
+       +$(RSYNC) plcsh PLC planetlab5.sql migrations $(SSHURL)/usr/share/plc_api/
+       +$(RSYNC) db-config.d/ $(SSHURL)/etc/planetlab/db-config.d/
+       +$(RSYNC) plc.d/ $(SSHURL)/etc/plc.d/
+       +$(RSYNC) apache/plc.wsgi $(SSHURL)/usr/share/plc_api/apache/
+       $(SSHCOMMAND) /etc/plc.d/httpd stop
+       $(SSHCOMMAND) /etc/plc.d/httpd start
+endif
+
+#################### convenience, for debugging only
+# make +foo : prints the value of $(foo)
+# make ++foo : idem but verbose, i.e. foo=$(foo)
+++%: varname=$(subst +,,$@)
+++%:
+       @echo "$(varname)=$($(varname))"
++%: varname=$(subst +,,$@)
++%:
+       @echo "$($(varname))"
+