GNUmakefile.in 12.7 KB
Newer Older
1
#
2
# Copyright (c) 2000-2018 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 Stoller's avatar
Leigh 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@
31
NSVERIFY	= @NSVERIFY@
32
PORTAL_ISPRIMARY= @PORTAL_ISPRIMARY@
33
SYSTEM         := $(shell uname -s)
34

35
include $(OBJDIR)/Makeconf
36

Leigh Stoller's avatar
Leigh Stoller committed
37
SUBBOSS_SBIN_SCRIPTS = reportboot reportboot_daemon
38
SUBDIRS		= checkpass ns2ir nseparse checkup template_cvsroot \
39
		  snmpit
40 41 42
ifeq ($(NSVERIFY),1)
SUBDIRS		+= nsverify
endif
Leigh Stoller's avatar
Leigh Stoller committed
43

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

58
SBIN_STUFF	= resetvlans console_setup.proxy sched_reload named_setup \
59 60
		  batch_daemon exports_setup lease_daemon reload_daemon \
		  sched_reserve console_reset db2ns bwconfig frisbeehelper \
61
		  rmgroup mkgroup setgroups mkproj modgroups \
62
		  exports_setup.proxy vnode_setup eventsys_start \
63
		  sfskey_update sfskey_update.proxy rmuser idleswap idlepower \
64
		  newnode_reboot savelogs.proxy eventsys.proxy \
65
		  elabinelab panic node_attributes \
66
		  nfstrace plabinelab smbpasswd_setup smbpasswd_setup.proxy \
67
		  rmproj pool_daemon mkprojdirs \
68
		  checknodes_daemon snmpit.proxyv3 image_setup tcpp \
Leigh Stoller's avatar
Leigh Stoller committed
69
		  arplockdown bscontrol reportboot reportboot_daemon \
70
		  nfsmfs_setup nfsmfs_setup.proxy manage_expsettings
Leigh Stoller's avatar
Leigh Stoller committed
71

72 73 74
ifeq ($(ISMAINSITE),1)
SBIN_STUFF     += repos_daemon
endif
75 76 77
ifeq ($(PORTAL_ISPRIMARY),1)
SBIN_STUFF     += portal_daemon
endif
78

79
CTRLSBIN_STUFF  = console_setup.proxy sfskey_update.proxy \
80
		  savelogs.proxy eventsys.proxy
81

82 83
CTRLBIN_STUFF	= fetchtar.proxy

84
FSBIN_STUFF	= exports_setup.proxy smbpasswd_setup.proxy nfsmfs_setup.proxy
85

86
WEB_SBIN_SCRIPTS= webrmproj webpanic webrmgroup webexports_setup \
87
                  webmkgroup websetgroups webmkproj \
Leigh Stoller's avatar
Leigh Stoller committed
88 89
                  webrmuser webmodgroups webidleswap webnode_attributes

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

100
LIBEXEC_STUFF	= wanlinksolve wanlinkinfo os_setup mkexpdir console_setup \
101
		  assign_wrapper assign_wrapper2 os_setup_old \
102
		  assign_prepass ptopgen \
103
		  spewlogfile staticroutes routecalc wanassign \
104 105
		  switchmac spewrpmtar spewrpmtar_verify spewrpmtar_cgi \
		  webfrisbeekiller gentopofile \
106 107
                  $(WEB_BIN_SCRIPTS) $(WEB_SBIN_SCRIPTS)

108
LIB_STUFF       = libtbsetup.pm exitonwarn.pm libtestbed.pm \
109
                  power_rpc27.pm power_apc.pm power_ue.pm power_powduino.pm \
110
		  power_sgmote.pm power_racktivity.pm \
111
		  libaudit.pm libreboot.pm libosload.pm libtestbed.py \
112
		  libadminmfs.pm libtblog.pm libtblog_simple.pm libArchive.pm \
David Johnson's avatar
David Johnson committed
113
		  power_mail.pm power_whol.pm Template.pm power_rmcp.pm \
114
		  power_ilo.pm libvtop.pm libptop.pm \
115
		  libossetup.pm \
116
		  power_ipmi.pm libosload_new.pm libosload_switch.pm \
117
		  libosload_ue.pm libossetup_switch.pm power_icebox.pm \
118 119 120
		  libvtop_stable.pm libvtop_test.pm \
                  libosload_dell_s3048.pm libosload_dell_s4048.pm \
                  libosload_mlnx_sn2410.pm libosload_dell.pm \
