GNUmakefile.in 10.1 KB
Newer Older
1
#
2
# EMULAB-COPYRIGHT
3
# Copyright (c) 2000-2009 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 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
# Then things that only depend on stuff we've done:
28
#   pxe tbsetup tmcd utils backend www tip capture vis
29 30
# Then things that depend on stuff we just did:
#
31
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
32
SUBDIRS = lib db assign www @optional_subdirs@ ipod security sensors \
33
		pxe tbsetup account tmcd utils backend tip capture ipod vis \
34
		sensors os xmlrpc install/newnode_sshkeys mote tools/whol \
35
		tools/svn wiki bugdb collab tools/rmanage protogeni node_usage
36 37 38
else
SUBDIRS = db tbsetup account protogeni
endif
Christopher Alfeld's avatar
Christopher Alfeld committed
39

40
all:		all-subdirs 
41

42 43 44 45 46 47 48
#
# 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

49
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
50
install:	
51 52
	@echo "Choose either boss-install, ops-install or fs-install"
	@echo "Choose opsfs-install instead of ops-install for a combined ops/fs machine"
53
	@echo "Choose tipserv-install for dedicated tip server machines."
54 55 56
else
install: clrhouse-install
endif
57 58

#
59
# For installation on boss node
60
# 
61
boss-install:	install-schemacheck install-sitevarscheck install-dbfillcheck \
62 63
		install-genischemacheck install-subdirs install-mkdirs \
		install-setbuildinfo
64
	@echo "Boss node installed!"
65 66 67 68

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

72 73 74
clrhouse-install:	install-subdirs install-mkdirs
	@echo "CleaingHouse code installed!"

75
post-install:
76
	@$(MAKE) -C db post-install
Mike Hibler's avatar
Mike Hibler committed
77
	@$(MAKE) -C ipod post-install
78
	@$(MAKE) -C tbsetup post-install
79
	@$(MAKE) -C account post-install
80
	@$(MAKE) -C security post-install
81 82
	@$(MAKE) -C vis post-install
	@$(MAKE) -C www post-install
83
ifeq ($(EVENTSYS),1)
84
	@$(MAKE) -C event post-install
85
endif
86
	@$(MAKE) -C mote post-install
87
	@$(MAKE) -C tools post-install
88
	@$(MAKE) -C wiki post-install
89
	@$(MAKE) -C bugdb post-install
90
	@$(MAKE) -C collab post-install
91
	@$(MAKE) -C utils post-install
92 93 94
ifeq ($(NODE_USAGE_SUPPORT),1)
	@$(MAKE) -C node_usage post-install
endif
95

96
#
97
# For installation on the 'ops' or 'users' node (okay, plastic)
98
# 
99
ops-install:
100 101 102
	-mkdir -p $(INSTALL_TOPDIR)/log
	-mkdir -p $(INSTALL_TOPDIR)/log/mysql
	-chmod 770 $(INSTALL_TOPDIR)/log/mysql
103 104
	-chown mysql $(INSTALL_TOPDIR)/log/mysql
	-chgrp mysql $(INSTALL_TOPDIR)/log/mysql
105 106
	@$(MAKE) -C tbsetup control-install
	@$(MAKE) -C security control-install
107
	@$(MAKE) -C tip control-install
Leigh B. Stoller's avatar
Leigh B. Stoller committed
108
#	@$(MAKE) -C os control-install
109 110
	@$(MAKE) -C db control-install
	@$(MAKE) -C tbsetup control-install
Mac Newbold's avatar
Mac Newbold committed
111
	@$(MAKE) -C utils control-install
112
	@$(MAKE) -C lib control-install
113
ifeq ($(EVENTSYS),1)
114
	@$(MAKE) -C event control-install
115
endif
116
	@$(MAKE) -C sensors control-install
117
	@$(MAKE) -C xmlrpc control-install
118
	@$(MAKE) -C tmcd control-install
Leigh B. Stoller's avatar
Leigh B. Stoller committed
119
	@$(MAKE) -C account control-install
120 121 122
ifeq ($(PELABSUPPORT),1)
	@$(MAKE) -C pelab control-install
endif
123

124 125
fs-install:
	@$(MAKE) -C tbsetup fs-install
Timothy Stack's avatar
 
Timothy Stack committed
126
	@$(MAKE) -C sensors fs-install
127 128 129 130

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

131 132 133
install-mkdirs:
	-mkdir -p $(INSTALL_TOPDIR)/locks
	-mkdir -p $(INSTALL_TOPDIR)/log
134
	-mkdir -p $(INSTALL_TOPDIR)/log/mysql
135 136 137 138 139 140
	-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
141
	-mkdir -p $(INSTALL_TOPDIR)/log/exports
142
	-mkdir -p $(INSTALL_TOPDIR)/lists
143
	-mkdir -p $(INSTALL_TOPDIR)/backup
144
	-mkdir -p $(INSTALL_TOPDIR)/expwork
145 146
	-mkdir -p $(INSTALL_TOPDIR)/batch
	-chmod 777 $(INSTALL_TOPDIR)/batch
147 148
	-mkdir -p $(INSTALL_TOPDIR)/expinfo
	-chmod 777 $(INSTALL_TOPDIR)/expinfo
149 150
	-mkdir -p $(INSTALL_TOPDIR)/exparchive
	-chmod 777 $(INSTALL_TOPDIR)/exparchive
151 152
	-mkdir -p $(INSTALL_TOPDIR)/exparchive/Archive
	-chmod 777 $(INSTALL_TOPDIR)/exparchive/Archive
153 154
	-mkdir -p $(INSTALL_TOPDIR)/images
	-chmod 775 $(INSTALL_TOPDIR)/images
