initial package for geniwrapper.
[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: $(init) $(subdirs)
11
12 install: all
13         python setup.py install --root=$(DESTDIR)
14
15 $(subdirs): $(init)
16
17 $(subdirs): %:
18         $(MAKE) -C $@
19
20 clean:
21         python setup.py clean
22         cd keyconvert && make clean
23
24 index: $(init)
25
26 index-clean:
27         rm $(init)
28
29 .phony: all install force clean index $(subdirs)
30
31 geni/__init__.py:
32         (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()') > $@
33
34 geni/methods/__init__.py:
35         (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()') > $@
36
37 geni/util/__init__.py:
38         (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()') > $@
39
40 geni_now := $(sort $(shell fgrep -v '"' geni/__init__.py 2>/dev/null))
41 # what should be declared
42 geni_paths := $(filter-out %/__init__.py, $(wildcard geni/*.py))
43 geni_files := $(sort $(notdir $(geni_paths:.py=)))
44 ifneq ($(geni_now), $(geni_files))
45 geni/__init__.py: force
46 endif
47
48 methods_now := $(sort $(shell fgrep -v '"' geni/methods/__init__.py 2>/dev/null))
49 # what should be declared
50 method_paths := $(filter-out %/__init__.py, $(wildcard geni/methods/*.py))
51 method_files := $(sort $(notdir $(method_paths:.py=)))
52 ifneq ($(methods_now), $(methods_files))
53 geni/methods/__init__.py: force
54 endif
55
56 util_now := $(sort $(shell fgrep -v '"' geni/util/__init__.py 2>/dev/null))
57 # what should be declared
58 util_paths := $(filter-out %/__init__.py, $(wildcard geni/util/*.py))
59 util_files := $(sort $(notdir $(util_paths:.py=)))
60 ifneq ($(util_now), $(util_files))
61 geni/util/__init__.py: force
62 endif
63
64 force:
65
66 .PHONY: all install force clean index tags $(subdirs)