121 122 123
                  libosload_hp5406.pm \
		  libimageops.pm libimageops_ndz.pm libimageops_docker.pm \
		  libimageops_ec2.pm
124

125

126 127 128
# These scripts installed setuid, with sudo. 
SETUID_BIN_SCRIPTS   = node_reboot eventsys_control tarfiles_setup savelogs \
			tbrsync
129
SETUID_SBIN_SCRIPTS  = mkproj rmgroup mkgroup frisbeehelper \
130 131
			rmuser idleswap named_setup exports_setup \
			sfskey_update setgroups newnode_reboot vnode_setup \
132
			elabinelab nfstrace rmproj arplockdown \
133
			bscontrol nfsmfs_setup mkprojdirs
134
SETUID_LIBX_SCRIPTS  = console_setup spewrpmtar_verify
135
SETUID_SUEXEC_SCRIPTS= spewlogfile
136

137 138 139 140
ifeq ($(SYSTEM),FreeBSD)
SUBDIRS  += ipassign
IPASSIGN  = Yes
endif
141

142 143 144 145 146 147 148 149 150 151 152 153
#
# 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
154 155
#COMPILED_TARGETS    = $(filter %.pm, $(TARGETS))
COMPILED_TARGETS    = 
156

157
#
158 159 160
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
# 
161
all:	$(TARGETS) $(addprefix compiled/, $(COMPILED_TARGETS))
162

163 164 165 166
subboss: $(SUBBOSS_SBIN_SCRIPTS)

$(SUBBOSS_SBIN_SCRIPTS):

167 168
include $(TESTBED_SRCDIR)/GNUmakerules

169
CXXFLAGS += -Wall -O2 -g
170

171
wanlinksolve: wanlinksolve.cc
172
	${CXX} $< ${CXXFLAGS} -o $@ ${LIBS} -lm -lstdc++ ${LDFLAGS}
173 174

routecalc: routecalc.cc
175
	${CXX} $< ${CXXFLAGS} -o $@ ${LIBS} -lm -lstdc++ ${LDFLAGS}
176

177 178
.PHONY:	${SUBDIRS}

179 180
checkpass:
	@$(MAKE) -C checkpass all
Leigh Stoller's avatar
Leigh Stoller committed
181

182 183
ns2ir:
	@$(MAKE) -C ns2ir all
184

185 186
snmpit:
	@$(MAKE) -C snmpit all
187

188 189 190
nsverify:
	@$(MAKE) -C nsverify all

191 192 193
nseparse:
	@$(MAKE) -C nseparse all

194 195 196
plab:
	@$(MAKE) -C plab all

197 198 199
ipassign:
	@$(MAKE) -C ipassign all

200 201 202
checkup:
	@$(MAKE) -C checkup all

203 204 205
template_cvsroot:
	@$(MAKE) -C template_cvsroot all

206 207 208 209 210
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
install: boss-install
else
install: clrhouse-install
endif
211

212 213
boss-install: all script-install subdir-install
	@echo "Don't forget to do a post-install as root"
Leigh Stoller's avatar
Leigh Stoller committed
214

215 216 217 218
subboss-install: $(addprefix $(INSTALL_SBINDIR)/, $(SUBBOSS_SBIN_SCRIPTS))
	ln -sf $(INSTALL_SBINDIR)/reportboot \
		$(DESTDIR)$(CLIENT_BINDIR)/reportboot

219 220 221 222 223 224 225 226 227 228 229
#
# 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 Stoller's avatar
Leigh Stoller committed
230 231 232 233 234
#
# Automate this part at some point.
# 
subdir-install:
	@$(MAKE) -C checkpass install	
Leigh Stoller's avatar
Leigh Stoller committed
235
	@$(MAKE) -C ns2ir install
236
	@$(MAKE) -C template_cvsroot install
237
ifeq ($(NSVERIFY),1)
238
	@$(MAKE) -C nsverify install
239
endif
240
	@$(MAKE) -C nseparse install
241
	$(PLAB_INSTALL)
242
ifeq ($(IPASSIGN),Yes)
243
	@$(MAKE) -C ipassign install
244
endif
245
	@$(MAKE) -C checkup install
246
	@$(MAKE) -C snmpit install
Leigh Stoller's avatar
Leigh Stoller committed
247

