add install command for development
[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.3 2006/11/03 20:36:05 thierry Exp $
8 #
9
10 # Metafiles
11 INIT := PLC/__init__.py PLC/Methods/__init__.py
12
13 # Other stuff
14 SUBDIRS := doc php
15
16 # autoconf compatible variables
17 DESTDIR := /plc/root
18 datadir := /usr/share
19 bindir := /usr/bin
20
21 all: $(INIT) $(SUBDIRS)
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 $(SUBDIRS): %:
31         $(MAKE) -C $@
32
33 clean:
34         find . -name '*.pyc' -execdir rm -f {} \;
35         rm -f $(INIT)
36         for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir clean ; done
37         rm -rf build
38
39 index: PLC/__init__.py PLC/Methods/__init__.py
40
41 # All .py files in PLC/
42 PLC := $(filter-out %/__init__.py, $(wildcard PLC/*.py))
43 PLC_init := all = '$(notdir $(PLC:.py=))'.split()
44
45 PLC/__init__.py:
46         echo "$(PLC_init)" >$@
47
48 ifneq ($(sort $(PLC_init)), $(sort $(shell cat PLC/__init__.py 2>/dev/null)))
49 PLC/__init__.py: force
50 endif
51
52 # All .py files in PLC/Methods/ and PLC/Methods/system/
53 METHODS := $(filter-out %/__init__.py, $(wildcard PLC/Methods/*.py PLC/Methods/system/*.py))
54 Methods_init := methods = '$(notdir $(subst system/, system., $(METHODS:.py=)))'.split()
55
56 PLC/Methods/__init__.py:
57         echo "$(Methods_init)" >$@
58
59 ifneq ($(sort $(Methods_init)), $(sort $(shell cat PLC/Methods/__init__.py 2>/dev/null)))
60 PLC/Methods/__init__.py: force
61 endif
62
63 force:
64
65 .PHONY: all install force clean $(SUBDIRS)