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 # call with either WITH_SYSTEMD=true or WITH_INIT=true
13 initdir=/etc/rc.d/init.d
14 systemddir := /usr/lib/systemd/system
17 all: forward_api_calls
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 --install-scripts=$(DESTDIR)/$(bindir)
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 $(DESTDIR)/var/lib/nodemanager
37 install -D -m 644 /dev/null $(DESTDIR)/etc/sysconfig/nodemanager
38 install -D -m 444 README $(DESTDIR)/$(datadir)/NodeManager/README
39 install -D -m 644 logrotate/nodemanager $(DESTDIR)/etc/logrotate.d/nodemanager
40 mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts
41 rsync -av sliver-initscripts/ $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts/
42 chmod 755 $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts/
43 mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd
44 rsync -av sliver-systemd/ $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd/
45 chmod 755 $(DESTDIR)/$(datadir)/NodeManager/sliver-systemd/
47 # this now is for the startup of nodemanager itself
48 ifneq "$(WITH_SYSTEMD)" ""
49 install-startup: install-systemd
51 ifneq "$(WITH_INIT)" ""
52 install-startup: install-init
56 mkdir -p $(DESTDIR)$(initdir)
57 chmod 755 initscripts/*
58 rsync -av initscripts/ $(DESTDIR)$(initdir)/
61 mkdir -p $(DESTDIR)/$(systemddir)
62 rsync -av systemd/ $(DESTDIR)/$(systemddir)
64 #################### clean
67 rm -f forward_api_calls *.pyc build
69 .PHONY: all install clean
71 #################### debian-related
72 # This is called from the build with the following variables set
73 # (see build/Makefile and target_debian)
78 DEBVERSION=$(RPMVERSION).$(RPMRELEASE)
79 DEBTARBALL=../$(RPMNAME)_$(DEBVERSION).orig.tar.bz2
80 DATE=$(shell date -u +"%a, %d %b %Y %T")
83 debian: debian/changelog debian.source debian.package
85 debian/changelog: debian/changelog.in
86 sed -e "s|@VERSION@|$(DEBVERSION)|" -e "s|@DATE@|$(DATE)|" debian/changelog.in > debian/changelog
89 rsync -a $(RPMTARBALL) $(DEBTARBALL)
92 debuild --set-envvar PREFIX=/usr -uc -us -b
95 $(MAKE) -f debian/rules clean
96 rm -rf build/ MANIFEST ../*.tar.gz ../*.dsc ../*.build
97 find . -name '*.pyc' -delete
99 ################################################## devel-oriented
101 (find . '(' -name '*.py' -o -name '*.c' -o -name '*.spec' ')' ; ls initscripts/*) | xargs etags
106 # for use with the test framework; push local stuff on a test node
107 # howto use: go on testmaster in the build you want to use and just run
109 # cut'n paste the result in a terminal in your working dir, e.g. (although all are not required)
110 # $ export BUILD=2013.07.02--lxc18
111 # $ export PLCHOSTLXC=gotan.pl.sophia.inria.fr
112 # $ export GUESTNAME=2013.07.02--lxc18-1-vplc01
113 # $ export GUESTHOSTNAME=vplc01.pl.sophia.inria.fr
114 # $ export KVMHOST=kvm64-6.pl.sophia.inria.fr
115 # $ export NODE=vnode01.pl.sophia.inria.fr
119 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc'
120 RSYNC_EXCLUDES := --exclude .git --exclude .svn --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
121 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
122 RSYNC := rsync -e "ssh -i $(NODE).key.rsa" -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
125 NODEURL:=root@$(NODE):/
128 # this is for lxc only, we need to exclude the vs stuff that otherwise messes up everything on node
129 # keep this in sync with setup-vs.spec
130 LXC_EXCLUDES= --exclude sliver_vs.py --exclude coresched_vs.py
134 synclxc: $(NODE).key.rsa
136 @echo "sync: You must define NODE on the command line"
137 @echo " e.g. make sync NODE=vnode01.inria.fr"
140 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
141 @echo WARNING : this target might not be very reliable - use with care
142 @echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
143 +$(RSYNC) $(LXC_EXCLUDES) --delete-excluded ./ $(NODEURL)/usr/share/NodeManager/
144 # +$(RSYNC) ./initscripts/ $(NODEURL)/etc/init.d/
145 +$(RSYNC) ./systemd/ $(NODEURL)/usr/lib/systemd/system/
146 # ssh -i $(NODE).key.rsa root@$(NODE) service nm restart
151 TESTMASTER ?= testmaster.onelab.eu
154 KEYURL:=root@$(TESTMASTER):$(BUILD)/keys/key_admin.rsa
161 @echo "sync: fetching $@ - You must define TESTMASTER, BUILD and NODE on the command line"
162 @echo " e.g. make sync TESTMASTER=testmaster.onelab.eu BUILD=2010.01.22--1l-f8-32 NODE=vnode01.inria.fr"
163 @echo " note that for now all test builds use the same key, so any BUILD would do"