248 249 250
script-install:	$(addprefix $(INSTALL_BINDIR)/, $(BIN_STUFF)) \
	 $(addprefix $(INSTALL_SBINDIR)/, $(SBIN_STUFF)) \
	 $(addprefix $(INSTALL_LIBDIR)/, $(LIB_STUFF)) \
251
	 $(addprefix $(INSTALL_LIBEXECDIR)/, $(LIBEXEC_STUFF)) \
252
	 $(addprefix $(INSTALL_DIR)/opsdir/lib/, libtestbed.pm) \
253
	 $(addprefix $(INSTALL_DIR)/opsdir/lib/, libtestbed.py) \
254
	 $(addprefix $(INSTALL_DIR)/opsdir/cgi-bin/, spewrpmtar_cgi) \
255 256
	 $(addprefix $(INSTALL_DIR)/opsdir/bin/, $(CTRLBIN_STUFF)) \
	 $(addprefix $(INSTALL_DIR)/opsdir/sbin/, $(CTRLSBIN_STUFF))\
257
	 $(addprefix $(INSTALL_DIR)/opsdir/sbin/, $(FSBIN_STUFF))
258 259

post-install: 
260
	@$(MAKE) -C ns2ir post-install
261
ifeq ($(NSVERIFY),1)
262
	@$(MAKE) -C nsverify post-install
263
endif
264
	@$(MAKE) -C nseparse post-install
265
	$(PLAB_POST_INSTALL)
266
ifeq ($(IPASSIGN),Yes)
267
	@$(MAKE) -C ipassign post-install
268
endif
269 270 271 272
	chmod 775 $(INSTALL_BINDIR)
	chmod 775 $(INSTALL_SBINDIR)
	chmod 775 $(INSTALL_LIBDIR)
	chmod 775 $(INSTALL_LIBEXECDIR)
273 274
	chown root $(INSTALL_SBINDIR)/mkproj
	chmod u+s $(INSTALL_SBINDIR)/mkproj
Leigh Stoller's avatar
Leigh Stoller committed
275 276
	chown root $(INSTALL_SBINDIR)/rmproj
	chmod u+s $(INSTALL_SBINDIR)/rmproj
Leigh Stoller's avatar
Leigh Stoller committed
277 278
	chown root $(INSTALL_SBINDIR)/rmgroup
	chmod u+s $(INSTALL_SBINDIR)/rmgroup
279 280
	chown root $(INSTALL_SBINDIR)/mkgroup
	chmod u+s $(INSTALL_SBINDIR)/mkgroup
281 282
	chown root $(INSTALL_SBINDIR)/frisbeehelper
	chmod u+s $(INSTALL_SBINDIR)/frisbeehelper
283 284
	chown root $(INSTALL_SBINDIR)/rmuser
	chmod u+s $(INSTALL_SBINDIR)/rmuser
285 286
	chown root $(INSTALL_SBINDIR)/idleswap
	chmod u+s $(INSTALL_SBINDIR)/idleswap
287 288
	chown root $(INSTALL_SBINDIR)/named_setup
	chmod u+s $(INSTALL_SBINDIR)/named_setup
289 290
	chown root $(INSTALL_SBINDIR)/exports_setup
	chmod u+s $(INSTALL_SBINDIR)/exports_setup
291 292
	chown root $(INSTALL_SBINDIR)/sfskey_update
	chmod u+s $(INSTALL_SBINDIR)/sfskey_update
293 294
	chown root $(INSTALL_SBINDIR)/setgroups
	chmod u+s $(INSTALL_SBINDIR)/setgroups
295 296
	chown root $(INSTALL_LIBEXECDIR)/console_setup
	chmod u+s $(INSTALL_LIBEXECDIR)/console_setup
297 298
	chown root $(INSTALL_LIBEXECDIR)/spewlogfile
	chmod u+s $(INSTALL_LIBEXECDIR)/spewlogfile
299 300
	chown root $(INSTALL_BINDIR)/node_reboot
	chmod u+s $(INSTALL_BINDIR)/node_reboot
301 302
	chown root $(INSTALL_SBINDIR)/newnode_reboot
	chmod u+s $(INSTALL_SBINDIR)/newnode_reboot
303 304
	chown root $(INSTALL_SBINDIR)/vnode_setup
	chmod u+s $(INSTALL_SBINDIR)/vnode_setup
305 306
	chown root $(INSTALL_BINDIR)/eventsys_control
	chmod u+s $(INSTALL_BINDIR)/eventsys_control
307 308
	chown root $(INSTALL_BINDIR)/tarfiles_setup
	chmod u+s $(INSTALL_BINDIR)/tarfiles_setup
