Newer
Older
# Copyright (c) 2000-2021 University of Utah and the Flux Group.
#
# {{{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/>.
#
# }}}
# Testbed Makefile
#
SRCDIR = @srcdir@
OBJDIR = .
SUBDIR =
TESTBED_SRCDIR = @top_srcdir@
DISTCLEAN_FILES = @DISTCLEAN_FILES@
EVENTSYS = @EVENTSYS@
PGENISUPPORT = @PROTOGENI_SUPPORT@
ISMAINSITE = @TBMAINSITE@
SPEWFROMOPS = @SPEWFROMOPS@
MOBILESUPPORT = @MOBILESUPPORT@
SYSTEM := $(shell uname -s)
include Makeconf
#
# Ordering here matters!
# Things with no dependencies go first:
# assign db lib www
# Things that may have dependencies go next:
# @optional_subdirs@ (has event)
# ipod os security sensors
# Then things that only depend on stuff we've done:
# pxe tbsetup tmcd utils backend www tip vis
# Then things that depend on stuff we just did:
#
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
SUBDIRS = \
clientside/lib \
db assign www @optional_subdirs@ clientside ipod security sensors \
sensors os xmlrpc autofs install/newnode_sshkeys \
tools/svn collab/exp-vis node_usage install
ifeq ($(ISMAINSITE),1)
ifeq ($(PGENISUPPORT),1)
endif
else
SUBDIRS = db tbsetup account protogeni
endif
all: all-subdirs just-builddirs
#
# 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
ifeq ($(STANDALONE_CLEARINGHOUSE),0)
install:
@echo "Choose either boss-install, ops-install or fs-install"
@echo "Choose opsfs-install instead of ops-install for a combined ops/fs machine"
@echo "Choose tipserv-install for dedicated tip server machines."
else
install: clrhouse-install
endif
#
# For installation on boss node
#
Leigh B Stoller
committed
boss-install: install-checks \
@echo "Boss node installed!"
# Same target, with the checks omitted
boss-install-force: install-subdirs install-mkdirs install-setbuildinfo
@echo "Boss node installed!"
# Skip only the schema checks, but do the other checks.
Leigh B Stoller
committed
boss-install-noschemacheck: install-updatecheck \
install-sitevarscheck install-dbfillcheck \
install-genischemacheck install-subdirs install-mkdirs \
install-setbuildinfo
# Skip the update check.
Leigh B Stoller
committed
boss-install-noupdatecheck: install-schemacheck \
install-sitevarscheck install-dbfillcheck \
install-genischemacheck install-subdirs install-mkdirs \
install-setbuildinfo
Leigh B Stoller
committed
install-checks: \
Leigh B Stoller
committed
install-updatecheck \
install-schemacheck \
install-sitevarscheck \
install-dbfillcheck install-genischemacheck
@echo "Installation checks completed!"
clrhouse-install: install-subdirs install-mkdirs
@echo "CleaingHouse code installed!"
post-install:
@$(MAKE) -C db post-install
@$(MAKE) -C tbsetup post-install
@$(MAKE) -C account post-install
@$(MAKE) -C security post-install
@$(MAKE) -C vis post-install
@$(MAKE) -C www post-install
ifeq ($(EVENTSYS),1)
endif
ifeq ($(MOBILESUPPORT),1)
@$(MAKE) -C mobile
endif
@$(MAKE) -C tools post-install
@$(MAKE) -C collab post-install
Leigh B. Stoller
committed
@$(MAKE) -C utils post-install
ifeq ($(NODE_USAGE_SUPPORT),1)
@$(MAKE) -C node_usage post-install
endif
Leigh B. Stoller
committed
#
# For installation on the 'ops' or 'users' node (okay, plastic)
Leigh B. Stoller
committed
#
ops-install:
-mkdir -p $(INSTALL_TOPDIR)/log
-mkdir -p $(INSTALL_TOPDIR)/log/mysql
-chmod 770 $(INSTALL_TOPDIR)/log/mysql
Russ Fish
committed
-chown mysql $(INSTALL_TOPDIR)/log/mysql
-chgrp mysql $(INSTALL_TOPDIR)/log/mysql
-mkdir -p $(INSTALL_TOPDIR)/log/logfiles
-chmod 777 $(INSTALL_TOPDIR)/log/logfiles
@$(MAKE) -C rc.d control-install
Leigh B. Stoller
committed
@$(MAKE) -C tbsetup control-install
@$(MAKE) -C security control-install
@$(MAKE) -C db control-install
@$(MAKE) -C clientside control-install
ifeq ($(EVENTSYS),1)
@$(MAKE) -C event control-install
endif
ifeq ($(PELABSUPPORT),1)
@$(MAKE) -C pelab control-install
endif
Leigh B. Stoller
committed
@$(MAKE) -C rc.d fs-install
@$(MAKE) -C tbsetup fs-install
@$(MAKE) -C clientside fs-install
opsfs-install: ops-install fs-install
@echo "Combined ops/fs install done."
install-mkdirs:
-mkdir -p $(INSTALL_TOPDIR)/db
-mkdir -p $(INSTALL_TOPDIR)/locks
-mkdir -p $(INSTALL_TOPDIR)/log
-mkdir -p $(INSTALL_TOPDIR)/log/mysql
-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
-mkdir -p $(INSTALL_TOPDIR)/log/exports
-mkdir -p $(INSTALL_TOPDIR)/lists
-mkdir -p $(INSTALL_TOPDIR)/backup
-mkdir -p $(INSTALL_TOPDIR)/expwork
-mkdir -p $(INSTALL_TOPDIR)/batch
-chmod 777 $(INSTALL_TOPDIR)/batch
-mkdir -p $(INSTALL_TOPDIR)/expinfo
-chmod 777 $(INSTALL_TOPDIR)/expinfo
-mkdir -p $(INSTALL_TOPDIR)/exparchive
-chmod 777 $(INSTALL_TOPDIR)/exparchive
-mkdir -p $(INSTALL_TOPDIR)/exparchive/Archive
-chmod 777 $(INSTALL_TOPDIR)/exparchive/Archive
-mkdir -p $(INSTALL_TOPDIR)/images
-chmod 775 $(INSTALL_TOPDIR)/images
-ln -sf /usr/testbed/bin/nse $(INSTALL_TOPDIR)/bin
endif
just-builddirs:
@$(MAKE) -C rc.d all
@$(MAKE) -C apache all
tipserv-install:
-mkdir -p $(INSTALL_TOPDIR)/log/tiplogs
-mkdir -p $(INSTALL_TOPDIR)/etc
@$(MAKE) -C clientside/tip tipserv-install
@$(MAKE) -C clientside/os/capture tipserv-install
@$(MAKE) -C tbsetup tipserv-install
client-mkdirs:
-mkdir -p $(DESTDIR)$(CLIENT_BINDIR)
-mkdir -p $(DESTDIR)$(CLIENT_MANDIR)
client:
@$(MAKE) -C os client
client-install: client client-mkdirs
@$(MAKE) -C os client-install
subboss:
@$(MAKE) -C clientside subboss
@$(MAKE) -C tbsetup subboss
@$(MAKE) -C db subboss
@$(MAKE) -C clientside subboss-install
@$(MAKE) -C tbsetup subboss-install
@$(MAKE) -C os subboss-install
@$(MAKE) -C db subboss-install
@$(MAKE) -C rc.d subboss-install
# Hack: this should probably be done by a subboss-install
# script, but there isn't a huge need for that yet
@rm -f $(INSTALL_RCDIR)/isc-dhcpd
TARBALLDESTDIR = /var/tmp/emulab-client
client-tarball:
@$(MAKE) -C clientside client-tarball
client-src-tarball:
@rm -f emulab-client-src.tar.gz
tar clzf emulab-client-src.tar.gz -C clientside
# This is not finished yet.
client-shadow-rpm:
-$(RM) -rf rpmbuild
mkdir -p rpmbuild/SOURCES rpmbuild/SRPMS
$(CP) emulab-client-src.tar.gz rpmbuild/SOURCES
$(RPM) -v -bs --nodeps --define='_topdir $(TOPDIR)/rpmbuild' \
clientside/shadow.spec
destdircheck:
@if [ -z "$(DESTDIR)" ]; then \
echo "You must define DESTDIR for this target!"; \
false; \
fi
@if [ "$(DESTDIR)" = "/" ]; then \
echo "DESTDIR is '/', really really bad idea!"; \
false; \
mfsoscheck:
@if [ `uname -s` != "FreeBSD" ]; then \
echo "Must build CDROM/MFS files on a FreeBSD system!"; \
false; \
fi
mfs: mfsoscheck
mfs-install: destdircheck mfs client-mkdirs
mfs-nostatic-install: destdircheck mfs-nostatic client-mkdirs
frisbee-mfs: mfsoscheck
frisbee-mfs-install: destdircheck frisbee-mfs
frisbee-mfs-nostatic-install: destdircheck frisbee-mfs-nostatic
newnode-mfs: mfsoscheck
@$(MAKE) -C clientside newnode-mfs
newnode-mfs-nostatic: mfsoscheck
@NOSTATIC=1 $(MAKE) -C clientside newnode-mfs
newnode-mfs-install: destdircheck newnode-mfs client-mkdirs
@$(MAKE) -C clientside newnode-mfs-install
newnode-mfs-nostatic-install: destdircheck newnode-mfs-nostatic client-mkdirs
@$(MAKE) -C clientside newnode-mfs-install
cdboot: mfsoscheck client
@echo "CD/Dongle files built"
cdboot-install: destdircheck cdboot
@$(MAKE) -C cdrom client-install
flashboot: mfsoscheck client
@echo "Flash dongle files built"
flashboot-install: destdircheck flashboot
@$(MAKE) -C os frisbee-mfs-install
@$(MAKE) -C flash client-install
#
# 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)
UPDATETESTBED= @cd $(OBJDIR)/install && perl update-testbed
else
UPDATETESTBED= @echo "Skipping update check, since prefix isn't /usr/testbed"
endif
ifeq ($(ISMAINSITE),1)
update-testbed: update-testbed-nostop
else
update-testbed: update-testbed-install
endif
update-testbed-install:
@echo "Updating the testbed ..."
$(UPDATETESTBED) -i -s
update-testbed-noinstall:
@echo "Updating the testbed ..."
$(UPDATETESTBED)
update-testbed-nostop:
@echo "Updating the testbed ..."
$(UPDATETESTBED) -i
update-testbed-force:
@echo "Updating the testbed in force mode ..."
$(UPDATETESTBED) -f
ifeq ($(TBROOT),/usr/testbed)
UPDATECHECK= @cd $(OBJDIR)/install && perl update-testbed -v
else
UPDATECHECK= @echo "Skipping update checks, since prefix isn't /usr/testbed"
endif
install-updatecheck:
@echo "Checking to see if updates need to be run"
$(UPDATECHECK)
ifeq ($(TBROOT),/usr/testbed)
SCHEMACHECK= cd $(OBJDIR)/db && perl schemacheck
else
SCHEMACHECK= @echo "Skipping schema check, since prefix isn't /usr/testbed"
endif
install-schemacheck:
@echo "Checking DB schema..."
$(SCHEMACHECK)
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)
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)
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)
install-genischemacheck:
ifeq ($(PGENISUPPORT),1)
@$(MAKE) -C protogeni install-genischemacheck
endif
Leigh B Stoller
committed
BRANCHCHECK=
BRANCHECHO= @echo "Skipping branch check since not the Mothership"
ifeq ($(ISMAINSITE),1)
ifeq ($(TBROOT),/usr/testbed)
BRANCHCHECK= cd $(SRCDIR) && \
git status --porcelain -s -b | head -1 | grep -q -s current
Leigh B Stoller
committed
BRANCHECHO= @echo "Checking to make sure you are on the mothership branch"
endif
endif
install-branchcheck:
$(BRANCHECHO)
$(BRANCHCHECK)
# 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.
clean: clean-subdirs
distclean: distclean-subdirs
rm -f Makeconf GNUmakefile config.h config.status config.cache config.log
rm -f $(DISTCLEAN_FILES)
#
# Be careful, do not run these unless you are updating your installation
# with a new IP subnet or domain name.
#
boss-updateip-clean: clean
@$(MAKE) -C rc.d clean
@$(MAKE) -C apache clean
@$(MAKE) -C named clean
@$(MAKE) -C dhcpd clean
ops-updateip-clean: clean
@$(MAKE) -C rc.d clean
@$(MAKE) -C apache clean
update-rcd:
@$(MAKE) -C rc.d all
@$(MAKE) -C rc.d install
#
# 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:
find $SRCDIR -name '*.in' -a -not -name configure.in | \
sed -e "s;$SRCDIR;$OBJDIR;" -e 's;[.]in$;;' | xargs rm -f
#
# XXX a "temporary" hack for scripts that were evolving fast.
# We didn't want to have to remake the client image whenever we changed these.
# They are copied over to the embryonic boss and ops during setup.
#
elabinelab-scripts:
cp -f $(SRCDIR)/clientside/tmcc/freebsd/mkextrafs.pl $(INSTALL_TOPDIR)/etc/
cp -f $(SRCDIR)/clientside/tmcc/common/config/rc.mkelab $(INSTALL_TOPDIR)/etc/
ifeq ($(SPEWFROMOPS),1)
elabinelab-nogit: elabinelab-scripts
-mkdir -p /share/emulab
rm -f /share/emulab/emulab-src.tar.gz
tar czf /share/emulab/emulab-src.tar.gz -C $(SRCDIR) --exclude=.git .
elabinelab-git: elabinelab-scripts
-mkdir -p /share/emulab
rm -f /share/emulab/emulab-src.tar.gz
git archive HEAD > /share/emulab/emulab-src.tar)
tar rf /share/emulab/emulab-src.tar -C $(SRCDIR) \
--exclude=.git protogeni/rspec-geni
gzip /share/emulab/emulab-src.tar
else
elabinelab-nogit: elabinelab-scripts
-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) --exclude=.git .
elabinelab-git: elabinelab-scripts
-mkdir -p $(INSTALL_TOPDIR)/src
rm -f $(INSTALL_TOPDIR)/src/emulab-src.tar.gz
git archive HEAD > $(INSTALL_TOPDIR)/src/emulab-src.tar)
tar rf $(INSTALL_TOPDIR)/src/emulab-src.tar -C $(SRCDIR) \
--exclude=.git protogeni/rspec-geni
gzip $(INSTALL_TOPDIR)/src/emulab-src.tar
endif
# How to recursively descend into subdirectories to make general
# targets such as `all'.
%.MAKE:
@$(MAKE) -C $(dir $@) $(basename $(notdir $@))
%-subdirs: $(addsuffix /%.MAKE,$(SUBDIRS)) ;
# By default, make any target by descending into subdirectories.
%: %-subdirs ;
.PHONY: post-install install-mkdirs clrhouse-install install \
boss-install-noupdatecheck boss-install-noschemacheck \
boss-install-force update-testbed update-testbed-install \
update-testbed-noinstall update-testbed-nostop
# Get rid of a bunch of nasty built-in implicit rules.
.SUFFIXES: