(no commit message)
[myplc.git] / Makefile
1
2 # $Id$
3 #
4
5 ##########
6 tags:
7         find . -type f | egrep -v '.svn/|~$$' | xargs etags
8
9 .PHONY: tags
10
11 ########## sync
12 # 2 forms are supported
13 # (*) if your plc root context has direct ssh access:
14 # make sync PLC=boot.planet-lab.eu
15 # (*) otherwise, entering through the root context
16 # make sync PLCHOST=testplc.onelab.eu GUEST=vplc03.inria.fr
17
18 PLCHOST ?= testplc.onelab.eu
19
20 ifdef GUEST
21 SSHURL:=root@$(PLCHOST):/vservers/$(GUEST)
22 SSHCOMMAND:=ssh root@$(PLCHOST) vserver $(GUEST)
23 endif
24 ifdef PLC
25 SSHURL:=root@$(PLC):/
26 SSHCOMMAND:=ssh root@$(PLC)
27 endif
28
29 LOCAL_RSYNC_EXCLUDES    := --exclude '*.pyc' 
30 RSYNC_EXCLUDES          := --exclude .svn --exclude CVS --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
31 RSYNC_COND_DRY_RUN      := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
32 RSYNC                   := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
33
34 sync:
35 ifeq (,$(SSHURL))
36         @echo "sync: You must define, either PLC, or PLCHOST & GUEST, on the command line"
37         @echo "  e.g. make sync PLC=boot.planet-lab.eu"
38         @echo "  or   make sync PLCHOST=testplc.onelab.eu GUEST=vplc03.inria.fr"
39         @exit 1
40 else
41         +$(RSYNC) plc.init $(SSHURL)/etc/init.d/plc
42         +$(RSYNC) bin/ $(SSHURL)/usr/bin/
43         +$(RSYNC) plc.d/ $(SSHURL)/etc/plc.d/
44         +$(RSYNC) db-config.d/ $(SSHURL)/etc/planetlab/db-config.d/
45         +$(RSYNC) plc_config.py $(SSHURL)/usr/lib/python2.5/site-packages/plc_config.py
46         +$(RSYNC) default_config.xml $(SSHURL)/etc/planetlab/default_config.xml
47         @echo XXXXXXXX you might need to run ssh root@$(PLC) service plc start 
48 endif
49
50 #################### convenience, for debugging only
51 # make +foo : prints the value of $(foo)
52 # make ++foo : idem but verbose, i.e. foo=$(foo)
53 ++%: varname=$(subst +,,$@)
54 ++%:
55         @echo "$(varname)=$($(varname))"
56 +%: varname=$(subst +,,$@)
57 +%:
58         @echo "$($(varname))"
59