GNUmakefile.in 11 KB
Newer Older
1
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
2
# EMULAB-COPYRIGHT
3
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
4
# All rights reserved.
5
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
6

7 8 9 10
SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
OBJDIR		= ..
SUBDIR		= tbsetup
11
UNIFIED         = @UNIFIED_BOSS_AND_OPS@
12
PLABSUPPORT     = @PLABSUPPORT@
13
ISMAINSITE	= @TBMAINSITE@
Mike Hibler's avatar
Mike Hibler committed
14
NSVERIFY	= @NSVERIFY@
15
PORTAL_ISPRIMARY= @PORTAL_ISPRIMARY@
16
SYSTEM         := $(shell uname -s)
17

18
include $(OBJDIR)/Makeconf
19

20
SUBDIRS		= checkpass ns2ir nseparse checkup template_cvsroot snmpit_test
Mike Hibler's avatar
Mike Hibler committed
21 22 23
ifeq ($(NSVERIFY),1)
SUBDIRS		+= nsverify
endif
Leigh B. Stoller's avatar
Leigh B. Stoller committed
24

25
BIN_STUFF	= power snmpit snmpit_new tbend tbprerun tbreport \
26
		  os_load endexp batchexp swapexp \
27
		  node_reboot nscheck node_update savelogs node_control \
Chad Barb's avatar
 
Chad Barb committed
28
		  portstats checkports eventsys_control os_select tbrestart \
Kirk Webb's avatar
 
Kirk Webb committed
29
		  tbswap nseswap tarfiles_setup node_history tbrsync \
30
		  pxe_select \
31
		  archive_control template_create \
32
		  template_swapin template_swapout template_graph \
33
		  template_exprun template_delete template_metadata \
34
		  template_export template_control template_commit \
35
		  template_analyze template_linkgraph template_instantiate \
36
		  template_revise template_checkout vtopgen mapper regression
37

38
SBIN_STUFF	= resetvlans console_setup.proxy sched_reload named_setup \
39
		  batch_daemon exports_setup reload_daemon sched_reserve \
40
		  console_reset db2ns bwconfig frisbeehelper \
41
		  rmgroup mkgroup setgroups mkproj modgroups \
42
		  exports_setup.proxy vnode_setup eventsys_start \
43
		  sfskey_update sfskey_update.proxy rmuser idleswap idlepower \
44
		  newnode_reboot savelogs.proxy eventsys.proxy \
45
		  elabinelab snmpit.proxy panic node_attributes \
46
		  nfstrace plabinelab smbpasswd_setup smbpasswd_setup.proxy \
47
		  rmproj snmpit.proxynew snmpit.proxyv2 pool_daemon \
48
		  checknodes_daemon snmpit.proxyv3 
Leigh B Stoller's avatar
Leigh B Stoller committed
49

50 51 52
ifeq ($(ISMAINSITE),1)
SBIN_STUFF     += repos_daemon
endif
53 54 55
ifeq ($(PORTAL_ISPRIMARY),1)
SBIN_STUFF     += portal_daemon
endif
56

57
CTRLSBIN_STUFF  = console_setup.proxy sfskey_update.proxy \
58
		  savelogs.proxy eventsys.proxy
59

60 61
CTRLBIN_STUFF	= fetchtar.proxy

62
FSBIN_STUFF	= exports_setup.proxy smbpasswd_setup.proxy
63

64 65
WEB_SBIN_SCRIPTS= webrmproj webpanic webrmgroup \
                  webmkgroup websetgroups webmkproj \
Leigh B. Stoller's avatar
Leigh B. Stoller committed
66 67
                  webrmuser webmodgroups webidleswap webnode_attributes

68 69 70
WEB_BIN_SCRIPTS = webnscheck webendexp webtbreport webbatchexp \
		  webnode_history webswapexp webeventsys_control \
		  webnode_reboot webtarfiles_setup webarchive_control \
71
		  webnode_control webnode_update webtemplate_create \
72
		  webtemplate_swapin webtemplate_swapout webtemplate_exprun \
73
		  webtemplate_graph webtemplate_metadata webtemplate_export \
74
		  webtemplate_control webtemplate_commit webtemplate_analyze \
75
		  webtemplate_linkgraph webtemplate_instantiate \
76
		  webtemplate_delete webtemplate_revise
77

78
LIBEXEC_STUFF	= wanlinksolve wanlinkinfo os_setup mkexpdir console_setup \
79
		  assign_wrapper assign_wrapper2 os_setup_new \
80
		  assign_prepass ptopgen ptopgen_new \
81 82 83 84 85
		  spewlogfile staticroutes routecalc wanassign \
		  switchmac \
		  spewrpmtar webfrisbeekiller gentopofile \
                  $(WEB_BIN_SCRIPTS) $(WEB_SBIN_SCRIPTS)

