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
29 chmod +x $(DESTDIR)/$(datadir)/NodeManager/conf_files.py
32 # might be better in setup.py ?
33 # NOTE: the sliver-initscripts/ and sliver-systemd stuff, being, well, for slivers,
34 # need to ship on all nodes regardless of WITH_INIT and WITH_SYSTEMD that
35 # impacts how nodemanager itself gets started
37 install -D -m 755 forward_api_calls $(DESTDIR)/$(bindir)/forward_api_calls
38 install -d -m 755 $(DESTDIR)/var/lib/nodemanager
39 install -D -m 644 /dev/null $(DESTDIR)/etc/sysconfig/nodemanager
40 install -D -m 444 README $(DESTDIR)/$(datadir)/NodeManager/README
41 install -D -m 644 logrotate/nodemanager $(DESTDIR)/etc/logrotate.d/nodemanager
42 mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts
43 rsync -av sliver-initscripts/ $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts/
44 chmod 755 $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts/
45 mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd
46 rsync -av sliver-systemd/ $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd/
47 chmod 755 $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd/
49 install-startup: install-systemd
52 mkdir -p $(DESTDIR)/$(systemddir)
53 rsync -av systemd/ $(DESTDIR)/$(systemddir)
55 #################### clean
57 $(PYTHON) setup.py clean
58 rm -f forward_api_calls *.pyc build
60 .PHONY: all install clean
62 ################################################## devel-oriented
64 git ls-files | xargs etags
69 # for use with the test framework; push local stuff on a test node
70 # howto use: go on testmaster in the build you want to use and just run
72 # cut'n paste the result in a terminal in your working dir, e.g. (although all are not required)
73 # $ export BUILD=2013.07.02--lxc18
74 # $ export PLCHOSTLXC=gotan.pl.sophia.inria.fr
75 # $ export GUESTNAME=2013.07.02--lxc18-1-vplc01
76 # $ export GUESTHOSTNAME=vplc01.pl.sophia.inria.fr
77 # $ export KVMHOST=kvm64-6.pl.sophia.inria.fr
78 # $ export NODE=vnode01.pl.sophia.inria.fr
82 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc'
83 RSYNC_EXCLUDES := --exclude .git --exclude .svn --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
84 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
85 RSYNC := rsync -e "ssh -i $(NODE).key.rsa" -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
88 NODEURL:=root@$(NODE):/
91 # this is for lxc only, we need to exclude the vs stuff that otherwise messes up everything on node
92 # WARNING: keep this in sync with setup.spec
93 LXC_EXCLUDES= --exclude sliver_vs.py --exclude coresched_vs.py --exclude drl.py
95 # run with make SYNC_RESTART=false if you want to skip restarting nm
100 synclxc: $(NODE).key.rsa
102 @echo "sync: You must define NODE on the command line"
103 @echo " e.g. make sync NODE=vnode01.inria.fr"
106 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
107 @echo WARNING : this target might not be very reliable - use with care
108 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
109 +$(RSYNC) $(LXC_EXCLUDES) --delete-excluded ./ $(NODEURL)/usr/share/NodeManager/
110 +$(RSYNC) ./systemd/ $(NODEURL)/usr/lib/systemd/system/
111 -$(SYNC_RESTART) && { ssh -i $(NODE).key.rsa root@$(NODE) service nm restart ; } ||:
116 TESTMASTER ?= testmaster.onelab.eu
119 KEYURL:=root@$(TESTMASTER):$(BUILD)/keys/key_admin.rsa
126 @echo "sync: fetching $@ - You must define TESTMASTER, BUILD and NODE on the command line"
127 @echo " e.g. make sync TESTMASTER=testmaster.onelab.eu BUILD=2010.01.22--1l-f8-32 NODE=vnode01.inria.fr"
128 @echo " note that for now all test builds use the same key, so any BUILD would do"
139 $(RSYNC) sliver-systemd/vinit.st* $(NODEURL)/vservers/$(SLICE)/usr/bin/
140 $(RSYNC) sliver-systemd/vinit.service $(NODEURL)/vservers/$(SLICE)/usr/lib/systemd/system/
141 echo "remember to run 'systemctl --system daemon-reload' within this slice"