for federation : Peers and ForeignNodes
[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.2 2006/10/25 21:05:40 mlhuang Exp $
8 #
9
10 # Metafiles
11 INIT := PLC/__init__.py PLC/Methods/__init__.py
12
13 # Other stuff
14 SUBDIRS := doc php
15
16 all: $(INIT) $(SUBDIRS)
17
18 $(SUBDIRS): %:
19         $(MAKE) -C $@
20
21 clean:
22         find . -name '*.pyc' -execdir rm -f {} \;
23         rm -f $(INIT)
24         for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir clean ; done
25
26 index: PLC/__init__.py PLC/Methods/__init__.py
27
28 # All .py files in PLC/
29 PLC := $(filter-out %/__init__.py, $(wildcard PLC/*.py))
30 PLC_init := all = '$(notdir $(PLC:.py=))'.split()
31
32 PLC/__init__.py:
33         echo "$(PLC_init)" >$@
34
35 ifneq ($(sort $(PLC_init)), $(sort $(shell cat PLC/__init__.py 2>/dev/null)))
36 PLC/__init__.py: force
37 endif
38
39 # All .py files in PLC/Methods/ and PLC/Methods/system/
40 METHODS := $(filter-out %/__init__.py, $(wildcard PLC/Methods/*.py PLC/Methods/system/*.py))
41 Methods_init := methods = '$(notdir $(subst system/, system., $(METHODS:.py=)))'.split()
42
43 PLC/Methods/__init__.py:
44         echo "$(Methods_init)" >$@
45
46 ifneq ($(sort $(Methods_init)), $(sort $(shell cat PLC/Methods/__init__.py 2>/dev/null)))
47 PLC/Methods/__init__.py: force
48 endif
49
50 force:
51
52 .PHONY: force clean $(SUBDIRS)