GNUmakefile.in 11.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
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
23

24 25 26 27
SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
OBJDIR		= ..
SUBDIR		= tbsetup
28
UNIFIED         = @UNIFIED_BOSS_AND_OPS@
29
PLABSUPPORT     = @PLABSUPPORT@
30
ISMAINSITE	= @TBMAINSITE@
Mike Hibler's avatar
Mike Hibler committed
31
NSVERIFY	= @NSVERIFY@
32
PORTAL_ISPRIMARY= @PORTAL_ISPRIMARY@
33
SYSTEM         := $(shell uname -s)
34

35
include $(OBJDIR)/Makeconf
36

37 38
SUBDIRS		= checkpass ns2ir nseparse checkup template_cvsroot \
		  snmpit_test snmpit_old
Mike Hibler's avatar
Mike Hibler committed
39 40 41
ifeq ($(NSVERIFY),1)
SUBDIRS		+= nsverify
endif
Leigh B. Stoller's avatar
Leigh B. Stoller committed
42

43
BIN_STUFF	= power snmpit tbend tbprerun tbreport \
44
		  os_load endexp batchexp swapexp \
45
		  node_reboot nscheck node_update savelogs node_control \
46
		  checkports eventsys_control os_select tbrestart \
Kirk Webb's avatar
 
Kirk Webb committed
47
		  tbswap nseswap tarfiles_setup node_history tbrsync \
48
		  pxe_select portstats \
49
		  archive_control template_create \
50
		  template_swapin template_swapout template_graph \
51
		  template_exprun template_delete template_metadata \
52
		  template_export template_control template_commit \
53
		  template_analyze template_linkgraph template_instantiate \
54
		  template_revise template_checkout vtopgen mapper regression
55

56
SBIN_STUFF	= resetvlans console_setup.proxy sched_reload named_setup \
57
		  batch_daemon exports_setup reload_daemon sched_reserve \
58
		  console_reset db2ns bwconfig frisbeehelper \
59
		  rmgroup mkgroup setgroups mkproj modgroups \
60
		  exports_setup.proxy vnode_setup eventsys_start \
61
		  sfskey_update sfskey_update.proxy rmuser idleswap idlepower \
62
		  newnode_reboot savelogs.proxy eventsys.proxy \
63
		  elabinelab snmpit.proxy panic node_attributes \
64
		  nfstrace plabinelab smbpasswd_setup smbpasswd_setup.proxy \
65
		  rmproj snmpit.proxynew snmpit.proxyv2 pool_daemon \
66
		  checknodes_daemon snmpit.proxyv3 image_setup tcpp
Leigh B Stoller's avatar
Leigh B Stoller committed
67

68 69 70
ifeq ($(ISMAINSITE),1)
SBIN_STUFF     += repos_daemon
endif
71 72 73
ifeq ($(PORTAL_ISPRIMARY),1)
SBIN_STUFF     += portal_daemon
endif
74

75
CTRLSBIN_STUFF  = console_setup.proxy sfskey_update.proxy \
76
		  savelogs.proxy eventsys.proxy
77

78 79
CTRLBIN_STUFF	= fetchtar.proxy

80
FSBIN_STUFF	= exports_setup.proxy smbpasswd_setup.proxy
81

82 83
WEB_SBIN_SCRIPTS= webrmproj webpanic webrmgroup \
                  webmkgroup websetgroups webmkproj \
Leigh B. Stoller's avatar
Leigh B. Stoller committed
84 85
                  webrmuser webmodgroups webidleswap webnode_attributes

86 87 88
WEB_BIN_SCRIPTS = webnscheck webendexp webtbreport webbatchexp \
		  webnode_history webswapexp webeventsys_control \
		  webnode_reboot webtarfiles_setup webarchive_control \
89
		  webnode_control webnode_update webtemplate_create \
90
		  webtemplate_swapin webtemplate_swapout webtemplate_exprun \
91
		  webtemplate_graph webtemplate_metadata webtemplate_export \
92
		  webtemplate_control webtemplate_commit webtemplate_analyze \
93
		  webtemplate_linkgraph webtemplate_instantiate \
