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
13 systemddir := /usr/lib/systemd/system
16 # call with either WITH_SYSTEMD=true or WITH_INIT=true
17 ifneq "$(WITH_SYSTEMD)" ""
20 ifneq "$(WITH_INIT)" ""
22 else # if not set then try to guess
23 use_systemd=$(bash -c 'type -p systemctl')
28 lib: forward_api_calls
29 python setup-lib.py build
32 python setup-vs.py build
35 python setup-lxc.py build
37 forward_api_calls: forward_api_calls.c
38 $(CC) -Wall -Os -o $@ $?
41 #################### install
42 install-lib: install-miscell install-startup
43 python setup-lib.py install \
44 --install-purelib=$(DESTDIR)/$(datadir)/NodeManager \
45 --install-platlib=$(DESTDIR)/$(datadir)/NodeManager \
46 --install-scripts=$(DESTDIR)/$(bindir)
48 # might be better in setup.py ?
50 install -m 444 README $(DESTDIR)/$(datadir)/NodeManager
51 install -d -m 755 $(DESTDIR)/var/lib/nodemanager
52 install -D -m 644 logrotate/nodemanager $(DESTDIR)/etc/logrotate.d/nodemanager
53 install -D -m 755 sshsh $(DESTDIR)/bin/sshsh
54 mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts
55 rsync -av sliver-initscripts/ $(DESTDIR)/$(datadir)/sliver-initscripts/
56 chmod 755 $(DESTDIR)/$(datadir)/sliver-initscripts/
58 ifneq "$use_systemd" ""
59 install-startup: install-systemd
61 install-startup: install-init
65 mkdir -p $(DESTDIR)$(initdir)
66 chmod 755 initscripts/*
67 rsync -av initscripts/ $(DESTDIR)$(initdir)/
70 mkdir -p $(DESTDIR)/$(systemddir)
71 rsync -av systemd/ $(DESTDIR)/$(systemddir)
74 python setup-vs.py install \
75 --install-purelib=$(DESTDIR)/$(datadir)/NodeManager \
76 --install-platlib=$(DESTDIR)/$(datadir)/NodeManager \
77 --install-scripts=$(DESTDIR)/$(bindir)
78 install -m 444 README $(DESTDIR)/$(datadir)/NodeManager
81 python setup-lxc.py install \
82 --install-purelib=$(DESTDIR)/$(datadir)/NodeManager \
83 --install-platlib=$(DESTDIR)/$(datadir)/NodeManager \
84 --install-scripts=$(DESTDIR)/$(bindir)
85 install -m 444 README $(DESTDIR)/$(datadir)/NodeManager
87 #################### clean
89 python setup-lib.py clean
90 python setup-vs.py clean
91 python setup-lxc.py clean
92 rm -f forward_api_calls *.pyc build
94 .PHONY: all install clean
98 (find . '(' -name '*.py' -o -name '*.c' -o -name '*.spec' ')' ; ls initscripts/*) | xargs etags
103 # for use with the test framework; push local stuff on a test node
104 # howto use: go on testmaster in the build you want to use and just run
106 # cut'n paste the result in a terminal in your working dir, e.g. (although all are not required)
107 # $ export BUILD=2013.07.02--lxc18
108 # $ export PLCHOSTLXC=gotan.pl.sophia.inria.fr
109 # $ export GUESTNAME=2013.07.02--lxc18-1-vplc01
110 # $ export GUESTHOSTNAME=vplc01.pl.sophia.inria.fr
111 # $ export KVMHOST=kvm64-6.pl.sophia.inria.fr
112 # $ export NODE=vnode01.pl.sophia.inria.fr
116 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc'
117 RSYNC_EXCLUDES := --exclude .git --exclude .svn --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
118 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
119 RSYNC := rsync -e "ssh -i $(NODE).key.rsa" -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
122 NODEURL:=root@$(NODE):/
125 # this is for lxc only, we need to exclude the vs stuff that otherwise messes up everything on node
126 # keep this in sync with setup-vs.spec
127 LXC_EXCLUDES= --exclude sliver_vs.py --exclude coresched_vs.py
131 synclxc: $(NODE).key.rsa
133 @echo "sync: You must define NODE on the command line"
134 @echo " e.g. make sync NODE=vnode01.inria.fr"
137 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
138 @echo WARNING : this target might not be very reliable - use with care
139 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
140 +$(RSYNC) --exclude sshsh $(LXC_EXCLUDES) --delete-excluded ./ $(NODEURL)/usr/share/NodeManager/
141 +$(RSYNC) ./sshsh $(NODEURL)/bin/
142 # +$(RSYNC) ./initscripts/ $(NODEURL)/etc/init.d/
143 +$(RSYNC) ./systemd/ $(NODEURL)/usr/lib/systemd/system/
144 # ssh -i $(NODE).key.rsa root@$(NODE) service nm restart
149 TESTMASTER ?= testmaster.onelab.eu
152 KEYURL:=root@$(TESTMASTER):$(BUILD)/keys/key_admin.rsa
159 @echo "sync: fetching $@ - You must define TESTMASTER, BUILD and NODE on the command line"
160 @echo " e.g. make sync TESTMASTER=testmaster.onelab.eu BUILD=2010.01.22--1l-f8-32 NODE=vnode01.inria.fr"
161 @echo " note that for now all test builds use the same key, so any BUILD would do"