GNUmakefile.in 12.6 KB
Newer Older
1
#
2
# EMULAB-COPYRIGHT
Leigh Stoller's avatar
Leigh Stoller committed
3
# Copyright (c) 2000-2011 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
PGENISUPPORT    = @PROTOGENI_SUPPORT@
16
ISMAINSITE	= @TBMAINSITE@
17 18
SYSTEM	       := $(shell uname -s)

19 20
include Makeconf

21 22 23
#
# Ordering here matters!
# Things with no dependencies go first: 
24
#   assign db lib www
25 26
# Things that may have dependencies go next:
#   @optional_subdirs@ (has event)
27
#   ipod os security sensors 
28
# Then things that only depend on stuff we've done:
29
#   pxe tbsetup tmcd utils backend www tip capture vis
30 31
# Then things that depend on stuff we just did:
#
32
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
33 34 35 36 37
SUBDIRS = \
	clientside/lib \
	db assign www @optional_subdirs@ clientside ipod security sensors \
	pxe tbsetup account tmcd utils backend tip capture ipod vis \
	sensors os xmlrpc install/newnode_sshkeys mote tools/whol \
38
	tools/svn wiki bugdb collab node_usage install
39 40 41
ifeq ($(ISMAINSITE),1)
SUBDIRS += tools/rmanage
endif
42 43 44
ifeq ($(PGENISUPPORT),1)
SUBDIRS = protogeni
endif
45 46 47
else
SUBDIRS = db tbsetup account protogeni
endif
48

49
all:		all-subdirs just-builddirs 
50

51 52 53 54 55 56 57
#
# We used to statically link our event agents.  We no longer do this, but
# if you want "old style" agents, use this target.
#
all-static:
	@LDSTATIC=-static $(MAKE) all

58
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
59
install:	
60 61
	@echo "Choose either boss-install, ops-install or fs-install"
	@echo "Choose opsfs-install instead of ops-install for a combined ops/fs machine"
62
	@echo "Choose tipserv-install for dedicated tip server machines."
63 64 65
else
install: clrhouse-install
endif
66 67

#
68
# For installation on boss node
69
# 
70 71
boss-install:	install-checks \
		install-subdirs install-mkdirs \
72
		install-setbuildinfo
73
	@echo "Boss node installed!"
74

75
# Same target, with the checks omitted
76
boss-install-force:	install-subdirs install-mkdirs install-setbuildinfo
77
	@echo "Boss node installed!"
78

79
# Skip only the schema checks, but do the other checks.
80 81 82 83 84 85 86 87
boss-install-noschemacheck: install-updatecheck \
		install-sitevarscheck install-dbfillcheck \
		install-genischemacheck install-subdirs install-mkdirs \
		install-setbuildinfo

# Skip the update check. 
boss-install-noupdatecheck: install-schemacheck \
		install-sitevarscheck install-dbfillcheck \
88 89 90
		install-genischemacheck install-subdirs install-mkdirs \
		install-setbuildinfo

91 92 93 94 95 96 97
# Only the checks:
install-checks: install-updatecheck \
		install-schemacheck \
		install-sitevarscheck \
		install-dbfillcheck install-genischemacheck
	@echo "Installation checks completed!"

98 99 100
clrhouse-install:	install-subdirs install-mkdirs
	@echo "CleaingHouse code installed!"

101
post-install:
102
	@$(MAKE) -C db post-install
103
	@$(MAKE) -C ipod post-install
104
	@$(MAKE) -C tbsetup post-install
105
	@$(MAKE) -C account post-install
106
	@$(MAKE) -C security post-install
107 108
	@$(MAKE) -C vis post-install
	@$(MAKE) -C www post-install
109
ifeq ($(EVENTSYS),1)
110
	@$(MAKE) -C event post-install
111
endif
112
	@$(MAKE) -C mote post-install
113
	@$(MAKE) -C tools post-install
114
	@$(MAKE) -C wiki post-install
115
	@$(MAKE) -C bugdb post-install
116
	@$(MAKE) -C collab post-install
117
	@$(MAKE) -C utils post-install
118 119 120
ifeq ($(NODE_USAGE_SUPPORT),1)
	@$(MAKE) -C node_usage post-install
endif
121

122
#
123
# For installation on the 'ops' or 'users' node (okay, plastic)
124
# 
125
ops-install:
126 127 128
	-mkdir -p $(INSTALL_TOPDIR)/log
	-mkdir -p $(INSTALL_TOPDIR)/log/mysql
	-chmod 770 $(INSTALL_TOPDIR)/log/mysql
129 130
	-chown mysql $(INSTALL_TOPDIR)/log/mysql
	-chgrp mysql $(INSTALL_TOPDIR)/log/mysql
