+LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc' --exclude Accessors_site.py
+RSYNC_EXCLUDES := --exclude .svn --exclude .git --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
+RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
+RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
+
+sync:
+ifeq (,$(SSHURL))
+ @echo "sync: I need more info from the command line, e.g."
+ @echo " make sync PLC=boot.planetlab.eu"
+ @echo " make sync PLCHOSTLXC=.. GUESTHOSTNAME=.. GUESTNAME=.."
+ @exit 1
+else
+ +$(RSYNC) plcsh PLC planetlab5.sql migrations aspects $(SSHURL)/usr/share/plc_api/
+ +$(RSYNC) db-config.d/ $(SSHURL)/etc/planetlab/db-config.d/
+ +$(RSYNC) plc.d/ $(SSHURL)/etc/plc.d/
+ +$(RSYNC) apache/plc.wsgi $(SSHURL)/usr/share/plc_api/apache/
+ $(SSHCOMMAND) /etc/plc.d/httpd stop
+ $(SSHCOMMAND) /etc/plc.d/httpd start
+endif
+
+#################### convenience, for debugging only
+# make +foo : prints the value of $(foo)
+# make ++foo : idem but verbose, i.e. foo=$(foo)
+++%: varname=$(subst +,,$@)
+++%:
+ @echo "$(varname)=$($(varname))"
++%: varname=$(subst +,,$@)
++%:
+ @echo "$($(varname))"