86
LIB_STUFF       = libtbsetup.pm exitonwarn.pm libtestbed.pm snmpit_intel.pm \
87
                  snmpit_cisco.pm snmpit_lib.pm snmpit_apc.pm power_rpc27.pm \
88
		  snmpit_cisco_stack.pm snmpit_intel_stack.pm power_sgmote.pm \
89
		  snmpit_foundry.pm snmpit_stack.pm snmpit_remote.pm \
90
		  snmpit_nortel.pm snmpit_hp.pm snmpit_apcon.pm\
Timothy Stack's avatar
 
Timothy Stack committed
91
		  libaudit.pm libreboot.pm libosload.pm libtestbed.py \
Kevin Atkinson's avatar
 
Kevin Atkinson committed
92
		  libadminmfs.pm libtblog.pm libtblog_simple.pm libArchive.pm \
David Johnson's avatar
David Johnson committed
93
		  power_mail.pm power_whol.pm Template.pm power_rmcp.pm \
94 95
		  power_ilo.pm libvtop.pm libptop.pm libptop_new.pm \
		  libossetup.pm \
96
		  power_ipmi.pm libosload_new.pm libosload_switch.pm \
97 98 99
		  libossetup_switch.pm power_icebox.pm \
		  libvtop_stable.pm libvtop_test.pm

100

101 102 103
# These scripts installed setuid, with sudo. 
SETUID_BIN_SCRIPTS   = node_reboot eventsys_control tarfiles_setup savelogs \
			tbrsync
104
SETUID_SBIN_SCRIPTS  = mkproj rmgroup mkgroup frisbeehelper \
105 106
			rmuser idleswap named_setup exports_setup \
			sfskey_update setgroups newnode_reboot vnode_setup \
107
			elabinelab nfstrace rmproj
108 109
SETUID_LIBX_SCRIPTS  = console_setup
SETUID_SUEXEC_SCRIPTS= spewlogfile
110

111 112 113 114
ifeq ($(SYSTEM),FreeBSD)
SUBDIRS  += ipassign
IPASSIGN  = Yes
endif
115

116 117 118 119 120 121 122 123 124 125 126 127
#
# 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
128 129
#COMPILED_TARGETS    = $(filter %.pm, $(TARGETS))
COMPILED_TARGETS    = 
130

131
#
132 133 134
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
# 
135
all:	$(TARGETS) $(addprefix compiled/, $(COMPILED_TARGETS))
136 137 138

include $(TESTBED_SRCDIR)/GNUmakerules

139
CXXFLAGS += -Wall -O2 -g
Chad Barb's avatar
 
Chad Barb committed
140

141
wanlinksolve: wanlinksolve.cc
142
	${CXX} $< ${CXXFLAGS} -o $@ ${LIBS} -lm -lstdc++ ${LDFLAGS}
143 144

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

147 148
.PHONY:	${SUBDIRS}

149 150
checkpass:
	@$(MAKE) -C checkpass all
Leigh B. Stoller's avatar
Leigh B. Stoller committed
151

152 153
ns2ir:
	@$(MAKE) -C ns2ir all
154

155 156 157
snmpit_test:
	@$(MAKE) -C snmpit_test all

Timothy Stack's avatar
 
Timothy Stack committed
158 159 160
nsverify:
	@$(MAKE) -C nsverify all

161 162 163
nseparse:
	@$(MAKE) -C nseparse all

164 165 166
plab:
	@$(MAKE) -C plab all

167 168 169
ipassign:
	@$(MAKE) -C ipassign all

Timothy Stack's avatar
 
Timothy Stack committed
170 171 172
checkup:
	@$(MAKE) -C checkup all

173 174 175
template_cvsroot:
	@$(MAKE) -C template_cvsroot all

176 177 178 179 180
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
install: boss-install
else
install: clrhouse-install
endif
181

182 183
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
184

185 186 187 188 189 190 191 192 193 194 195
#
# 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
196 197 198 199 200
#
# Automate this part at some point.
# 
subdir-install:
	@$(MAKE) -C checkpass install	
Leigh B. Stoller's avatar
Leigh B. Stoller committed
201
	@$(MAKE) -C ns2ir install
202
	@$(MAKE) -C template_cvsroot install
Mike Hibler's avatar
Mike Hibler committed
203
ifeq ($(NSVERIFY),1)
Timothy Stack's avatar
 
Timothy Stack committed
204
	@$(MAKE) -C nsverify install
Mike Hibler's avatar
Mike Hibler committed
205
endif
206
	@$(MAKE) -C nseparse install