94
		  webtemplate_delete webtemplate_revise
95

96
LIBEXEC_STUFF	= wanlinksolve wanlinkinfo os_setup mkexpdir console_setup \
97
		  assign_wrapper assign_wrapper2 os_setup_old \
98
		  assign_prepass ptopgen ptopgen_new \
99 100 101 102 103
		  spewlogfile staticroutes routecalc wanassign \
		  switchmac \
		  spewrpmtar webfrisbeekiller gentopofile \
                  $(WEB_BIN_SCRIPTS) $(WEB_SBIN_SCRIPTS)

104
LIB_STUFF       = libtbsetup.pm exitonwarn.pm libtestbed.pm \
105
                  power_rpc27.pm power_apc.pm \
106
		  power_sgmote.pm \
Timothy Stack's avatar
 
Timothy Stack committed
107
		  libaudit.pm libreboot.pm libosload.pm libtestbed.py \
Kevin Atkinson's avatar
 
Kevin Atkinson committed
108
		  libadminmfs.pm libtblog.pm libtblog_simple.pm libArchive.pm \
David Johnson's avatar
David Johnson committed
109
		  power_mail.pm power_whol.pm Template.pm power_rmcp.pm \
110 111
		  power_ilo.pm libvtop.pm libptop.pm libptop_new.pm \
		  libossetup.pm \
112
		  power_ipmi.pm libosload_new.pm libosload_switch.pm \
113 114 115
		  libossetup_switch.pm power_icebox.pm \
		  libvtop_stable.pm libvtop_test.pm

116

117 118 119
# These scripts installed setuid, with sudo. 
SETUID_BIN_SCRIPTS   = node_reboot eventsys_control tarfiles_setup savelogs \
			tbrsync
120
SETUID_SBIN_SCRIPTS  = mkproj rmgroup mkgroup frisbeehelper \
121 122
			rmuser idleswap named_setup exports_setup \
			sfskey_update setgroups newnode_reboot vnode_setup \
123
			elabinelab nfstrace rmproj
124 125
SETUID_LIBX_SCRIPTS  = console_setup
SETUID_SUEXEC_SCRIPTS= spewlogfile
126

127 128 129 130
ifeq ($(SYSTEM),FreeBSD)
SUBDIRS  += ipassign
IPASSIGN  = Yes
endif
131

132 133 134 135 136 137 138 139 140 141 142 143
#
# Targets
#
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
TARGETS	= $(BIN_STUFF) $(SBIN_STUFF) $(LIBEXEC_STUFF) $(LIB_STUFF) $(SUBDIRS)
else
SUBDIRS = 
TARGETS = libaudit.pm libtestbed.pm libtblog_simple.pm
SETUID_BIN_SCRIPTS  =
SETUID_SBIN_SCRIPTS =
SETUID_LIBX_SCRIPTS = 
endif
144 145
#COMPILED_TARGETS    = $(filter %.pm, $(TARGETS))
COMPILED_TARGETS    = 
146

147
#
148 149 150
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
# 
151
all:	$(TARGETS) $(addprefix compiled/, $(COMPILED_TARGETS))
152 153 154

include $(TESTBED_SRCDIR)/GNUmakerules

155
CXXFLAGS += -Wall -O2 -g
Chad Barb's avatar
 
Chad Barb committed
156

157
wanlinksolve: wanlinksolve.cc
158
	${CXX} $< ${CXXFLAGS} -o $@ ${LIBS} -lm -lstdc++ ${LDFLAGS}
159 160

routecalc: routecalc.cc
161
	${CXX} $< ${CXXFLAGS} -o $@ ${LIBS} -lm -lstdc++ ${LDFLAGS}
Chad Barb's avatar
 
Chad Barb committed
162

163 164
.PHONY:	${SUBDIRS}

165 166
checkpass:
	@$(MAKE) -C checkpass all
Leigh B. Stoller's avatar
Leigh B. Stoller committed
167

168 169
ns2ir:
	@$(MAKE) -C ns2ir all
170

171 172 173
snmpit_test:
	@$(MAKE) -C snmpit_test all

174 175 176
snmpit_old:
	@$(MAKE) -C snmpit_old all

