GNUmakefile.in 8.39 KB
Newer Older
1
#
2
# EMULAB-COPYRIGHT
Mike Hibler's avatar
Mike Hibler committed
3
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
4 5
# All rights reserved.
#
6 7
# Testbed Makefile
#
8 9 10 11 12
SRCDIR		= @srcdir@
OBJDIR		= .
SUBDIR		= 
TESTBED_SRCDIR  = @top_srcdir@
DISTCLEAN_FILES = @DISTCLEAN_FILES@ 
13
EVENTSYS	= @EVENTSYS@
14
PELABSUPPORT	= @PELABSUPPORT@
15

16 17
SYSTEM	       := $(shell uname -s)

18 19
include Makeconf

20 21 22
#
# Ordering here matters!
# Things with no dependencies go first: 
23
#   assign db lib www
24 25
# Things that may have dependencies go next:
#   @optional_subdirs@ (has event)
26
#   ipod os security sensors 
27 28 29 30
# Then things that only depend on stuff we've done:
#   pxe tbsetup tmcd utils www tip capture vis
# Then things that depend on stuff we just did:
#
31 32
SUBDIRS = lib db assign www @optional_subdirs@ ipod security sensors \
		pxe tbsetup account tmcd utils tip capture ipod vis \
33
		sensors os xmlrpc install/newnode_sshkeys mote tools/whol \
34
		tools/svn wiki bugdb collab tools/rmanage
35

36
all:		all-subdirs 
37

38
install:	
39 40
	@echo "Choose either boss-install, ops-install or fs-install"
	@echo "Choose opsfs-install instead of ops-install for a combined ops/fs machine"
41
	@echo "Choose tipserv-install for dedicated tip server machines."
42 43

#
44
# For installation on boss node
45
# 
46
boss-install:	install-schemacheck install-sitevarscheck install-dbfillcheck \
47
		install-subdirs install-mkdirs install-setbuildinfo
48
	@echo "Boss node installed!"
49 50 51 52

#
# Same target, with the install-schemacheck dependency omitted
# 
53
boss-install-force:	install-subdirs install-mkdirs install-setbuildinfo
54
	@echo "Boss node installed!"
55

56
post-install:
57
	@$(MAKE) -C db post-install
58
	@$(MAKE) -C ipod post-install
59
	@$(MAKE) -C tbsetup post-install
60
	@$(MAKE) -C account post-install
61
	@$(MAKE) -C security post-install
62 63
	@$(MAKE) -C vis post-install
	@$(MAKE) -C www post-install
64
ifeq ($(EVENTSYS),1)
65
	@$(MAKE) -C event post-install
66
endif
67
	@$(MAKE) -C mote post-install
68
	@$(MAKE) -C tools post-install
69
	@$(MAKE) -C wiki post-install
70
	@$(MAKE) -C bugdb post-install
71
	@$(MAKE) -C collab post-install
72
	@$(MAKE) -C utils post-install
73

74
#
75
# For installation on the 'ops' or 'users' node (okay, plastic)
76
# 
77
ops-install:
78 79 80 81
	-mkdir -p $(INSTALL_TOPDIR)/log
	-mkdir -p $(INSTALL_TOPDIR)/log/mysql
	-chmod 770 $(INSTALL_TOPDIR)/log/mysql
	-chown mysql.mysql $(INSTALL_TOPDIR)/log/mysql
82 83
	@$(MAKE) -C tbsetup control-install
	@$(MAKE) -C security control-install
84
	@$(MAKE) -C tip control-install
Leigh Stoller's avatar
Leigh Stoller committed
85
#	@$(MAKE) -C os control-install
86 87
	@$(MAKE) -C db control-install
	@$(MAKE) -C tbsetup control-install
88
	@$(MAKE) -C utils control-install
89
	@$(MAKE) -C lib control-install
90
ifeq ($(EVENTSYS),1)
91
	@$(MAKE) -C event control-install
92
endif
93
	@$(MAKE) -C sensors control-install
94
	@$(MAKE) -C xmlrpc control-install
95
	@$(MAKE) -C tmcd control-install
Leigh Stoller's avatar
Leigh Stoller committed
96
	@$(MAKE) -C account control-install
97 98 99
ifeq ($(PELABSUPPORT),1)
	@$(MAKE) -C pelab control-install
endif
100

101 102
fs-install:
	@$(MAKE) -C tbsetup fs-install
103
	@$(MAKE) -C sensors fs-install
104 105 106 107

opsfs-install: ops-install fs-install
	@echo "Combined ops/fs install done."

108
install-mkdirs:
109
	-mkdir -p $(INSTALL_TOPDIR)/opsdir
110 111
	-mkdir -p $(INSTALL_TOPDIR)/locks
	-mkdir -p $(INSTALL_TOPDIR)/log