207
	$(PLAB_INSTALL)
208
ifeq ($(IPASSIGN),Yes)
209
	@$(MAKE) -C ipassign install
210
endif
Timothy Stack's avatar
 
Timothy Stack committed
211
	@$(MAKE) -C checkup install
212
	@$(MAKE) -C snmpit_test install
Leigh B. Stoller's avatar
Leigh B. Stoller committed
213

214 215 216
script-install:	$(addprefix $(INSTALL_BINDIR)/, $(BIN_STUFF)) \
	 $(addprefix $(INSTALL_SBINDIR)/, $(SBIN_STUFF)) \
	 $(addprefix $(INSTALL_LIBDIR)/, $(LIB_STUFF)) \
217
	 $(addprefix $(INSTALL_LIBEXECDIR)/, $(LIBEXEC_STUFF)) \
218
	 $(addprefix $(INSTALL_DIR)/opsdir/lib/, libtestbed.pm) \
David Johnson's avatar
David Johnson committed
219
	 $(addprefix $(INSTALL_DIR)/opsdir/lib/, libtestbed.py) \
220 221
	 $(addprefix $(INSTALL_DIR)/opsdir/bin/, $(CTRLBIN_STUFF)) \
	 $(addprefix $(INSTALL_DIR)/opsdir/sbin/, $(CTRLSBIN_STUFF))\
222
	 $(addprefix $(INSTALL_DIR)/opsdir/sbin/, $(FSBIN_STUFF))
223 224

post-install: 
225
	@$(MAKE) -C ns2ir post-install
Mike Hibler's avatar
Mike Hibler committed
226
ifeq ($(NSVERIFY),1)
Timothy Stack's avatar
 
Timothy Stack committed
227
	@$(MAKE) -C nsverify post-install
Mike Hibler's avatar
Mike Hibler committed
228
endif
229
	@$(MAKE) -C nseparse post-install
230
	$(PLAB_POST_INSTALL)
231
ifeq ($(IPASSIGN),Yes)
232
	@$(MAKE) -C ipassign post-install
233
endif
234 235 236 237
	chmod 775 $(INSTALL_BINDIR)
	chmod 775 $(INSTALL_SBINDIR)
	chmod 775 $(INSTALL_LIBDIR)
	chmod 775 $(INSTALL_LIBEXECDIR)
238 239
	chown root $(INSTALL_SBINDIR)/mkproj
	chmod u+s $(INSTALL_SBINDIR)/mkproj
Leigh B. Stoller's avatar
Leigh B. Stoller committed
240 241
	chown root $(INSTALL_SBINDIR)/rmproj
	chmod u+s $(INSTALL_SBINDIR)/rmproj
Leigh B. Stoller's avatar
Leigh B. Stoller committed
242 243
	chown root $(INSTALL_SBINDIR)/rmgroup
	chmod u+s $(INSTALL_SBINDIR)/rmgroup
244 245
	chown root $(INSTALL_SBINDIR)/mkgroup
	chmod u+s $(INSTALL_SBINDIR)/mkgroup
246 247
	chown root $(INSTALL_SBINDIR)/frisbeehelper
	chmod u+s $(INSTALL_SBINDIR)/frisbeehelper
248 249
	chown root $(INSTALL_SBINDIR)/rmuser
	chmod u+s $(INSTALL_SBINDIR)/rmuser
250 251
	chown root $(INSTALL_SBINDIR)/idleswap
	chmod u+s $(INSTALL_SBINDIR)/idleswap
252 253
	chown root $(INSTALL_SBINDIR)/named_setup
	chmod u+s $(INSTALL_SBINDIR)/named_setup
254 255
	chown root $(INSTALL_SBINDIR)/exports_setup
	chmod u+s $(INSTALL_SBINDIR)/exports_setup
256 257
	chown root $(INSTALL_SBINDIR)/sfskey_update
	chmod u+s $(INSTALL_SBINDIR)/sfskey_update
258 259
	chown root $(INSTALL_SBINDIR)/setgroups
	chmod u+s $(INSTALL_SBINDIR)/setgroups
260 261
	chown root $(INSTALL_LIBEXECDIR)/console_setup
	chmod u+s $(INSTALL_LIBEXECDIR)/console_setup
262 263
	chown root $(INSTALL_LIBEXECDIR)/spewlogfile
	chmod u+s $(INSTALL_LIBEXECDIR)/spewlogfile
264 265
	chown root $(INSTALL_BINDIR)/node_reboot
	chmod u+s $(INSTALL_BINDIR)/node_reboot
266 267
	chown root $(INSTALL_SBINDIR)/newnode_reboot
	chmod u+s $(INSTALL_SBINDIR)/newnode_reboot
