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.8 2006/11/10 06:34:19 mlhuang Exp $
11 init := PLC/__init__.py PLC/Methods/__init__.py
14 modules := psycopg2 pycurl
15 modules-install := $(foreach module, $(modules), $(module)-install)
16 modules-clean := $(foreach module, $(modules), $(module)-clean)
19 subdirs := doc php php/xmlrpc
21 # autoconf compatible variables
28 all: $(init) $(subdirs) $(modules)
31 install: $(modules-install)
32 python setup.py install \
33 --install-purelib=$(DESTDIR)/$(datadir)/plc_api \
34 --install-scripts=$(DESTDIR)/$(datadir)/plc_api \
35 --install-data=$(DESTDIR)/$(datadir)/plc_api
36 install -D -m 755 php/xmlrpc/xmlrpc.so $(DESTDIR)/$(shell php-config --extension-dir)/xmlrpc.so
44 # Install in the current directory so that we can import it while developing
46 python setup.py build && \
47 python setup.py install_lib --install-dir=$(PWD)
49 $(modules-install): %-install:
51 python setup.py install_lib --install-dir=$(DESTDIR)/$(datadir)/plc_api
53 $(modules-clean): %-clean:
54 cd $* && python setup.py clean && rm -rf build
56 clean: $(modules-clean)
57 find . -name '*.pyc' | xargs rm -f
59 for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir clean ; done
60 python setup.py clean && rm -rf build
65 find . '(' -name '*.py' -o -name '*.sql' -o -name '*.php' -o -name Makefile ')' | xargs etags
67 # All .py files in PLC/
68 PLC := $(filter-out %/__init__.py, $(wildcard PLC/*.py))
69 PLC_init := all = '$(notdir $(PLC:.py=))'.split()
72 echo "$(PLC_init)" >$@
74 ifneq ($(sort $(PLC_init)), $(sort $(shell cat PLC/__init__.py 2>/dev/null)))
75 PLC/__init__.py: force
78 # All .py files in PLC/Methods/ and PLC/Methods/system/
79 METHODS := $(filter-out %/__init__.py, $(wildcard PLC/Methods/*.py PLC/Methods/system/*.py))
80 Methods_init := methods = '$(notdir $(subst system/, system., $(METHODS:.py=)))'.split()
82 PLC/Methods/__init__.py:
83 echo "$(Methods_init)" >$@
85 ifneq ($(sort $(Methods_init)), $(sort $(shell cat PLC/Methods/__init__.py 2>/dev/null)))
86 PLC/Methods/__init__.py: force
91 .PHONY: all install force clean index tags $(subdirs) $(modules)