112 113
	-mkdir -p $(INSTALL_TOPDIR)/log/mysql
	-mkdir -p $(INSTALL_TOPDIR)/log/exports
114
	-mkdir -p $(INSTALL_TOPDIR)/lists
115
	-mkdir -p $(INSTALL_TOPDIR)/backup
116
	-mkdir -p $(INSTALL_TOPDIR)/etc
117
	-mkdir -p $(INSTALL_TOPDIR)/expwork
118 119
	-mkdir -p $(INSTALL_TOPDIR)/batch
	-chmod 777 $(INSTALL_TOPDIR)/batch
120 121
	-mkdir -p $(INSTALL_TOPDIR)/expinfo
	-chmod 777 $(INSTALL_TOPDIR)/expinfo
122 123
	-mkdir -p $(INSTALL_TOPDIR)/exparchive
	-chmod 777 $(INSTALL_TOPDIR)/exparchive
124 125
	-mkdir -p $(INSTALL_TOPDIR)/exparchive/Archive
	-chmod 777 $(INSTALL_TOPDIR)/exparchive/Archive
126 127
	-mkdir -p $(INSTALL_TOPDIR)/images
	-chmod 775 $(INSTALL_TOPDIR)/images
128
	-ln -s /usr/testbed/bin/nse $(INSTALL_TOPDIR)/bin
129 130
	-mkdir -p $(INSTALL_TOPDIR)/ssl
	-chmod 770 $(INSTALL_TOPDIR)/ssl
131

132 133
tipserv-install:
	-mkdir -p $(INSTALL_TOPDIR)/log/tiplogs
134
	-mkdir -p $(INSTALL_TOPDIR)/etc
135 136 137 138
	@$(MAKE) -C tip tipserv-install
	@$(MAKE) -C capture tipserv-install
	@$(MAKE) -C tbsetup tipserv-install

139 140
client-mkdirs:
	-mkdir -p $(DESTDIR)$(CLIENT_BINDIR)
141
	-mkdir -p $(DESTDIR)$(CLIENT_MANDIR)
142 143

client:
144
	@$(MAKE) -C lib/libtb client
145
ifeq ($(EVENTSYS),1)
146
	@$(MAKE) -C event client
147
endif
148
	@$(MAKE) -C os client
149
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
150 151
	@$(MAKE) -C capture client
	@$(MAKE) -C tip client
152
	@$(MAKE) -C tools client
153
endif
154 155 156 157
	@$(MAKE) -C sensors client
	@$(MAKE) -C tmcd client

client-install: client client-mkdirs
158
ifeq ($(EVENTSYS),1)
159
	@$(MAKE) -C event client-install
160
endif
161
	@$(MAKE) -C os client-install
162
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
163 164
	@$(MAKE) -C capture client-install
	@$(MAKE) -C tip client-install
165
	@$(MAKE) -C tools client-install
166
endif
167
	@$(MAKE) -C sensors client-install
168 169
	@$(MAKE) -C tmcd client-install

170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
TARBALLDESTDIR = /var/tmp/emulab-client

client-tarball:
	@if [ `id -u` -ne 0 ]; then \
	    echo '*** Must run as root!'; \
	    false; \
	fi
	@if [ -d "$(TARBALLDESTDIR)" ]; then \
	    echo "$(TARBALLDESTDIR) already exists."; \
	    echo "Remove it and try again."; \
	    false; \
	fi
	echo "Building and installing client-side in $(TARBALLDESTDIR)..."
	DESTDIR=$(TARBALLDESTDIR) $(MAKE) client-install
	echo "Creating tarball..."
	tar czf emulab-client.tar.gz -C $(TARBALLDESTDIR) .

187 188 189 190
destdircheck:
	@if [ -z "$(DESTDIR)" ]; then \
	    echo "You must define DESTDIR for this target!"; \
	    false; \
191 192 193 194
	fi
	@if [ "$(DESTDIR)" = "/" ]; then \
	    echo "DESTDIR is '/', really really bad idea!"; \
	    false; \
195 196
	fi

197 198 199 200 201 202 203
mfsoscheck:
	@if [ `uname -s` != "FreeBSD" ]; then \
	    echo "Must build MFS files on a FreeBSD system!"; \
	    false; \
	fi

mfs: mfsoscheck
204 205 206 207
	@$(MAKE) -C os mfs
	@$(MAKE) -C sensors mfs
	@$(MAKE) -C tmcd mfs

Mike Hibler's avatar
Mike Hibler committed
208 209 210 211 212
mfs-nostatic: mfsoscheck
	@NOSTATIC=1 $(MAKE) -C os mfs
	@NOSTATIC=1 $(MAKE) -C sensors mfs
	@NOSTATIC=1 $(MAKE) -C tmcd mfs

