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