build and install our own custom xmlrpc.so extension
[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 # $Id: Makefile,v 1.7 2006/11/08 23:27:52 mlhuang Exp $
8 #
9
10 # Metafiles
11 INIT := PLC/__init__.py PLC/Methods/__init__.py
12
13 # Other stuff
14 SUBDIRS := doc php php/xmlrpc
15
16 # autoconf compatible variables
17 DESTDIR := /plc/root
18 datadir := /usr/share
19 bindir := /usr/bin
20
21 PWD := $(shell pwd)
22
23 all: $(INIT) $(SUBDIRS)
24         python setup.py build
25         # Install in the current directory so that we can import it
26         cd psycopg2 && \
27         python setup.py build && \
28         python setup.py install --install-lib=$(PWD)
29
30 install:
31         python setup.py install \
32             --install-purelib=$(DESTDIR)/$(datadir)/plc_api \
33             --install-scripts=$(DESTDIR)/$(datadir)/plc_api \
34             --install-data=$(DESTDIR)/$(datadir)/plc_api
35         (cd psycopg2 && \
36          python setup.py install --install-lib=$(DESTDIR)/$(datadir)/plc_api)
37         install -D -m 755 php/xmlrpc/xmlrpc.so $(DESTDIR)/$(shell php-config --extension-dir)/xmlrpc.so
38
39 $(SUBDIRS): %:
40         $(MAKE) -C $@
41
42 clean:
43         find . -name '*.pyc' | xargs rm -f
44         rm -f $(INIT)
45         for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir clean ; done
46         python setup.py clean && rm -rf build
47         cd psycopg2 && python setup.py clean && rm -rf build
48
49 index: $(INIT)
50
51 tags:
52         find . '(' -name '*.py' -o -name '*.sql' -o -name '*.php' -o -name Makefile ')' | xargs etags
53
54
55 # All .py files in PLC/
56 PLC := $(filter-out %/__init__.py, $(wildcard PLC/*.py))
57 PLC_init := all = '$(notdir $(PLC:.py=))'.split()
58
59 PLC/__init__.py:
60         echo "$(PLC_init)" >$@
61
62 ifneq ($(sort $(PLC_init)), $(sort $(shell cat PLC/__init__.py 2>/dev/null)))
63 PLC/__init__.py: force
64 endif
65
66 # All .py files in PLC/Methods/ and PLC/Methods/system/
67 METHODS := $(filter-out %/__init__.py, $(wildcard PLC/Methods/*.py PLC/Methods/system/*.py))
68 Methods_init := methods = '$(notdir $(subst system/, system., $(METHODS:.py=)))'.split()
69
70 PLC/Methods/__init__.py:
71         echo "$(Methods_init)" >$@
72
73 ifneq ($(sort $(Methods_init)), $(sort $(shell cat PLC/Methods/__init__.py 2>/dev/null)))
74 PLC/Methods/__init__.py: force
75 endif
76
77 force:
78
79 .PHONY: all install force clean index tags $(SUBDIRS)