213
mfs-install: destdircheck mfs client-mkdirs
214 215 216 217
	@$(MAKE) -C os mfs-install
	@$(MAKE) -C sensors mfs-install
	@$(MAKE) -C tmcd mfs-install

Mike Hibler's avatar
Mike Hibler committed
218 219 220 221 222
mfs-nostatic-install: destdircheck mfs-nostatic client-mkdirs
	@$(MAKE) -C os mfs-install
	@$(MAKE) -C sensors mfs-install
	@$(MAKE) -C tmcd mfs-install

223 224 225 226 227
frisbee-mfs: mfsoscheck
	@$(MAKE) -C cdrom/groklilo client
	@$(MAKE) -C os frisbee-mfs
	@$(MAKE) -C tmcd frisbee-mfs

Mike Hibler's avatar
Mike Hibler committed
228 229 230 231 232
frisbee-mfs-nostatic: mfsoscheck
	@NOSTATIC=1 $(MAKE) -C cdrom/groklilo client
	@NOSTATIC=1 $(MAKE) -C os frisbee-mfs
	@NOSTATIC=1 $(MAKE) -C tmcd frisbee-mfs

233 234 235 236 237
frisbee-mfs-install: destdircheck frisbee-mfs
	@CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C cdrom/groklilo client-install
	@$(MAKE) -C os frisbee-mfs-install
	@$(MAKE) -C tmcd frisbee-mfs-install

Mike Hibler's avatar
Mike Hibler committed
238 239 240 241 242
frisbee-mfs-nostatic-install: destdircheck frisbee-mfs-nostatic
	@CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C cdrom/groklilo client-install
	@$(MAKE) -C os frisbee-mfs-install
	@$(MAKE) -C tmcd frisbee-mfs-install

243 244 245 246 247
#
# A check to see if this is a 'real' install. Kinda hacky, but as far as I can
# tell, you can't put ifeq()'s inside of targets
#
ifeq ($(TBROOT),/usr/testbed)
248
SCHEMACHECK= cd $(OBJDIR)/db && perl schemacheck
249 250 251 252 253 254 255
else
SCHEMACHECK= @echo "Skipping schema check, since prefix isn't /usr/testbed"
endif
install-schemacheck:
	@echo "Checking DB schema..."
	$(SCHEMACHECK)

256 257 258 259 260 261 262 263 264
ifeq ($(TBROOT),/usr/testbed)
SITEVARSCHECK= cd $(OBJDIR)/db && perl sitevarscheck
else
SITEVARSCHECK= @echo "Skipping sitevars check, since prefix isn't /usr/testbed"
endif
install-sitevarscheck:
	@echo "Checking Site variables..."
	$(SITEVARSCHECK)

265 266 267 268 269 270 271 272 273
ifeq ($(TBROOT),/usr/testbed)
DBFILLCHECK= cd $(OBJDIR)/db && perl dbfillcheck
else
DBFILLCHECK= @echo "Skipping DB fill check, since prefix isn't /usr/testbed"
endif
install-dbfillcheck:
	@echo "Checking Initial DB Fill ..."
	$(DBFILLCHECK)

274 275 276 277 278 279 280 281 282
ifeq ($(TBROOT),/usr/testbed)
SETBUILDINFO= cd $(OBJDIR)/utils && perl setbuildinfo
else
SETBUILDINFO= @echo "Skipping setbuildinfo, since prefix isn't /usr/testbed"
endif
install-setbuildinfo:
	@echo "Setting the Build and Version info"
	$(SETBUILDINFO)

283 284
clean:		clean-subdirs
distclean:	distclean-subdirs
Mike Hibler's avatar
Mike Hibler committed
285
	rm -f Makeconf GNUmakefile config.h config.status config.cache config.log
286
	rm -f $(DISTCLEAN_FILES)
287

288 289 290 291 292
elabinelab:
	-mkdir -p $(INSTALL_TOPDIR)/src
	rm -f $(INSTALL_TOPDIR)/src/emulab-src.tar.gz
	tar czf $(INSTALL_TOPDIR)/src/emulab-src.tar.gz -C $(SRCDIR) .

293 294 295 296 297
# How to recursively descend into subdirectories to make general
# targets such as `all'.
%.MAKE:
	@$(MAKE) -C $(dir $@) $(basename $(notdir $@))
%-subdirs: $(addsuffix /%.MAKE,$(SUBDIRS)) ;
298

299 300
# By default, make any target by descending into subdirectories.
%: %-subdirs ;
301

302
.PHONY: post-install install-mkdirs
303 304 305

# Get rid of a bunch of nasty built-in implicit rules.
.SUFFIXES: