GNUmakefile.in 13.7 KB
Newer Older
1
#
2
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
22
#
23 24
# Testbed Makefile
#
25 26 27 28 29
SRCDIR		= @srcdir@
OBJDIR		= .
SUBDIR		= 
TESTBED_SRCDIR  = @top_srcdir@
DISTCLEAN_FILES = @DISTCLEAN_FILES@ 
30
EVENTSYS	= @EVENTSYS@
31
PELABSUPPORT	= @PELABSUPPORT@
32
PGENISUPPORT    = @PROTOGENI_SUPPORT@
33
ISMAINSITE	= @TBMAINSITE@
34 35
SYSTEM	       := $(shell uname -s)

36 37
include Makeconf

38 39 40
#
# Ordering here matters!
# Things with no dependencies go first: 
41
#   assign db lib www
42 43
# Things that may have dependencies go next:
#   @optional_subdirs@ (has event)
44
#   ipod os security sensors 
45
# Then things that only depend on stuff we've done:
46
#   pxe tbsetup tmcd utils backend www tip capture vis
47 48
# Then things that depend on stuff we just did:
#
49
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
50 51 52 53 54
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 \
55
	tools/svn wiki bugdb collab node_usage install
56 57 58
ifeq ($(ISMAINSITE),1)
SUBDIRS += tools/rmanage
endif
59
ifeq ($(PGENISUPPORT),1)
60
SUBDIRS += protogeni
61
endif
62 63 64
else
SUBDIRS = db tbsetup account protogeni
endif
Christopher Alfeld's avatar
Christopher Alfeld committed
65

66
all:		all-subdirs just-builddirs 
67

68 69 70 71 72 73 74
#
# 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

75
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
76
install:	
77 78
	@echo "Choose either boss-install, ops-install or fs-install"
	@echo "Choose opsfs-install instead of ops-install for a combined ops/fs machine"
79
	@echo "Choose tipserv-install for dedicated tip server machines."
80 81 82
else
install: clrhouse-install
endif
83 84

#
85
# For installation on boss node
86
# 
87 88
boss-install:	install-checks \
		install-subdirs install-mkdirs \
89
		install-setbuildinfo
90
	@echo "Boss node installed!"
91

92
# Same target, with the checks omitted
93
boss-install-force:	install-subdirs install-mkdirs install-setbuildinfo
94
	@echo "Boss node installed!"
95

96
# Skip only the schema checks, but do the other checks.
97 98 99 100 101 102 103 104
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 \
105 106 107
		install-genischemacheck install-subdirs install-mkdirs \
		install-setbuildinfo

108 109 110 111 112 113 114
# Only the checks:
install-checks: install-updatecheck \
		install-schemacheck \
		install-sitevarscheck \
		install-dbfillcheck install-genischemacheck
	@echo "Installation checks completed!"

115 116 117
clrhouse-install:	install-subdirs install-mkdirs
	@echo "CleaingHouse code installed!"

118
post-install:
119
	@$(MAKE) -C db post-install
Mike Hibler's avatar
Mike Hibler committed
120
	@$(MAKE) -C ipod post-install
121
	@$(MAKE) -C tbsetup post-install
122
	@$(MAKE) -C account post-install
123
	@$(MAKE) -C security post-install
124 125
	@$(MAKE) -C vis post-install
	@$(MAKE) -C www post-install
126
ifeq ($(EVENTSYS),1)
127
	@$(MAKE) -C event post-install
128
endif
129
	@$(MAKE) -C mote post-install
130
	@$(MAKE) -C tools post-install
131
	@$(MAKE) -C wiki post-install
132
	@$(MAKE) -C bugdb post-install
133
	@$(MAKE) -C collab post-install
134
	@$(MAKE) -C utils post-install
135 136 137
ifeq ($(NODE_USAGE_SUPPORT),1)
	@$(MAKE) -C node_usage post-install
endif
138

139
#
140
# For installation on the 'ops' or 'users' node (okay, plastic)
141
# 
142
ops-install:
143 144 145
	-mkdir -p $(INSTALL_TOPDIR)/log
	-mkdir -p $(INSTALL_TOPDIR)/log/mysql
	-chmod 770 $(INSTALL_TOPDIR)/log/mysql
146 147
	-chown mysql $(INSTALL_TOPDIR)/log/mysql
	-chgrp mysql $(INSTALL_TOPDIR)/log/mysql
148 149
	@$(MAKE) -C tbsetup control-install
	@$(MAKE) -C security control-install
150 151
	@$(MAKE) -C tip control-install
	@$(MAKE) -C db control-install
Mac Newbold's avatar
Mac Newbold committed
152
	@$(MAKE) -C utils control-install
153
	@$(MAKE) -C clientside control-install
154
ifeq ($(EVENTSYS),1)
155
	@$(MAKE) -C event control-install
156
endif
157
	@$(MAKE) -C xmlrpc control-install
Leigh B. Stoller's avatar
Leigh B. Stoller committed
158
	@$(MAKE) -C account control-install
159 160 161
ifeq ($(PELABSUPPORT),1)
	@$(MAKE) -C pelab control-install
endif
162

163 164
fs-install:
	@$(MAKE) -C tbsetup fs-install
Timothy Stack's avatar
 
Timothy Stack committed
165
	@$(MAKE) -C sensors fs-install
166 167 168 169

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

170 171 172
install-mkdirs:
	-mkdir -p $(INSTALL_TOPDIR)/locks
	-mkdir -p $(INSTALL_TOPDIR)/log
173
	-mkdir -p $(INSTALL_TOPDIR)/log/mysql
174 175
	-mkdir -p $(INSTALL_TOPDIR)/etc
	-mkdir -p $(INSTALL_TOPDIR)/www
176
	-mkdir -p $(INSTALL_TOPDIR)/suidbin
177 178 179 180
	-mkdir -p $(INSTALL_TOPDIR)/ssl
	-chmod 770 $(INSTALL_TOPDIR)/ssl
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
	-mkdir -p $(INSTALL_TOPDIR)/opsdir
181
	-mkdir -p $(INSTALL_TOPDIR)/log/exports
182
	-mkdir -p $(INSTALL_TOPDIR)/lists
183
	-mkdir -p $(INSTALL_TOPDIR)/backup
184
	-mkdir -p $(INSTALL_TOPDIR)/expwork
185 186
	-mkdir -p $(INSTALL_TOPDIR)/batch
	-chmod 777 $(INSTALL_TOPDIR)/batch
187 188
	-mkdir -p $(INSTALL_TOPDIR)/expinfo
	-chmod 777 $(INSTALL_TOPDIR)/expinfo
189 190
	-mkdir -p $(INSTALL_TOPDIR)/exparchive
	-chmod 777 $(INSTALL_TOPDIR)/exparchive
191 192
	-mkdir -p $(INSTALL_TOPDIR)/exparchive/Archive
	-chmod 777 $(INSTALL_TOPDIR)/exparchive/Archive
193 194
	-mkdir -p $(INSTALL_TOPDIR)/images
	-chmod 775 $(INSTALL_TOPDIR)/images
195
	-ln -sf /usr/testbed/bin/nse $(INSTALL_TOPDIR)/bin
196
endif
197

198 199 200 201
just-builddirs:
	@$(MAKE) -C rc.d all
	@$(MAKE) -C apache all

202 203
tipserv-install:
	-mkdir -p $(INSTALL_TOPDIR)/log/tiplogs
204
	-mkdir -p $(INSTALL_TOPDIR)/etc
205 206 207 208
	@$(MAKE) -C tip tipserv-install
	@$(MAKE) -C capture tipserv-install
	@$(MAKE) -C tbsetup tipserv-install

209 210
client-mkdirs:
	-mkdir -p $(DESTDIR)$(CLIENT_BINDIR)
211
	-mkdir -p $(DESTDIR)$(CLIENT_MANDIR)
212 213

client:
Leigh B Stoller's avatar
Leigh B Stoller committed
214
	@$(MAKE) -C clientside client
215
	@$(MAKE) -C os client
216
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
Timothy Stack's avatar
 
Timothy Stack committed
217 218
	@$(MAKE) -C capture client
	@$(MAKE) -C tip client
219
endif
220 221

client-install: client client-mkdirs
Leigh B Stoller's avatar
Leigh B Stoller committed
222
	@$(MAKE) -C clientside client-install
223
	@$(MAKE) -C os client-install
224
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
Timothy Stack's avatar
 
Timothy Stack committed
225 226
	@$(MAKE) -C capture client-install
	@$(MAKE) -C tip client-install
227
endif
228

229 230
subboss: 
	@$(MAKE) -C clientside subboss
231
	@$(MAKE) -C os subboss
232 233 234 235
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
	@$(MAKE) -C capture client
	@$(MAKE) -C tip client
endif
Ryan Jackson's avatar
Ryan Jackson committed
236 237
	@$(MAKE) -C utils subboss

