GNUmakefile.in 9.61 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

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
SUBDIRS = lib db assign www @optional_subdirs@ ipod security sensors \
32
		pxe tbsetup account tmcd utils backend tip capture ipod vis \
33
		sensors os xmlrpc install/newnode_sshkeys mote tools/whol \
34
		tools/svn wiki bugdb collab tools/rmanage protogeni node_usage
35

36
all:		all-subdirs 
37

38 39 40 41 42 43 44
#
# 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

45
install:	
46 47
	@echo "Choose either boss-install, ops-install or fs-install"
	@echo "Choose opsfs-install instead of ops-install for a combined ops/fs machine"
48
	@echo "Choose tipserv-install for dedicated tip server machines."
49 50

#
51
# For installation on boss node
52
# 
53
boss-install:	install-schemacheck install-sitevarscheck install-dbfillcheck \
54
		install-subdirs install-mkdirs install-setbuildinfo
55
	@echo "Boss node installed!"
56 57 58 59

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

63
post-install:
64
	@$(MAKE) -C db post-install
65
	@$(MAKE) -C ipod post-install
66
	@$(MAKE) -C tbsetup post-install
67
	@$(MAKE) -C account post-install
68
	@$(MAKE) -C security post-install
69 70
	@$(MAKE) -C vis post-install
	@$(MAKE) -C www post-install
71
ifeq ($(EVENTSYS),1)
72
	@$(MAKE) -C event post-install
73
endif
74
	@$(MAKE) -C mote post-install
75
	@$(MAKE) -C tools post-install
76
	@$(MAKE) -C wiki post-install
77
	@$(MAKE) -C bugdb post-install
78
	@$(MAKE) -C collab post-install
79
	@$(MAKE) -C utils post-install
80 81 82
ifeq ($(NODE_USAGE_SUPPORT),1)
	@$(MAKE) -C node_usage post-install
endif
83

84
#
85
# For installation on the 'ops' or 'users' node (okay, plastic)
86
# 
87
ops-install:
88 89 90
	-mkdir -p $(INSTALL_TOPDIR)/log
	-mkdir -p $(INSTALL_TOPDIR)/log/mysql
	-chmod 770 $(INSTALL_TOPDIR)/log/mysql
91 92
	-chown mysql $(INSTALL_TOPDIR)/log/mysql
	-chgrp mysql $(INSTALL_TOPDIR)/log/mysql
93 94
	@$(MAKE) -C tbsetup control-install
	@$(MAKE) -C security control-install
95
	@$(MAKE) -C tip control-install
Leigh Stoller's avatar
Leigh Stoller committed
96
#	@$(MAKE) -C os control-install
97 98
	@$(MAKE) -C db control-install
	@$(MAKE) -C tbsetup control-install
99
	@$(MAKE) -C utils control-install
100
	@$(MAKE) -C lib control-install
101
ifeq ($(EVENTSYS),1)
102
	@$(MAKE) -C event control-install
103
endif
104
	@$(MAKE) -C sensors control-install
105
	@$(MAKE) -C xmlrpc control-install
106
	@$(MAKE) -C tmcd control-install
Leigh Stoller's avatar
Leigh Stoller committed
107
	@$(MAKE) -C account control-install
108 109 110
ifeq ($(PELABSUPPORT),1)
	@$(MAKE) -C pelab control-install
endif
111

112 113
fs-install:
	@$(MAKE) -C tbsetup fs-install
114
	@$(MAKE) -C sensors fs-install
115 116 117 118

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

119
install-mkdirs:
120
	-mkdir -p $(INSTALL_TOPDIR)/opsdir
121 122
	-mkdir -p $(INSTALL_TOPDIR)/locks
	-mkdir -p $(INSTALL_TOPDIR)/log
123 124
	-mkdir -p $(INSTALL_TOPDIR)/log/mysql
	-mkdir -p $(INSTALL_TOPDIR)/log/exports
125
	-mkdir -p $(INSTALL_TOPDIR)/lists
126
	-mkdir -p $(INSTALL_TOPDIR)/backup
127
	-mkdir -p $(INSTALL_TOPDIR)/etc
128
	-mkdir -p $(INSTALL_TOPDIR)/expwork
129 130
	-mkdir -p $(INSTALL_TOPDIR)/batch
	-chmod 777 $(INSTALL_TOPDIR)/batch
131 132
	-mkdir -p $(INSTALL_TOPDIR)/expinfo
	-chmod 777 $(INSTALL_TOPDIR)/expinfo
133 134
	-mkdir -p $(INSTALL_TOPDIR)/exparchive
	-chmod 777 $(INSTALL_TOPDIR)/exparchive
135 136
	-mkdir -p $(INSTALL_TOPDIR)/exparchive/Archive
	-chmod 777 $(INSTALL_TOPDIR)/exparchive/Archive
