fixed: encodes boolean and double type values for the requests
[plcapi.git] / Makefile
1 #
2 # (Re)builds Python metafiles (__init__.py) and documentation
3 #
4 # Mark Huang <mlhuang@cs.princeton.edu>
5 # Copyright (C) 2005 The Trustees of Princeton University
6 #
7
8 # python-pycurl and python-psycopg2 avail. from fedora 5
9 # we used to ship our own version of psycopg2 and pycurl, for fedora4
10 # starting with 5.0, support for these two modules is taken out
11
12 # Other stuff - doc not implicit, it's redone by myplc-docs
13
14 # autoconf compatible variables
15 DESTDIR := /
16 datadir := /usr/share
17 bindir := /usr/bin
18
19 PWD := $(shell pwd)
20
21 all: 
22         python setup.py build
23
24 install: 
25         python setup.py install \
26             --install-purelib=$(DESTDIR)/$(datadir)/plc_api \
27             --install-scripts=$(DESTDIR)/$(datadir)/plc_api \
28             --install-data=$(DESTDIR)/$(datadir)/plc_api
29
30 clean: 
31         find . -name '*.pyc' | xargs rm -f
32         python setup.py clean && rm -rf build
33
34 index:
35         echo "This step is obsolete"
36
37 ##########
38
39 force:
40
41 .PHONY: all install force clean index tags
42
43 #################### devel tools
44 tags:
45         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
46
47 .PHONY: tags
48
49 ########## sync
50 # 2 forms are supported
51 # (*) if your plc root context has direct ssh access:
52 # make sync PLC=private.one-lab.org
53 # (*) otherwise, for test deployments, use on your testmaster
54 # $ run export
55 # and cut'n paste the export lines before you run make sync
56
57 ifdef PLC
58 SSHURL:=root@$(PLC):/
59 SSHCOMMAND:=ssh root@$(PLC)
60 else
61 ifdef PLCHOSTLXC
62 SSHURL:=root@$(PLCHOSTLXC):/vservers/$(GUESTNAME)
63 SSHCOMMAND:=ssh root@$(PLCHOSTLXC) ssh -o StrictHostKeyChecking=no -o LogLevel=quiet $(GUESTHOSTNAME)
64 endif
65 endif
66
67 LOCAL_RSYNC_EXCLUDES    := --exclude '*.pyc' --exclude Accessors_site.py
68 RSYNC_EXCLUDES          := --exclude .svn --exclude .git --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
69 RSYNC_COND_DRY_RUN      := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
70 RSYNC                   := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
71
72 sync:
73 ifeq (,$(SSHURL))
74         @echo "sync: I need more info from the command line, e.g."
75         @echo "  make sync PLC=boot.planetlab.eu"
76         @echo "  make sync PLCHOSTLXC=.. GUESTHOSTNAME=.. GUESTNAME=.."
77         @exit 1
78 else
79         +$(RSYNC) plcsh PLC planetlab5.sql migrations aspects $(SSHURL)/usr/share/plc_api/
80         +$(RSYNC) db-config.d/ $(SSHURL)/etc/planetlab/db-config.d/
81         +$(RSYNC) plc.d/ $(SSHURL)/etc/plc.d/
82         +$(RSYNC) apache/plc.wsgi $(SSHURL)/usr/share/plc_api/apache/
83         $(SSHCOMMAND) /etc/plc.d/httpd stop
84         $(SSHCOMMAND) /etc/plc.d/httpd start
85 endif
86
87 #################### convenience, for debugging only
88 # make +foo : prints the value of $(foo)
89 # make ++foo : idem but verbose, i.e. foo=$(foo)
90 ++%: varname=$(subst +,,$@)
91 ++%:
92         @echo "$(varname)=$($(varname))"
93 +%: varname=$(subst +,,$@)
94 +%:
95         @echo "$($(varname))"
96