131 132
	@$(MAKE) -C tbsetup control-install
	@$(MAKE) -C security control-install
133 134
	@$(MAKE) -C tip control-install
	@$(MAKE) -C db control-install
135
	@$(MAKE) -C utils control-install
136
	@$(MAKE) -C clientside control-install
137
ifeq ($(EVENTSYS),1)
138
	@$(MAKE) -C event control-install
139
endif
140
	@$(MAKE) -C xmlrpc control-install
Leigh Stoller's avatar
Leigh Stoller committed
141
	@$(MAKE) -C account control-install
142 143 144
ifeq ($(PELABSUPPORT),1)
	@$(MAKE) -C pelab control-install
endif
145

146 147
fs-install:
	@$(MAKE) -C tbsetup fs-install
148
	@$(MAKE) -C sensors fs-install
149 150 151 152

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

153 154 155
install-mkdirs:
	-mkdir -p $(INSTALL_TOPDIR)/locks
	-mkdir -p $(INSTALL_TOPDIR)/log
156
	-mkdir -p $(INSTALL_TOPDIR)/log/mysql
157 158 159 160 161 162
	-mkdir -p $(INSTALL_TOPDIR)/etc
	-mkdir -p $(INSTALL_TOPDIR)/www
	-mkdir -p $(INSTALL_TOPDIR)/ssl
	-chmod 770 $(INSTALL_TOPDIR)/ssl
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
	-mkdir -p $(INSTALL_TOPDIR)/opsdir
163
	-mkdir -p $(INSTALL_TOPDIR)/log/exports
164
	-mkdir -p $(INSTALL_TOPDIR)/lists
165
	-mkdir -p $(INSTALL_TOPDIR)/backup
166
	-mkdir -p $(INSTALL_TOPDIR)/expwork
167 168
	-mkdir -p $(INSTALL_TOPDIR)/batch
	-chmod 777 $(INSTALL_TOPDIR)/batch
169 170
	-mkdir -p $(INSTALL_TOPDIR)/expinfo
	-chmod 777 $(INSTALL_TOPDIR)/expinfo
171 172
	-mkdir -p $(INSTALL_TOPDIR)/exparchive
	-chmod 777 $(INSTALL_TOPDIR)/exparchive
173 174
	-mkdir -p $(INSTALL_TOPDIR)/exparchive/Archive
	-chmod 777 $(INSTALL_TOPDIR)/exparchive/Archive
175 176
	-mkdir -p $(INSTALL_TOPDIR)/images
	-chmod 775 $(INSTALL_TOPDIR)/images
177
	-ln -s /usr/testbed/bin/nse $(INSTALL_TOPDIR)/bin
178
endif
179

180 181 182 183
just-builddirs:
	@$(MAKE) -C rc.d all
	@$(MAKE) -C apache all

184 185
tipserv-install:
	-mkdir -p $(INSTALL_TOPDIR)/log/tiplogs
186
	-mkdir -p $(INSTALL_TOPDIR)/etc
187 188 189 190
	@$(MAKE) -C tip tipserv-install
	@$(MAKE) -C capture tipserv-install
	@$(MAKE) -C tbsetup tipserv-install

191 192
client-mkdirs:
	-mkdir -p $(DESTDIR)$(CLIENT_BINDIR)
193
	-mkdir -p $(DESTDIR)$(CLIENT_MANDIR)
194 195

client:
Leigh Stoller's avatar
Leigh Stoller committed
196
	@$(MAKE) -C clientside client
197
	@$(MAKE) -C os client
198
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
199 200
	@$(MAKE) -C capture client
	@$(MAKE) -C tip client
201
endif
202 203

client-install: client client-mkdirs
Leigh Stoller's avatar
Leigh Stoller committed
204
	@$(MAKE) -C clientside client-install
205
	@$(MAKE) -C os client-install
206
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
207 208
	@$(MAKE) -C capture client-install
	@$(MAKE) -C tip client-install
209
endif
210

211
subboss: client
212
	@$(MAKE) -C os subboss
213 214
	@$(MAKE) -C utils subboss

215
subboss-install: subboss
Leigh Stoller's avatar
Leigh Stoller committed
216
	@$(MAKE) -C clientside client-install
217 218 219 220
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
	@$(MAKE) -C capture client-install
	@$(MAKE) -C tip client-install
endif
221
	@$(MAKE) -C utils subboss-install
222
	@$(MAKE) -C os subboss-install
223
	@$(MAKE) -C db subboss-install
Leigh Stoller's avatar
Leigh Stoller committed
224
	@$(MAKE) -C clientside/tmcc subboss-install
225
	@$(MAKE) -C rc.d subboss-install
