added clean target to all. clean target now cleans keyconvert
[sfa.git] / Makefile
1 #
2 ## (Re)builds Python metafile (__init__.py) and documentation
3 #
4
5 # Meta
6 init := geni/__init__.py geni/util/__init__.py geni/methods/__init__.py 
7
8 subdirs := keyconvert #pyOpenSSL-0.9
9  
10 all: clean install $(init) $(subdirs)
11
12 install: 
13         python setup.py install
14
15 $(subdirs): $(init)
16
17 $(subdirs): %:
18         $(MAKE) -C $@
19
20 clean:
21         python setup.py uninstall
22         cd keyconvert && make clean
23         cd - 
24         # XX remove keyconvert   
25
26 index: $(init)
27
28 index-clean:
29         rm $(init)
30
31 .phony: all install force clean index $(subdirs)
32
33 geni/__init__.py:
34         (echo '## Please use make index to update this file' ; echo 'all = """' ; cd geni; ls -1 *.py | grep -v __init__ | sed -e 's,.py$$,,' ; echo '""".split()') > $@
35
36 geni/methods/__init__.py:
37         (echo '## Please use make index to update this file' ; echo 'all = """' ; cd geni/methods; ls -1 *.py | grep -v __init__ | sed -e 's,.py$$,,' ; echo '""".split()') > $@
38
39 geni/util/__init__.py:
40         (echo '## Please use make index to update this file' ; echo 'all = """' ; cd geni/util; ls -1 *.py | grep -v __init__ | sed -e 's,.py$$,,' ; echo '""".split()') > $@
41
42 geni_now := $(sort $(shell fgrep -v '"' geni/__init__.py 2>/dev/null))
43 # what should be declared
44 geni_paths := $(filter-out %/__init__.py, $(wildcard geni/*.py))
45 geni_files := $(sort $(notdir $(geni_paths:.py=)))
46 ifneq ($(geni_now), $(geni_files))
47 geni/__init__.py: force
48 endif
49
50 methods_now := $(sort $(shell fgrep -v '"' geni/methods/__init__.py 2>/dev/null))
51 # what should be declared
52 method_paths := $(filter-out %/__init__.py, $(wildcard geni/methods/*.py))
53 method_files := $(sort $(notdir $(method_paths:.py=)))
54 ifneq ($(methods_now), $(methods_files))
55 geni/methods/__init__.py: force
56 endif
57
58 util_now := $(sort $(shell fgrep -v '"' geni/util/__init__.py 2>/dev/null))
59 # what should be declared
60 util_paths := $(filter-out %/__init__.py, $(wildcard geni/util/*.py))
61 util_files := $(sort $(notdir $(util_paths:.py=)))
62 ifneq ($(util_now), $(util_files))
63 geni/util/__init__.py: force
64 endif
65
66 force:
67
68 .PHONY: all install force clean index tags $(subdirs)