238
subboss-install: subboss
239 240
	@$(MAKE) -C clientside subboss-install
	@$(MAKE) -C os subboss-install
241 242 243 244
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
	@$(MAKE) -C capture client-install
	@$(MAKE) -C tip client-install
endif
Ryan Jackson's avatar
Ryan Jackson committed
245
	@$(MAKE) -C utils subboss-install
246 247
	@$(MAKE) -C db subboss-install
	@$(MAKE) -C rc.d subboss-install
248
	@$(MAKE) -C dhcpd subboss-install
249 250 251
	# 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
Ryan Jackson's avatar
Ryan Jackson committed
252

253 254 255
TARBALLDESTDIR = /var/tmp/emulab-client

client-tarball:
256
	@$(MAKE) -C clientside client-tarball
257

258 259 260 261 262 263 264 265 266 267 268 269
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

270 271 272 273
destdircheck:
	@if [ -z "$(DESTDIR)" ]; then \
	    echo "You must define DESTDIR for this target!"; \
	    false; \
274 275 276 277
	fi
	@if [ "$(DESTDIR)" = "/" ]; then \
	    echo "DESTDIR is '/', really really bad idea!"; \
	    false; \
278 279
	fi

280 281
mfsoscheck:
	@if [ `uname -s` != "FreeBSD" ]; then \
Mike Hibler's avatar
Mike Hibler committed
282
	    echo "Must build CDROM/MFS files on a FreeBSD system!"; \
283 284 285 286
	    false; \
	fi

mfs: mfsoscheck
287
	@$(MAKE) -C os mfs
Leigh B Stoller's avatar
Leigh B Stoller committed
288
	@$(MAKE) -C clientside mfs
289

Mike Hibler's avatar
Mike Hibler committed
290 291
mfs-nostatic: mfsoscheck
	@NOSTATIC=1 $(MAKE) -C os mfs
Leigh B Stoller's avatar
Leigh B Stoller committed
292
	@NOSTATIC=1 $(MAKE) -C clientside mfs
Mike Hibler's avatar
Mike Hibler committed
293

294
mfs-install: destdircheck mfs client-mkdirs
295
	@$(MAKE) -C os mfs-install
Leigh B Stoller's avatar
Leigh B Stoller committed
296
	@$(MAKE) -C clientside mfs-install
297

Mike Hibler's avatar
Mike Hibler committed
298 299
mfs-nostatic-install: destdircheck mfs-nostatic client-mkdirs
	@$(MAKE) -C os mfs-install
Leigh B Stoller's avatar
Leigh B Stoller committed
300
	@$(MAKE) -C clientside mfs-install
Mike Hibler's avatar
Mike Hibler committed
301

302 303 304
frisbee-mfs: mfsoscheck
	@$(MAKE) -C cdrom/groklilo client
	@$(MAKE) -C os frisbee-mfs
Leigh B Stoller's avatar
Leigh B Stoller committed
305
	@$(MAKE) -C clientside frisbee-mfs
306

Mike Hibler's avatar
Mike Hibler committed
307 308 309
frisbee-mfs-nostatic: mfsoscheck
	@NOSTATIC=1 $(MAKE) -C cdrom/groklilo client
	@NOSTATIC=1 $(MAKE) -C os frisbee-mfs
Leigh B Stoller's avatar
Leigh B Stoller committed
310
	@NOSTATIC=1 $(MAKE) -C clientside frisbee-mfs
Mike Hibler's avatar
Mike Hibler committed
311

312 313 314
frisbee-mfs-install: destdircheck frisbee-mfs
	@CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C cdrom/groklilo client-install
	@$(MAKE) -C os frisbee-mfs-install
Leigh B Stoller's avatar
Leigh B Stoller committed
315
	@$(MAKE) -C clientside frisbee-mfs-install
316

Mike Hibler's avatar
Mike Hibler committed
317 318 319
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 B Stoller's avatar
Leigh B Stoller committed
320
	@$(MAKE) -C clientside frisbee-mfs-install
Mike Hibler's avatar
Mike Hibler committed
321

322 323 324 325 326 327 328 329 330 331 332 333
newnode-mfs: mfsoscheck
	@$(MAKE) -C clientside newnode-mfs

newnode-mfs-nostatic: mfsoscheck
	@NOSTATIC=1 $(MAKE) -C clientside newnode-mfs

newnode-mfs-install: destdircheck newnode-mfs client-mkdirs
	@$(MAKE) -C clientside newnode-mfs-install

