small changes to creds/gid
[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 wsdl
9
10 install: keyconvert-install python-install wsdl-install xmlbuilder-install 
11
12 clean: keyconvert-clean python-clean wsdl-clean
13
14 uninstall: python-uninstall
15
16 .PHONY: all install clean 
17
18 ##########
19 keyconvert:
20         $(MAKE) -C keyconvert
21
22 keyconvert-install:
23         $(MAKE) -C keyconvert install
24
25 keyconvert-clean:
26         $(MAKE) -C keyconvert clean
27
28 .PHONY: keyconvert keyconvert-install keyconvert-clean 
29
30 ##########
31 python: 
32
33 xmlbuilder-install:
34         cd xmlbuilder-0.9 && python setup.py install --root=$(DESTDIR) && cd -
35  
36 python-install:
37         python setup.py install --root=$(DESTDIR)       
38         chmod 444 $(DESTDIR)/etc/sfa/default_config.xml
39
40 python-clean:
41         python setup.py clean
42         rm $(init)
43
44 .PHONY: python python-install python-clean xmlbuilder-install
45 ##########
46 wsdl: 
47         $(MAKE) -C wsdl 
48
49 # propagate DESTDIR from the specfile
50 wsdl-install:
51         $(MAKE) -C wsdl install 
52
53 wsdl-clean:
54         $(MAKE) -C wsdl clean
55
56 .PHONY: wsdl wsdl-install wsdl-clean
57 ##########
58
59 # are the .java files used ?
60 tags:   
61         find . -type f | egrep -v '/\.svn/|TAGS|\.py[co]$$|\.doc$$|\.html$$|\.pdf$$' | xargs etags
62 .PHONY: tags
63
64
65 ########## sync
66 # 2 forms are supported
67 # (*) if your plc root context has direct ssh access:
68 # make sync PLC=private.one-lab.org
69 # (*) otherwise, entering through the root context
70 # make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr
71
72 ifdef GUEST
73 ifdef PLCHOST
74 SSHURL:=root@$(PLCHOST):/vservers/$(GUEST)
75 SSHCOMMAND:=ssh root@$(PLCHOST) vserver $(GUEST)
76 endif
77 endif
78 ifdef PLC
79 SSHURL:=root@$(PLC):/
80 SSHCOMMAND:=ssh root@$(PLC)
81 endif
82
83 LOCAL_RSYNC_EXCLUDES    := --exclude '*.pyc' 
84 RSYNC_EXCLUDES          := --exclude .svn --exclude CVS --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
85 RSYNC_COND_DRY_RUN      := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
86 RSYNC                   := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
87
88 BINS =  ./config/sfa-config-tty ./config/gen-sfa-cm-config.py \
89         ./sfa/plc/sfa-import-plc.py ./sfa/plc/sfa-nuke-plc.py ./sfa/server/sfa-server.py \
90         ./sfa/client/sfi.py ./sfa/client/getNodes.py ./sfa/client/getRecord.py \
91         ./sfa/client/setRecord.py ./sfa/client/sfadump.py
92
93 sync:
94 ifeq (,$(SSHURL))
95         @echo "sync: You must define, either PLC, or PLCHOST & GUEST, on the command line"
96         @echo "  e.g. make sync PLC=private.one-lab.org"
97         @echo "  or   make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr"
98         @exit 1
99 else
100         +$(RSYNC) ./sfa/ $(SSHURL)/usr/lib/python2.5/site-packages/sfa/
101         +$(RSYNC)  $(BINS) $(SSHURL)/usr/bin
102         $(SSHCOMMAND) exec service sfa restart
103 endif
104
105 .PHONY: sync
106 ##########