Timothy Stack's avatar
 
Timothy Stack committed
177 178 179
nsverify:
	@$(MAKE) -C nsverify all

180 181 182
nseparse:
	@$(MAKE) -C nseparse all

183 184 185
plab:
	@$(MAKE) -C plab all

186 187 188
ipassign:
	@$(MAKE) -C ipassign all

Timothy Stack's avatar
 
Timothy Stack committed
189 190 191
checkup:
	@$(MAKE) -C checkup all

192 193 194
template_cvsroot:
	@$(MAKE) -C template_cvsroot all

195 196 197 198 199
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
install: boss-install
else
install: clrhouse-install
endif
200

201 202
boss-install: all script-install subdir-install
	@echo "Don't forget to do a post-install as root"
Leigh B. Stoller's avatar
Leigh B. Stoller committed
203

204 205 206 207 208 209 210 211 212 213 214
#
# Only install the planetlab support if enabled in the defs file
#
ifeq ($(PLABSUPPORT),1)
PLAB_INSTALL      = @$(MAKE) -C plab install
PLAB_POST_INSTALL = @$(MAKE) -C plab post-install 
else
PLAB_INSTALL      =
PLAB_POST_INSTALL =
endif

Leigh B. Stoller's avatar
Leigh B. Stoller committed
215 216 217 218 219
#
# Automate this part at some point.
# 
subdir-install:
	@$(MAKE) -C checkpass install	
Leigh B. Stoller's avatar
Leigh B. Stoller committed
220
	@$(MAKE) -C ns2ir install
221
	@$(MAKE) -C template_cvsroot install
Mike Hibler's avatar
Mike Hibler committed
222
ifeq ($(NSVERIFY),1)
Timothy Stack's avatar
 
Timothy Stack committed
223
	@$(MAKE) -C nsverify install
Mike Hibler's avatar
Mike Hibler committed
224
endif
225
	@$(MAKE) -C nseparse install
226
	$(PLAB_INSTALL)
227
ifeq ($(IPASSIGN),Yes)
228
	@$(MAKE) -C ipassign install
229
endif
Timothy Stack's avatar
 
Timothy Stack committed
230
	@$(MAKE) -C checkup install
231
	@$(MAKE) -C snmpit_test install
232
	@$(MAKE) -C snmpit_old install
Leigh B. Stoller's avatar
Leigh B. Stoller committed
233

234 235 236
script-install:	$(addprefix $(INSTALL_BINDIR)/, $(BIN_STUFF)) \
	 $(addprefix $(INSTALL_SBINDIR)/, $(SBIN_STUFF)) \
	 $(addprefix $(INSTALL_LIBDIR)/, $(LIB_STUFF)) \
237
	 $(addprefix $(INSTALL_LIBEXECDIR)/, $(LIBEXEC_STUFF)) \
238
	 $(addprefix $(INSTALL_DIR)/opsdir/lib/, libtestbed.pm) \
David Johnson's avatar
David Johnson committed
239
	 $(addprefix $(INSTALL_DIR)/opsdir/lib/, libtestbed.py) \
240 241
	 $(addprefix $(INSTALL_DIR)/opsdir/bin/, $(CTRLBIN_STUFF)) \
	 $(addprefix $(INSTALL_DIR)/opsdir/sbin/, $(CTRLSBIN_STUFF))\
242
	 $(addprefix $(INSTALL_DIR)/opsdir/sbin/, $(FSBIN_STUFF))
243 244

post-install: 
245
	@$(MAKE) -C ns2ir post-install
Mike Hibler's avatar
Mike Hibler committed
246
ifeq ($(NSVERIFY),1)
Timothy Stack's avatar
 
Timothy Stack committed
247
	@$(MAKE) -C nsverify post-install
Mike Hibler's avatar
Mike Hibler committed
248
endif
249
	@$(MAKE) -C nseparse post-install
250
	$(PLAB_POST_INSTALL)
251
ifeq ($(IPASSIGN),Yes)
252
	@$(MAKE) -C ipassign post-install
