2 # Node Manager Makefile
4 # David Eisenstat <deisenst@cs.princeton.edu>
5 # Mark Huang <mlhuang@cs.princeton.edu>
6 # Copyright (C) 2006 The Trustees of Princeton University
9 # autoconf compatible variables
12 systemddir := /usr/lib/systemd/system
17 all: forward_api_calls
18 $(PYTHON) setup.py build
20 forward_api_calls: forward_api_calls.c
21 $(CC) -Wall -Os -o $@ $?
24 #################### install
25 install: install-miscell install-startup
26 $(PYTHON) setup.py install \
27 --install-purelib=$(DESTDIR)/$(datadir)/NodeManager \
28 --install-platlib=$(DESTDIR)/$(datadir)/NodeManager
31 # might be better in setup.py ?
32 # NOTE: the sliver-initscripts/ and sliver-systemd stuff, being, well, for slivers,
33 # need to ship on all nodes regardless of WITH_INIT and WITH_SYSTEMD that
34 # impacts how nodemanager itself gets started
36 install -D -m 755 forward_api_calls $(DESTDIR)/$(bindir)/forward_api_calls
37 install -d -m 755 $(DESTDIR)/var/lib/nodemanager
38 install -D -m 644 /dev/null $(DESTDIR)/etc/sysconfig/nodemanager
39 install -D -m 444 README $(DESTDIR)/$(datadir)/NodeManager/README
40 install -D -m 644 logrotate/nodemanager $(DESTDIR)/etc/logrotate.d/nodemanager
41 mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts
42 rsync -av sliver-initscripts/ $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts/
43 chmod 755 $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts/
44 mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd
45 rsync -av sliver-systemd/ $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd/
46 chmod 755 $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd/
48 install-startup: install-systemd
51 mkdir -p $(DESTDIR)/$(systemddir)
52 rsync -av systemd/ $(DESTDIR)/$(systemddir)
54 #################### clean
56 $(PYTHON) setup.py clean
57 rm -f forward_api_calls *.pyc build
59 .PHONY: all install clean
61 ################################################## devel-oriented
63 git ls-files | xargs etags
68 # for use with the test framework; push local stuff on a test node
69 # howto use: go on testmaster in the build you want to use and just run
71 # cut'n paste the result in a terminal in your working dir, e.g. (although all are not required)
72 # $ export BUILD=2013.07.02--lxc18
73 # $ export PLCHOSTLXC=gotan.pl.sophia.inria.fr
74 # $ export GUESTNAME=2013.07.02--lxc18-1-vplc01
75 # $ export GUESTHOSTNAME=vplc01.pl.sophia.inria.fr
76 # $ export KVMHOST=kvm64-6.pl.sophia.inria.fr
77 # $ export NODE=vnode01.pl.sophia.inria.fr
81 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc'
82 RSYNC_EXCLUDES := --exclude .git --exclude .svn --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
83 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
84 RSYNC := rsync -e "ssh -i $(NODE).key.rsa" -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
87 NODEURL:=root@$(NODE):/
90 # this is for lxc only, we need to exclude the vs stuff that otherwise messes up everything on node
91 # WARNING: keep this in sync with setup.spec
92 LXC_EXCLUDES= --exclude sliver_vs.py --exclude coresched_vs.py --exclude drl.py
94 # run with make SYNC_RESTART=false if you want to skip restarting nm
99 synclxc: $(NODE).key.rsa
101 @echo "sync: You must define NODE on the command line"
102 @echo " e.g. make sync NODE=vnode01.inria.fr"
105 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
106 @echo WARNING : this target might not be very reliable - use with care
107 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
108 +$(RSYNC) $(LXC_EXCLUDES) --delete-excluded ./ $(NODEURL)/usr/share/NodeManager/
109 +$(RSYNC) ./systemd/ $(NODEURL)/usr/lib/systemd/system/
110 -$(SYNC_RESTART) && { ssh -i $(NODE).key.rsa root@$(NODE) service nm restart ; } ||:
115 TESTMASTER ?= testmaster.onelab.eu
118 KEYURL:=root@$(TESTMASTER):$(BUILD)/keys/key_admin.rsa
125 @echo "sync: fetching $@ - You must define TESTMASTER, BUILD and NODE on the command line"
126 @echo " e.g. make sync TESTMASTER=testmaster.onelab.eu BUILD=2010.01.22--1l-f8-32 NODE=vnode01.inria.fr"
127 @echo " note that for now all test builds use the same key, so any BUILD would do"
138 $(RSYNC) sliver-systemd/vinit.st* $(NODEURL)/vservers/$(SLICE)/usr/bin/
139 $(RSYNC) sliver-systemd/vinit.service $(NODEURL)/vservers/$(SLICE)/usr/lib/systemd/system/
140 echo "remember to run 'systemctl --system daemon-reload' within this slice"