Setting tag nodemanager-2.0-38
[nodemanager.git] / Makefile
1 #
2 # Node Manager Makefile
3 #
4 # David Eisenstat <deisenst@cs.princeton.edu>
5 # Mark Huang <mlhuang@cs.princeton.edu>
6 # Copyright (C) 2006 The Trustees of Princeton University
7 #
8
9 # autoconf compatible variables
10 datadir := /usr/share
11 bindir := /usr/bin
12
13 lib: forward_api_calls
14         python setup-lib.py build
15
16 vs: 
17         python setup-vs.py build
18
19 forward_api_calls: forward_api_calls.c
20         $(CC) -Wall -Os -o $@ $?
21         strip $@
22
23 install-lib:
24         python setup-lib.py install \
25             --install-purelib=$(DESTDIR)/$(datadir)/NodeManager \
26             --install-platlib=$(DESTDIR)/$(datadir)/NodeManager \
27             --install-scripts=$(DESTDIR)/$(bindir)
28         install -m 444 README $(DESTDIR)/$(datadir)/NodeManager
29
30 install-vs:
31         python setup-vs.py install \
32             --install-purelib=$(DESTDIR)/$(datadir)/NodeManager \
33             --install-platlib=$(DESTDIR)/$(datadir)/NodeManager \
34             --install-scripts=$(DESTDIR)/$(bindir)
35         install -m 444 README $(DESTDIR)/$(datadir)/NodeManager
36
37 clean:
38         python setup-lib.py clean
39         python setup-vs.py clean
40         rm -f forward_api_calls *.pyc build
41
42 .PHONY: all install clean
43
44 ##########
45 tags:
46         (find . '(' -name '*.py' -o -name '*.c' -o -name '*.spec' ')' ; ls initscripts/*) | xargs etags 
47
48 .PHONY: tags
49
50 ########## sync
51 # for use with the test framework; push local stuff on a test node
52 # make sync NODE=vnode01.inria.fr
53 # specify TESTMASTER and BUILD if the key is not available yet
54
55 LOCAL_RSYNC_EXCLUDES    := --exclude '*.pyc' 
56 RSYNC_EXCLUDES          := --exclude .git  --exclude .svn --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
57 RSYNC_COND_DRY_RUN      := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
58 RSYNC                   := rsync -e "ssh -i $(NODE).key.rsa" -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
59
60 ifdef NODE
61 NODEURL:=root@$(NODE):/
62 endif
63
64 sync: $(NODE).key.rsa
65 ifeq (,$(NODEURL))
66         @echo "sync: You must define NODE on the command line"
67         @echo "  e.g. make sync NODE=vnode01.inria.fr"
68         @exit 1
69 else
70         +$(RSYNC) ./ $(NODEURL)/usr/share/NodeManager/
71         +$(RSYNC) ./initscripts/nm $(NODEURL)/etc/init.d/nm
72         ssh -i $(NODE).key.rsa root@$(NODE) service nm restart
73 endif
74
75 ### fetching the key
76
77 TESTMASTER ?= testmaster.onelab.eu
78
79 ifdef BUILD
80 KEYURL:=root@$(TESTMASTER):$(BUILD)/keys/key_admin.rsa
81 endif
82
83 key: $(NODE).key.rsa
84
85 $(NODE).key.rsa:
86 ifeq (,$(KEYURL))
87         @echo "sync: fetching $@ - You must define TESTMASTER, BUILD and NODE on the command line"
88         @echo "  e.g. make sync TESTMASTER=testmaster.onelab.eu BUILD=2010.01.22--1l-f8-32 NODE=vnode01.inria.fr"
89         @echo "  note that for now all test builds use the same key, so any BUILD would do"
90         @exit 1
91 else
92         @echo "FETCHING key"
93         +scp $(KEYURL) $@
94 endif
95
96 ### utility - find out the node name for a given BUILD
97
98 ifdef BUILD
99 NODEIPCOMMAND:=ssh root@$(TESTMASTER) cat $(BUILD)/arg-ips-node
100 endif
101
102 nodename:
103 ifeq (,$(NODEIPCOMMAND))
104         @echo "nodename: You must define TESTMASTER and BUILD on the command line"
105 else
106         $(NODEIPCOMMAND)
107 endif