253
endif
254 255 256 257
	chmod 775 $(INSTALL_BINDIR)
	chmod 775 $(INSTALL_SBINDIR)
	chmod 775 $(INSTALL_LIBDIR)
	chmod 775 $(INSTALL_LIBEXECDIR)
258 259
	chown root $(INSTALL_SBINDIR)/mkproj
	chmod u+s $(INSTALL_SBINDIR)/mkproj
Leigh B. Stoller's avatar
Leigh B. Stoller committed
260 261
	chown root $(INSTALL_SBINDIR)/rmproj
	chmod u+s $(INSTALL_SBINDIR)/rmproj
Leigh B. Stoller's avatar
Leigh B. Stoller committed
262 263
	chown root $(INSTALL_SBINDIR)/rmgroup
	chmod u+s $(INSTALL_SBINDIR)/rmgroup
264 265
	chown root $(INSTALL_SBINDIR)/mkgroup
	chmod u+s $(INSTALL_SBINDIR)/mkgroup
266 267
	chown root $(INSTALL_SBINDIR)/frisbeehelper
	chmod u+s $(INSTALL_SBINDIR)/frisbeehelper
268 269
	chown root $(INSTALL_SBINDIR)/rmuser
	chmod u+s $(INSTALL_SBINDIR)/rmuser
270 271
	chown root $(INSTALL_SBINDIR)/idleswap
	chmod u+s $(INSTALL_SBINDIR)/idleswap
272 273
	chown root $(INSTALL_SBINDIR)/named_setup
	chmod u+s $(INSTALL_SBINDIR)/named_setup
274 275
	chown root $(INSTALL_SBINDIR)/exports_setup
	chmod u+s $(INSTALL_SBINDIR)/exports_setup
276 277
	chown root $(INSTALL_SBINDIR)/sfskey_update
	chmod u+s $(INSTALL_SBINDIR)/sfskey_update
278 279
	chown root $(INSTALL_SBINDIR)/setgroups
	chmod u+s $(INSTALL_SBINDIR)/setgroups
280 281
	chown root $(INSTALL_LIBEXECDIR)/console_setup
	chmod u+s $(INSTALL_LIBEXECDIR)/console_setup
282 283
	chown root $(INSTALL_LIBEXECDIR)/spewlogfile
	chmod u+s $(INSTALL_LIBEXECDIR)/spewlogfile
284 285
	chown root $(INSTALL_BINDIR)/node_reboot
	chmod u+s $(INSTALL_BINDIR)/node_reboot
286 287
	chown root $(INSTALL_SBINDIR)/newnode_reboot
	chmod u+s $(INSTALL_SBINDIR)/newnode_reboot
288 289
	chown root $(INSTALL_SBINDIR)/vnode_setup
	chmod u+s $(INSTALL_SBINDIR)/vnode_setup
290 291
	chown root $(INSTALL_BINDIR)/eventsys_control
	chmod u+s $(INSTALL_BINDIR)/eventsys_control
292 293
	chown root $(INSTALL_BINDIR)/tarfiles_setup
	chmod u+s $(INSTALL_BINDIR)/tarfiles_setup
294 295
	chown root $(INSTALL_BINDIR)/savelogs
	chmod u+s $(INSTALL_BINDIR)/savelogs
296 297
	chown root $(INSTALL_SBINDIR)/elabinelab
	chmod u+s $(INSTALL_SBINDIR)/elabinelab
Kirk Webb's avatar
 
Kirk Webb committed
298 299
	chown root $(INSTALL_BINDIR)/tbrsync
	chmod u+s $(INSTALL_BINDIR)/tbrsync
300 301
	chown root $(INSTALL_SBINDIR)/nfstrace
	chmod u+s $(INSTALL_SBINDIR)/nfstrace
302

303 304 305
#
# Control node installation (okay, plastic)
#
306 307
control-install:	$(addprefix $(INSTALL_SBINDIR)/, $(CTRLSBIN_STUFF)) \
			$(addprefix $(INSTALL_BINDIR)/, $(CTRLBIN_STUFF)) \
308
			$(addprefix $(INSTALL_LIBDIR)/, libtestbed.pm)
309
	@$(MAKE) -C ns2ir control-install