226
	@$(MAKE) -C dhcpd subboss-install
227 228 229
	# Hack: this should probably be done by a subboss-install
	# script, but there isn't a huge need for that yet
	@rm -f $(INSTALL_RCDIR)/isc-dhcpd
230

231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
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) .

248 249 250 251 252 253 254 255 256 257 258 259
client-src-tarball:
	@rm -f emulab-client-src.tar.gz
	tar clzf emulab-client-src.tar.gz -C clientside

# This is not finished yet.
client-shadow-rpm:
	-$(RM) -rf rpmbuild
	$(MKDIR_P) rpmbuild/SOURCES rpmbuild/SRPMS
	$(CP) emulab-client-src.tar.gz rpmbuild/SOURCES
	$(RPM) -v -bs --nodeps --define='_topdir $(TOPDIR)/rpmbuild' \
		clientside/shadow.spec

260 261 262 263
destdircheck:
	@if [ -z "$(DESTDIR)" ]; then \
	    echo "You must define DESTDIR for this target!"; \
	    false; \
264 265 266 267
	fi
	@if [ "$(DESTDIR)" = "/" ]; then \
	    echo "DESTDIR is '/', really really bad idea!"; \
	    false; \
268 269
	fi

270 271
mfsoscheck:
	@if [ `uname -s` != "FreeBSD" ]; then \
Mike Hibler's avatar
Mike Hibler committed
272
	    echo "Must build CDROM/MFS files on a FreeBSD system!"; \
273 274 275 276
	    false; \
	fi

mfs: mfsoscheck
277
	@$(MAKE) -C os mfs
Leigh Stoller's avatar
Leigh Stoller committed
278
	@$(MAKE) -C clientside mfs
279

Mike Hibler's avatar
Mike Hibler committed
280 281
mfs-nostatic: mfsoscheck
	@NOSTATIC=1 $(MAKE) -C os mfs
Leigh Stoller's avatar
Leigh Stoller committed
282
	@NOSTATIC=1 $(MAKE) -C clientside mfs
Mike Hibler's avatar
Mike Hibler committed
283

284
mfs-install: destdircheck mfs client-mkdirs
285
	@$(MAKE) -C os mfs-install
Leigh Stoller's avatar
Leigh Stoller committed
286
	@$(MAKE) -C clientside mfs-install
287

Mike Hibler's avatar
Mike Hibler committed
288 289
mfs-nostatic-install: destdircheck mfs-nostatic client-mkdirs
	@$(MAKE) -C os mfs-install
Leigh Stoller's avatar
Leigh Stoller committed
290
	@$(MAKE) -C clientside mfs-install
Mike Hibler's avatar
Mike Hibler committed
291

292 293 294
frisbee-mfs: mfsoscheck
	@$(MAKE) -C cdrom/groklilo client
	@$(MAKE) -C os frisbee-mfs
Leigh Stoller's avatar
Leigh Stoller committed
295
	@$(MAKE) -C clientside frisbee-mfs
296

Mike Hibler's avatar
Mike Hibler committed
297 298 299
frisbee-mfs-nostatic: mfsoscheck
	@NOSTATIC=1 $(MAKE) -C cdrom/groklilo client
	@NOSTATIC=1 $(MAKE) -C os frisbee-mfs
Leigh Stoller's avatar
Leigh Stoller committed
300
	@NOSTATIC=1 $(MAKE) -C clientside frisbee-mfs
Mike Hibler's avatar
Mike Hibler committed
301

302 303 304
frisbee-mfs-install: destdircheck frisbee-mfs
	@CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C cdrom/groklilo client-install
	@$(MAKE) -C os frisbee-mfs-install
Leigh Stoller's avatar
Leigh Stoller committed
305
	@$(MAKE) -C clientside frisbee-mfs-install
306

Mike Hibler's avatar
Mike Hibler committed
307 308 309
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
Leigh Stoller's avatar
Leigh Stoller committed
310
	@$(MAKE) -C clientside frisbee-mfs-install
Mike Hibler's avatar
Mike Hibler committed
311

Mike Hibler's avatar
Mike Hibler committed
312 313 314 315 316
cdboot: mfsoscheck client
	@echo "CD/Dongle files built"

cdboot-install: destdircheck cdboot
	@$(MAKE) -C cdrom client-install
Leigh Stoller's avatar
Leigh Stoller committed
317
	@$(MAKE) -C clientside/tmcc/freebsd6 cdboot-install
Mike Hibler's avatar
Mike Hibler committed
318

319 320 321 322
flashboot: mfsoscheck client
	@echo "Flash dongle files built"

flashboot-install: destdircheck flashboot
Leigh Stoller's avatar
Leigh Stoller committed
323
	@$(MAKE) -C clientside/tmcc/freebsd6 cdboot-install