309 310
	chown root $(INSTALL_BINDIR)/savelogs
	chmod u+s $(INSTALL_BINDIR)/savelogs
311 312
	chown root $(INSTALL_SBINDIR)/elabinelab
	chmod u+s $(INSTALL_SBINDIR)/elabinelab
313 314
	chown root $(INSTALL_BINDIR)/tbrsync
	chmod u+s $(INSTALL_BINDIR)/tbrsync
315 316
	chown root $(INSTALL_SBINDIR)/nfstrace
	chmod u+s $(INSTALL_SBINDIR)/nfstrace
317

318 319 320
#
# Control node installation (okay, plastic)
#
321 322
control-install:	$(addprefix $(INSTALL_SBINDIR)/, $(CTRLSBIN_STUFF)) \
			$(addprefix $(INSTALL_BINDIR)/, $(CTRLBIN_STUFF)) \
323
			$(addprefix $(INSTALL_LIBDIR)/, libtestbed.pm)
324
	@$(MAKE) -C ns2ir control-install
325
ifeq ($(NSVERIFY),1)
326
	@$(MAKE) -C nsverify control-install
327
endif
328
	@$(MAKE) -C nseparse control-install
329

330 331 332 333 334 335
#
# FS install
#
fs-install:	$(addprefix $(INSTALL_SBINDIR)/, $(FSBIN_STUFF)) \
		$(addprefix $(INSTALL_LIBDIR)/, libtestbed.pm)

336 337 338 339 340
#
# Tip servers get very little
#
tipserv-install:	$(addprefix $(INSTALL_SBINDIR)/, console_setup.proxy)

341 342 343 344
# Clearinghouse install.
clrhouse-install: $(INSTALL_LIBDIR)/libaudit.pm \
		$(INSTALL_LIBDIR)/libtestbed.pm \
		$(INSTALL_LIBDIR)/libtblog_simple.pm
Mike Hibler's avatar
Mike Hibler committed
345

346
clean:	subdir-clean
Mike Hibler's avatar
Mike Hibler committed
347
	rm -f *.o core routecalc wanlinksolve
348 349 350 351

subdir-clean:
	@$(MAKE) -C checkpass clean
	@$(MAKE) -C ns2ir clean
352
	@$(MAKE) -C nsverify clean
353
	@$(MAKE) -C nseparse clean
Mike Hibler's avatar
Mike Hibler committed
354
	@$(MAKE) -C plab clean
355
	@$(MAKE) -C ipassign clean
356
	@$(MAKE) -C checkup clean
357
	@$(MAKE) -C snmpit clean
358 359 360 361 362 363

distclean:	subdir-distclean

subdir-distclean:
	@$(MAKE) -C checkpass distclean
	@$(MAKE) -C ns2ir distclean
364
	@$(MAKE) -C nsverify distclean
365
	@$(MAKE) -C nseparse distclean
366
	@$(MAKE) -C plab distclean
367
	@$(MAKE) -C ipassign distclean
368
	@$(MAKE) -C checkup distclean
369
	@$(MAKE) -C snmpit distclean
370

371 372 373 374 375 376
#
# XXX Create non .tcl files.
#
%: %.tcl
	cp -p $< $@

377 378 379 380 381 382 383 384 385 386 387 388
# 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,,$@),' > $@

389 390 391 392
$(INSTALL_DIR)/opsdir/lib/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_DIR)/opsdir/lib
	$(INSTALL) $< $@
393

394 395 396 397 398
$(INSTALL_DIR)/opsdir/bin/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_DIR)/opsdir/bin
	$(INSTALL) $< $@

399 400 401 402
$(INSTALL_DIR)/opsdir/sbin/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_DIR)/opsdir/sbin
	$(INSTALL) $< $@
403

404 405 406 407 408 409 410 411 412
$(INSTALL_DIR)/opsdir/cgi-bin/spewrpmtar_cgi: spewrpmtar_cgi
	echo "Installing (link to wrapper) $<"
	mkdir -p $(INSTALL_DIR)/opsdir/cgi-bin
	-rm -f $@
	ln -s $(INSTALL_LIBEXECDIR)/runsuid $@
	echo "Installing (real script) $<"
	-mkdir -p $(INSTALL_DIR)/opsdir/suidbin
	$(SUDO) $(INSTALL_PROGRAM) $< $(INSTALL_DIR)/opsdir/suidbin/$<

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