2 # (Re)builds Python metafiles (__init__.py) and documentation
4 # Mark Huang <mlhuang@cs.princeton.edu>
5 # Copyright (C) 2005 The Trustees of Princeton University
7 # $Id: Makefile,v 1.13 2007/08/31 02:46:47 mef Exp $
11 init := PLC/__init__.py PLC/Methods/__init__.py
16 # Temporarily until we can kill the Fedora Core 2 build
17 curl_vernum := $(shell printf %d 0x$(shell curl-config --vernum))
18 pycurl_vernum := $(shell printf %d 0x070d01) # 7.13.1
19 pycurl_incompatnum := $(shell printf %d 0x071000) # 7.16.0
20 ifeq ($(shell test $(curl_vernum) -ge $(pycurl_vernum) && echo 1),1)
21 ifeq ($(shell test $(curl_vernum) -ge $(pycurl_incompatnum) && echo 0),1)
26 modules-install := $(foreach module, $(modules), $(module)-install)
27 modules-clean := $(foreach module, $(modules), $(module)-clean)
30 subdirs := doc php php/xmlrpc
32 # autoconf compatible variables
39 all: $(init) $(subdirs) $(modules)
42 install: $(modules-install)
43 python setup.py install \
44 --install-purelib=$(DESTDIR)/$(datadir)/plc_api \
45 --install-scripts=$(DESTDIR)/$(datadir)/plc_api \
46 --install-data=$(DESTDIR)/$(datadir)/plc_api
47 install -D -m 755 php/xmlrpc/xmlrpc.so $(DESTDIR)/$(shell php-config --extension-dir)/xmlrpc.so
48 install -D -m 755 refresh-peer.py $(DESTDIR)/$(bindir)/refresh-peer.py
50 $(subdirs): $(init) $(modules)
56 # Install in the current directory so that we can import it while developing
58 python setup.py build && \
59 python setup.py install_lib --install-dir=$(PWD)
61 $(modules-install): %-install:
63 python setup.py install_lib --install-dir=$(DESTDIR)/$(datadir)/plc_api
65 $(modules-clean): %-clean:
66 cd $* && python setup.py clean && rm -rf build
68 clean: $(modules-clean)
69 find . -name '*.pyc' | xargs rm -f
71 for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir clean ; done
72 python setup.py clean && rm -rf build
77 find . '(' -name '*.py' -o -name '*.sql' -o -name '*.php' -o -name Makefile ')' | xargs etags
79 # All .py files in PLC/
80 PLC := $(filter-out %/__init__.py, $(wildcard PLC/*.py))
81 PLC_init := all = '$(notdir $(PLC:.py=))'.split()
84 echo "$(PLC_init)" >$@
86 ifneq ($(sort $(PLC_init)), $(sort $(shell cat PLC/__init__.py 2>/dev/null)))
87 PLC/__init__.py: force
90 # All .py files in PLC/Methods/ and PLC/Methods/system/
91 METHODS := $(filter-out %/__init__.py, $(wildcard PLC/Methods/*.py PLC/Methods/system/*.py))
92 Methods_init := methods = '$(notdir $(subst system/, system., $(METHODS:.py=)))'.split()
94 PLC/Methods/__init__.py:
95 echo "$(Methods_init)" >$@
97 ifneq ($(sort $(Methods_init)), $(sort $(shell cat PLC/Methods/__init__.py 2>/dev/null)))
98 PLC/Methods/__init__.py: force
103 .PHONY: all install force clean index tags $(subdirs) $(modules)