324 325
	@$(MAKE) -C os frisbee-mfs-install
	@$(MAKE) -C flash client-install
Leigh Stoller's avatar
Leigh Stoller committed
326
	@$(MAKE) -C clientside frisbee-mfs-install
327

328 329 330 331
#
# 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
#
332 333 334 335 336
ifeq ($(TBROOT),/usr/testbed)
UPDATETESTBED= @cd $(OBJDIR)/install && perl update-testbed
else
UPDATETESTBED= @echo "Skipping update check, since prefix isn't /usr/testbed"
endif
337 338 339 340 341 342 343
ifeq ($(ISMAINSITE),1)
update-testbed: update-testbed-nostop
else
update-testbed:	update-testbed-install
endif

update-testbed-install:
344 345 346
	@echo "Updating the testbed ..."
	$(UPDATETESTBED) -i -s

347 348 349 350 351 352 353 354
update-testbed-noinstall:
	@echo "Updating the testbed ..."
	$(UPDATETESTBED)

update-testbed-nostop:
	@echo "Updating the testbed ..."
	$(UPDATETESTBED) -i

355 356 357 358 359 360 361 362 363 364 365 366 367
update-testbed-force:
	@echo "Updating the testbed in force mode ..."
	$(UPDATETESTBED) -f

ifeq ($(TBROOT),/usr/testbed)
UPDATECHECK= @cd $(OBJDIR)/install && perl update-testbed -v
else
UPDATECHECK= @echo "Skipping update checks, since prefix isn't /usr/testbed"
endif
install-updatecheck:
	@echo "Checking to see if updates need to be run"
	$(UPDATECHECK)

368
ifeq ($(TBROOT),/usr/testbed)
369
SCHEMACHECK= cd $(OBJDIR)/db && perl schemacheck
370 371 372 373 374 375 376
else
SCHEMACHECK= @echo "Skipping schema check, since prefix isn't /usr/testbed"
endif
install-schemacheck:
	@echo "Checking DB schema..."
	$(SCHEMACHECK)

377 378 379 380 381 382 383 384 385
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)

386 387 388 389 390 391 392 393 394
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)

395 396 397 398 399 400 401 402 403
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)

404
install-genischemacheck:
405
ifeq ($(PGENISUPPORT),1)
406
	@$(MAKE) -C protogeni install-genischemacheck
407
endif
Leigh Stoller's avatar
Leigh Stoller committed
408
	@echo "Done"
409

410 411 412
# We use separate src and obj trees in Emulab, so the traditional distclean to
# clean "made" files from a mingled source-and-obj tree is unnecessary.
# However, this may be useful if you mistakenly configure and make a src tree.
413 414
clean:		clean-subdirs
distclean:	distclean-subdirs
Mike Hibler's avatar
Mike Hibler committed
415
	rm -f Makeconf GNUmakefile config.h config.status config.cache config.log
416
	rm -f $(DISTCLEAN_FILES)
417 418 419 420
#
# Here's a different approch to recover from just configure problems.  It cleans
# all files from an obj tree that have a corresponding .in file in the src tree.
undo-configure:
421
	find $SRCDIR -name '*.in' -a -not -name configure.in | \
422
	    sed -e "s;$SRCDIR;$OBJDIR;" -e 's;[.]in$;;' | xargs rm -f
423

424 425 426
elabinelab:
	-mkdir -p $(INSTALL_TOPDIR)/src
	rm -f $(INSTALL_TOPDIR)/src/emulab-src.tar.gz
427
	tar czf $(INSTALL_TOPDIR)/src/emulab-src.tar.gz -C $(SRCDIR) --exclude=.git .
428

429 430 431 432 433
elabinelab-git:
	-mkdir -p $(INSTALL_TOPDIR)/src
	rm -f $(INSTALL_TOPDIR)/src/emulab-src.tar.gz
	git archive --prefix=testbed/ | gzip -c > $(INSTALL_TOPDIR)/src/emulab-src.tar.gz

434 435 436 437 438
# How to recursively descend into subdirectories to make general
# targets such as `all'.
%.MAKE:
	@$(MAKE) -C $(dir $@) $(basename $(notdir $@))
%-subdirs: $(addsuffix /%.MAKE,$(SUBDIRS)) ;
439

440 441
# By default, make any target by descending into subdirectories.
%: %-subdirs ;
442

443 444
.PHONY: post-install install-mkdirs clrhouse-install install \
	boss-install-noupdatecheck boss-install-noschemacheck \
445 446
	boss-install-force update-testbed update-testbed-install \
	update-testbed-noinstall update-testbed-nostop
447 448 449

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