137 138
	-mkdir -p $(INSTALL_TOPDIR)/images
	-chmod 775 $(INSTALL_TOPDIR)/images
139
	-ln -s /usr/testbed/bin/nse $(INSTALL_TOPDIR)/bin
140 141
	-mkdir -p $(INSTALL_TOPDIR)/ssl
	-chmod 770 $(INSTALL_TOPDIR)/ssl
142

143 144
tipserv-install:
	-mkdir -p $(INSTALL_TOPDIR)/log/tiplogs
145
	-mkdir -p $(INSTALL_TOPDIR)/etc
146 147 148 149
	@$(MAKE) -C tip tipserv-install
	@$(MAKE) -C capture tipserv-install
	@$(MAKE) -C tbsetup tipserv-install

150 151
client-mkdirs:
	-mkdir -p $(DESTDIR)$(CLIENT_BINDIR)
152
	-mkdir -p $(DESTDIR)$(CLIENT_MANDIR)
153 154

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

client-install: client client-mkdirs
169
ifeq ($(EVENTSYS),1)
170
	@$(MAKE) -C event client-install
171
endif
172
	@$(MAKE) -C os client-install
173
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
174 175
	@$(MAKE) -C capture client-install
	@$(MAKE) -C tip client-install
176
	@$(MAKE) -C tools client-install
177
endif
178
	@$(MAKE) -C sensors client-install
179 180
	@$(MAKE) -C tmcd client-install

181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
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) .

198 199 200 201
destdircheck:
	@if [ -z "$(DESTDIR)" ]; then \
	    echo "You must define DESTDIR for this target!"; \
	    false; \
202 203 204 205
	fi
	@if [ "$(DESTDIR)" = "/" ]; then \
	    echo "DESTDIR is '/', really really bad idea!"; \
	    false; \
206 207
	fi

208 209
mfsoscheck:
	@if [ `uname -s` != "FreeBSD" ]; then \
Mike Hibler's avatar
Mike Hibler committed
210
	    echo "Must build CDROM/MFS files on a FreeBSD system!"; \
211 212 213 214
	    false; \
	fi

mfs: mfsoscheck
215 216 217 218
	@$(MAKE) -C os mfs
	@$(MAKE) -C sensors mfs
	@$(MAKE) -C tmcd mfs

Mike Hibler's avatar
Mike Hibler committed
219 220 221 222 223
mfs-nostatic: mfsoscheck
	@NOSTATIC=1 $(MAKE) -C os mfs
	@NOSTATIC=1 $(MAKE) -C sensors mfs
	@NOSTATIC=1 $(MAKE) -C tmcd mfs

224
mfs-install: destdircheck mfs client-mkdirs
225 226 227 228
	@$(MAKE) -C os mfs-install
	@$(MAKE) -C sensors mfs-install
	@$(MAKE) -C tmcd mfs-install

Mike Hibler's avatar
Mike Hibler committed
229 230 231 232 233
mfs-nostatic-install: destdircheck mfs-nostatic client-mkdirs
	@$(MAKE) -C os mfs-install
	@$(MAKE) -C sensors mfs-install
	@$(MAKE) -C tmcd mfs-install

234 235 236 237 238
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
239 240 241 242 243
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

244 245 246 247 248
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
249 250 251 252 253
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
254 255 256 257 258 259 260
cdboot: mfsoscheck client
	@echo "CD/Dongle files built"

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

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

269 270 271 272 273
#
# 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)
274
SCHEMACHECK= cd $(OBJDIR)/db && perl schemacheck
275 276 277 278 279 280 281
else
SCHEMACHECK= @echo "Skipping schema check, since prefix isn't /usr/testbed"
endif
install-schemacheck:
	@echo "Checking DB schema..."
	$(SCHEMACHECK)

282 283 284 285 286 287 288 289 290
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)

291 292 293 294 295 296 297 298 299
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)

300 301 302 303 304 305 306 307 308
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)

309 310 311
# 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.
312 313
clean:		clean-subdirs
distclean:	distclean-subdirs
Mike Hibler's avatar
Mike Hibler committed
314
	rm -f Makeconf GNUmakefile config.h config.status config.cache config.log
315
	rm -f $(DISTCLEAN_FILES)
316 317 318 319
#
# 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:
320
	find $SRCDIR -name '*.in' -a -not -name configure.in | \
321
	    sed -e "s;$SRCDIR;$OBJDIR;" -e 's;[.]in$;;' | xargs rm -f
322

323 324 325 326 327
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) .

328 329 330 331 332
# How to recursively descend into subdirectories to make general
# targets such as `all'.
%.MAKE:
	@$(MAKE) -C $(dir $@) $(basename $(notdir $@))
%-subdirs: $(addsuffix /%.MAKE,$(SUBDIRS)) ;
333

334 335
# By default, make any target by descending into subdirectories.
%: %-subdirs ;
336

337
.PHONY: post-install install-mkdirs
338 339 340

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