Mike Hibler's avatar
Mike Hibler committed
310
ifeq ($(NSVERIFY),1)
Timothy Stack's avatar
 
Timothy Stack committed
311
	@$(MAKE) -C nsverify control-install
Mike Hibler's avatar
Mike Hibler committed
312
endif
313
	@$(MAKE) -C nseparse control-install
314

315 316 317 318 319 320
#
# FS install
#
fs-install:	$(addprefix $(INSTALL_SBINDIR)/, $(FSBIN_STUFF)) \
		$(addprefix $(INSTALL_LIBDIR)/, libtestbed.pm)

321 322 323 324 325
#
# Tip servers get very little
#
tipserv-install:	$(addprefix $(INSTALL_SBINDIR)/, console_setup.proxy)

326 327 328 329
# Clearinghouse install.
clrhouse-install: $(INSTALL_LIBDIR)/libaudit.pm \
		$(INSTALL_LIBDIR)/libtestbed.pm \
		$(INSTALL_LIBDIR)/libtblog_simple.pm
Mike Hibler's avatar
Mike Hibler committed
330

331
clean:	subdir-clean
Mike Hibler's avatar
Mike Hibler committed
332
	rm -f *.o core routecalc wanlinksolve
333 334 335 336

subdir-clean:
	@$(MAKE) -C checkpass clean
	@$(MAKE) -C ns2ir clean
Timothy Stack's avatar
 
Timothy Stack committed
337
	@$(MAKE) -C nsverify clean
338
	@$(MAKE) -C nseparse clean
Mike Hibler's avatar
Mike Hibler committed
339
	@$(MAKE) -C plab clean
340
	@$(MAKE) -C ipassign clean
Timothy Stack's avatar
 
Timothy Stack committed
341
	@$(MAKE) -C checkup clean
342
	@$(MAKE) -C snmpit_test clean
343
	@$(MAKE) -C snmpit_old clean
344 345 346 347 348 349

distclean:	subdir-distclean

subdir-distclean:
	@$(MAKE) -C checkpass distclean
	@$(MAKE) -C ns2ir distclean
Timothy Stack's avatar
 
Timothy Stack committed
350
	@$(MAKE) -C nsverify distclean
351
	@$(MAKE) -C nseparse distclean
352
	@$(MAKE) -C plab distclean
353
	@$(MAKE) -C ipassign distclean
Timothy Stack's avatar
 
Timothy Stack committed
354
	@$(MAKE) -C checkup distclean
355
	@$(MAKE) -C snmpit_test distclean
356
	@$(MAKE) -C snmpit_old distclean
357 358 359 360 361 362
#
# XXX Create non .tcl files.
#
%: %.tcl
	cp -p $< $@

363 364 365 366 367 368 369 370 371 372 373 374
# This rule says what web* script depends on which installed binary directory.
$(WEB_SBIN_SCRIPTS): $(INSTALL_SBINDIR)
$(WEB_BIN_SCRIPTS):  $(INSTALL_BINDIR)

# Just in case the dirs are not yet created,
$(INSTALL_SBINDIR) $(INSTALL_BINDIR):

# And then how to turn the template into the actual script. 
$(WEB_SBIN_SCRIPTS) $(WEB_BIN_SCRIPTS): $(TESTBED_SRCDIR)/WEBtemplate.in
	@echo "Generating $@"
	cat $< | sed -e 's,@PROGTOINVOKE@,$(word 2,$^)/$(subst web,,$@),' > $@

375 376 377 378
$(INSTALL_DIR)/opsdir/lib/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_DIR)/opsdir/lib
	$(INSTALL) $< $@
379

380 381 382 383 384
$(INSTALL_DIR)/opsdir/bin/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_DIR)/opsdir/bin
	$(INSTALL) $< $@

385 386 387 388
$(INSTALL_DIR)/opsdir/sbin/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_DIR)/opsdir/sbin
	$(INSTALL) $< $@
389 390 391 392 393

compiled/%: %
	@echo "Compiling $< to $@"
	-mkdir -p compiled
	perlcc -I $(INSTALL_LIBDIR) -B -o $@ $<