155
	-ln -s /usr/testbed/bin/nse $(INSTALL_TOPDIR)/bin
156
endif
157

158 159
tipserv-install:
	-mkdir -p $(INSTALL_TOPDIR)/log/tiplogs
160
	-mkdir -p $(INSTALL_TOPDIR)/etc
161 162 163 164
	@$(MAKE) -C tip tipserv-install
	@$(MAKE) -C capture tipserv-install
	@$(MAKE) -C tbsetup tipserv-install

165 166
client-mkdirs:
	-mkdir -p $(DESTDIR)$(CLIENT_BINDIR)
167
	-mkdir -p $(DESTDIR)$(CLIENT_MANDIR)
168 169

client:
170
	@$(MAKE) -C lib/libtb client
171
ifeq ($(EVENTSYS),1)
172
	@$(MAKE) -C event client
173
endif
174
	@$(MAKE) -C os client
175
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
Timothy Stack's avatar
 
Timothy Stack committed
176 177
	@$(MAKE) -C capture client
	@$(MAKE) -C tip client
178
	@$(MAKE) -C tools client
179
endif
180 181 182 183
	@$(MAKE) -C sensors client
	@$(MAKE) -C tmcd client

client-install: client client-mkdirs
184
ifeq ($(EVENTSYS),1)
185
	@$(MAKE) -C event client-install
186
endif
187
	@$(MAKE) -C os client-install
188
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
Timothy Stack's avatar
 
Timothy Stack committed
189 190
	@$(MAKE) -C capture client-install
	@$(MAKE) -C tip client-install
191
	@$(MAKE) -C tools client-install
192
endif
193
	@$(MAKE) -C sensors client-install
194 195
	@$(MAKE) -C tmcd client-install

196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
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) .

213 214 215 216
destdircheck:
	@if [ -z "$(DESTDIR)" ]; then \
	    echo "You must define DESTDIR for this target!"; \
	    false; \
217 218 219 220
	fi
	@if [ "$(DESTDIR)" = "/" ]; then \
	    echo "DESTDIR is '/', really really bad idea!"; \
	    false; \
221 222
	fi

223 224
mfsoscheck:
	@if [ `uname -s` != "FreeBSD" ]; then \
Mike Hibler's avatar
Mike Hibler committed
225
	    echo "Must build CDROM/MFS files on a FreeBSD system!"; \
226 227 228 229
	    false; \
	fi

mfs: mfsoscheck
230 231 232 233
	@$(MAKE) -C os mfs
	@$(MAKE) -C sensors mfs
	@$(MAKE) -C tmcd mfs

Mike Hibler's avatar
Mike Hibler committed
234 235 236 237 238
mfs-nostatic: mfsoscheck
	@NOSTATIC=1 $(MAKE) -C os mfs
	@NOSTATIC=1 $(MAKE) -C sensors mfs
	@NOSTATIC=1 $(MAKE) -C tmcd mfs

239
mfs-install: destdircheck mfs client-mkdirs
240 241 242 243
	@$(MAKE) -C os mfs-install
	@$(MAKE) -C sensors mfs-install
	@$(MAKE) -C tmcd mfs-install

Mike Hibler's avatar
Mike Hibler committed
244 245 246 247 248
mfs-nostatic-install: destdircheck mfs-nostatic client-mkdirs
	@$(MAKE) -C os mfs-install
	@$(MAKE) -C sensors mfs-install
	@$(MAKE) -C tmcd mfs-install

249 250 251 252 253
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
254 255 256 257 258
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

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

Mike Hibler's avatar
Mike Hibler committed
269 270 271 272 273 274 275
cdboot: mfsoscheck client
	@echo "CD/Dongle files built"

cdboot-install: destdircheck cdboot
	@$(MAKE) -C cdrom client-install
	@$(MAKE) -C tmcd/freebsd6 cdboot-install

276 277 278 279 280 281 282 283
flashboot: mfsoscheck client
	@echo "Flash dongle files built"

flashboot-install: destdircheck flashboot
	@$(MAKE) -C tmcd/freebsd6 cdboot-install
	@$(MAKE) -C os frisbee-mfs-install
	@$(MAKE) -C flash client-install

284 285 286 287 288
#
# 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)
289
SCHEMACHECK= cd $(OBJDIR)/db && perl schemacheck
290 291 292 293 294 295 296
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
297 298 299 300 301 302 303 304 305
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)

306 307 308 309 310 311 312 313 314
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)

315 316 317 318 319 320 321 322 323
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)

324
install-genischemacheck:
325
ifeq ($(PGENISUPPORT),1)
326
	@$(MAKE) -C protogeni install-genischemacheck
327
endif
328

329 330 331
# 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.
332 333
clean:		clean-subdirs
distclean:	distclean-subdirs
Mike Hibler's avatar
Mike Hibler committed
334
	rm -f Makeconf GNUmakefile config.h config.status config.cache config.log
335
	rm -f $(DISTCLEAN_FILES)
336 337 338 339
#
# 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:
340
	find $SRCDIR -name '*.in' -a -not -name configure.in | \
341
	    sed -e "s;$SRCDIR;$OBJDIR;" -e 's;[.]in$;;' | xargs rm -f
342

343 344 345 346 347
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) .

348 349 350 351 352
# How to recursively descend into subdirectories to make general
# targets such as `all'.
%.MAKE:
	@$(MAKE) -C $(dir $@) $(basename $(notdir $@))
%-subdirs: $(addsuffix /%.MAKE,$(SUBDIRS)) ;
353

354 355
# By default, make any target by descending into subdirectories.
%: %-subdirs ;
356

357
.PHONY: post-install install-mkdirs clrhouse-install install
358 359 360

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