just use empty __init__.py files
[sfa.git] / Makefile
1 #
2 ## (Re)builds Python metafile (__init__.py) and documentation
3
4 # overwritten by the specfile
5 DESTDIR="/"
6
7 ##########
8 all: keyconvert python
9
10 install: keyconvert-install python-install
11
12 clean: keyconvert-clean python-clean
13
14 .PHONY: all install clean 
15
16 ##########
17 keyconvert:
18         $(MAKE) -C keyconvert
19
20 keyconvert-install:
21         $(MAKE) -C keyconvert install
22
23 keyconvert-clean:
24         $(MAKE) -C keyconvert clean
25
26 .PHONY: keyconvert keyconvert-install keyconvert-clean 
27
28 ##########
29 python: index
30
31 python-install:
32         python setup.py install --root=$(DESTDIR)
33
34 python-clean:
35         python setup.py clean
36         rm $(init)
37
38 .PHONY: python python-install python-clean
39 ##########
40
41 # are the .java files used ?
42 tags:   
43         find . -type f | egrep -v '/\.svn/|TAGS|\.py[co]$$|\.doc$$|\.html$$' | xargs etags
44 .PHONY: tags
45
46
47 ########## indexes
48 subdirs = client methods plc server trust util
49 init := geni/__init__.py $(foreach subdir, $(subdirs), geni/$(subdir)/__init__.py)
50
51 force:
52 .PHONY: force 
53
54 index: $(init)
55 .PHONY: index
56
57 $(init):
58         touch $@
59
60 ########## sync
61 # 2 forms are supported
62 # (*) if your plc root context has direct ssh access:
63 # make sync PLC=private.one-lab.org
64 # (*) otherwise, entering through the root context
65 # make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr
66
67 ifdef GUEST
68 ifdef PLCHOST
69 SSHURL:=root@$(PLCHOST):/vservers/$(GUEST)
70 SSHCOMMAND:=ssh root@$(PLCHOST) vserver $(GUEST)
71 endif
72 endif
73 ifdef PLC
74 SSHURL:=root@$(PLC):/
75 SSHCOMMAND:=ssh root@$(PLC)
76 endif
77
78 LOCAL_RSYNC_EXCLUDES    := --exclude '*.pyc' 
79 RSYNC_EXCLUDES          := --exclude .svn --exclude CVS --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
80 RSYNC_COND_DRY_RUN      := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
81 RSYNC                   := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
82
83 sync:
84 ifeq (,$(SSHURL))
85         @echo "sync: You must define, either PLC, or PLCHOST & GUEST, on the command line"
86         @echo "  e.g. make sync PLC=private.one-lab.org"
87         @echo "  or   make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr"
88         @exit 1
89 else
90         +$(RSYNC) ./geni/ $(SSHURL)/usr/lib/python2.5/site-packages/geni/
91         +$(RSYNC) ./config/sfa-config-tty $(SSHURL)/usr/bin
92         $(SSHCOMMAND) exec service geni restart
93 endif
94
95 .PHONY: sync
96 ##########