newnode-mfs-nostatic-install: destdircheck newnode-mfs-nostatic client-mkdirs
	@$(MAKE) -C clientside newnode-mfs-install

Mike Hibler's avatar
Mike Hibler committed
334 335 336 337 338
cdboot: mfsoscheck client
	@echo "CD/Dongle files built"

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

341 342 343 344
flashboot: mfsoscheck client
	@echo "Flash dongle files built"

flashboot-install: destdircheck flashboot
Leigh B Stoller's avatar
Leigh B Stoller committed
345
	@$(MAKE) -C clientside/tmcc/freebsd6 cdboot-install
346 347
	@$(MAKE) -C os frisbee-mfs-install
	@$(MAKE) -C flash client-install
Leigh B Stoller's avatar
Leigh B Stoller committed
348
	@$(MAKE) -C clientside frisbee-mfs-install
349

350 351 352 353
#
# 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
#
354 355 356 357 358
ifeq ($(TBROOT),/usr/testbed)
UPDATETESTBED= @cd $(OBJDIR)/install && perl update-testbed
else
UPDATETESTBED= @echo "Skipping update check, since prefix isn't /usr/testbed"
endif
359 360 361 362 363 364 365
ifeq ($(ISMAINSITE),1)
update-testbed: update-testbed-nostop
else
update-testbed:	update-testbed-install
endif

update-testbed-install:
366 367 368
	@echo "Updating the testbed ..."
	$(UPDATETESTBED) -i -s

369 370 371 372 373 374 375 376
update-testbed-noinstall:
	@echo "Updating the testbed ..."
	$(UPDATETESTBED)

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

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

390
ifeq ($(TBROOT),/usr/testbed)
391
SCHEMACHECK= cd $(OBJDIR)/db && perl schemacheck
392 393 394 395 396 397 398
else
SCHEMACHECK= @echo "Skipping schema check, since prefix isn't /usr/testbed"
endif
install-schemacheck:
	@echo "Checking DB schema..."
	$(SCHEMACHECK)

Chad Barb's avatar
 
Chad Barb committed
399 400 401 402 403 404 405 406 407
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)

408 409 410 411 412 413 414 415 416
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)

417 418 419 420 421 422 423 424 425
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)

426
install-genischemacheck:
427
ifeq ($(PGENISUPPORT),1)
428
	@$(MAKE) -C protogeni install-genischemacheck
429
endif
Leigh B. Stoller's avatar
Leigh B. Stoller committed
430
	@echo "Done"
431

432 433 434
# 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.
435 436
clean:		clean-subdirs
distclean:	distclean-subdirs
Mike Hibler's avatar
Mike Hibler committed
437
	rm -f Makeconf GNUmakefile config.h config.status config.cache config.log
438
	rm -f $(DISTCLEAN_FILES)
439 440 441 442 443 444 445 446 447 448 449 450 451 452 453

#
# Be careful, do not run these unless you are updating your installation
# with a new IP subnet or domain name. 
#
boss-updateip-clean:	clean
	@$(MAKE) -C rc.d clean
	@$(MAKE) -C apache clean
	@$(MAKE) -C named clean
	@$(MAKE) -C dhcpd clean

ops-updateip-clean:	clean
	@$(MAKE) -C rc.d clean
	@$(MAKE) -C apache clean

454 455 456 457
#
# 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:
458
	find $SRCDIR -name '*.in' -a -not -name configure.in | \
459
	    sed -e "s;$SRCDIR;$OBJDIR;" -e 's;[.]in$;;' | xargs rm -f
460

461 462 463
elabinelab:
	-mkdir -p $(INSTALL_TOPDIR)/src
	rm -f $(INSTALL_TOPDIR)/src/emulab-src.tar.gz
464
	tar czf $(INSTALL_TOPDIR)/src/emulab-src.tar.gz -C $(SRCDIR) --exclude=.git .
465

466 467 468 469 470
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

471 472 473 474 475
# How to recursively descend into subdirectories to make general
# targets such as `all'.
%.MAKE:
	@$(MAKE) -C $(dir $@) $(basename $(notdir $@))
%-subdirs: $(addsuffix /%.MAKE,$(SUBDIRS)) ;
476

477 478
# By default, make any target by descending into subdirectories.
%: %-subdirs ;
479

480 481
.PHONY: post-install install-mkdirs clrhouse-install install \
	boss-install-noupdatecheck boss-install-noschemacheck \
482 483
	boss-install-force update-testbed update-testbed-install \
	update-testbed-noinstall update-testbed-nostop
484 485 486

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