268 269
	chown root $(INSTALL_SBINDIR)/vnode_setup
	chmod u+s $(INSTALL_SBINDIR)/vnode_setup
270 271
	chown root $(INSTALL_BINDIR)/eventsys_control
	chmod u+s $(INSTALL_BINDIR)/eventsys_control
272 273
	chown root $(INSTALL_BINDIR)/tarfiles_setup
	chmod u+s $(INSTALL_BINDIR)/tarfiles_setup
274 275
	chown root $(INSTALL_BINDIR)/savelogs
	chmod u+s $(INSTALL_BINDIR)/savelogs
276 277
	chown root $(INSTALL_SBINDIR)/elabinelab
	chmod u+s $(INSTALL_SBINDIR)/elabinelab
Kirk Webb's avatar
 
Kirk Webb committed
278 279
	chown root $(INSTALL_BINDIR)/tbrsync
	chmod u+s $(INSTALL_BINDIR)/tbrsync
280 281
	chown root $(INSTALL_SBINDIR)/nfstrace
	chmod u+s $(INSTALL_SBINDIR)/nfstrace
282

283 284 285
#
# Control node installation (okay, plastic)
#
286 287
control-install:	$(addprefix $(INSTALL_SBINDIR)/, $(CTRLSBIN_STUFF)) \
			$(addprefix $(INSTALL_BINDIR)/, $(CTRLBIN_STUFF)) \
288
			$(addprefix $(INSTALL_LIBDIR)/, libtestbed.pm)
289
	@$(MAKE) -C ns2ir control-install
Mike Hibler's avatar
Mike Hibler committed
290
ifeq ($(NSVERIFY),1)
Timothy Stack's avatar
 
Timothy Stack committed
291
	@$(MAKE) -C nsverify control-install
Mike Hibler's avatar
Mike Hibler committed
292
endif
293
	@$(MAKE) -C nseparse control-install
294

295 296 297 298 299 300
#
# FS install
#
fs-install:	$(addprefix $(INSTALL_SBINDIR)/, $(FSBIN_STUFF)) \
		$(addprefix $(INSTALL_LIBDIR)/, libtestbed.pm)

301 302 303 304 305
#
# Tip servers get very little
#
tipserv-install:	$(addprefix $(INSTALL_SBINDIR)/, console_setup.proxy)

306 307 308 309
# Clearinghouse install.
clrhouse-install: $(INSTALL_LIBDIR)/libaudit.pm \
		$(INSTALL_LIBDIR)/libtestbed.pm \
		$(INSTALL_LIBDIR)/libtblog_simple.pm
Mike Hibler's avatar
Mike Hibler committed
310

311
clean:	subdir-clean
Mike Hibler's avatar
Mike Hibler committed
312
	rm -f *.o core routecalc wanlinksolve
313 314 315 316

subdir-clean:
	@$(MAKE) -C checkpass clean
	@$(MAKE) -C ns2ir clean
Timothy Stack's avatar
 
Timothy Stack committed
317
	@$(MAKE) -C nsverify clean
318
	@$(MAKE) -C nseparse clean
Mike Hibler's avatar
Mike Hibler committed
319
	@$(MAKE) -C plab clean
320
	@$(MAKE) -C ipassign clean
Timothy Stack's avatar
 
Timothy Stack committed
321
	@$(MAKE) -C checkup clean
322
	@$(MAKE) -C snmpit_test clean
323 324 325 326 327 328

distclean:	subdir-distclean

subdir-distclean:
	@$(MAKE) -C checkpass distclean
	@$(MAKE) -C ns2ir distclean
Timothy Stack's avatar
 
Timothy Stack committed
329
	@$(MAKE) -C nsverify distclean
330
	@$(MAKE) -C nseparse distclean
331
	@$(MAKE) -C plab distclean
332
	@$(MAKE) -C ipassign distclean
Timothy Stack's avatar
 
Timothy Stack committed
333
	@$(MAKE) -C checkup distclean
334
	@$(MAKE) -C snmpit_test distclean
335 336 337 338 339 340
#
# XXX Create non .tcl files.
#
%: %.tcl
	cp -p $< $@

341 342 343 344 345 346 347 348 349 350 351 352
# 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,,$@),' > $@

353 354 355 356
$(INSTALL_DIR)/opsdir/lib/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_DIR)/opsdir/lib
	$(INSTALL) $< $@
357

358 359 360 361 362
$(INSTALL_DIR)/opsdir/bin/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_DIR)/opsdir/bin
	$(INSTALL) $< $@

363 364 365 366
$(INSTALL_DIR)/opsdir/sbin/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_DIR)/opsdir/sbin
	$(INSTALL) $< $@
367 368 369 370 371

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