GNUmakefile.in 5.84 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 23 24 25 26 27 28 29 30 31 32
#

#
# XXX ONLY RUN THIS INSTALL ON A FREEBSD 6 TESTBED NODE!
#
# Trivial. These things just need to be installed into the right place
# on a testbed node before cutting an image.
#
#
SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
33 34
OBJDIR		= @top_builddir@
SUBDIR		= $(subst $(TESTBED_SRCDIR)/,,$(SRCDIR))
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56

include $(OBJDIR)/Makeconf

SCRIPTS		= 

#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
# 
all:	supfile netif-emulab $(SCRIPTS)

include $(TESTBED_SRCDIR)/GNUmakerules

SYSETCDIR	= $(DESTDIR)/etc
JAILDIR		= $(SYSETCDIR)/jail
ETCDIR		= $(DESTDIR)$(CLIENT_ETCDIR)
BINDIR		= $(DESTDIR)$(CLIENT_BINDIR)
VARDIR		= $(DESTDIR)$(CLIENT_VARDIR)
RCDIR		= $(DESTDIR)/usr/local/etc/rc.d
ISMFS		= $(ETCDIR)/ismfs
INSTALL		= /usr/bin/install -c

57 58 59 60 61 62 63 64 65 66
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; \
	fi

67
install client-install:	bincheck basefbsd-install etc-install \
68 69
			sup-install script-install bin-install

70 71 72
subboss-install:	bincheck basefbsd-subboss-install etc-install \
			sup-install script-install bin-install

73 74
simple-install:	script-install bin-install

75 76 77 78 79 80
bincheck:
	@if [ ! -x /usr/local/sbin/dhclient ]; then \
		echo "Need to install net/isc-dhcp3-client port"; \
		false; \
	fi

81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
dir-install:
	$(INSTALL) -m 755 -o root -g wheel -d $(SYSETCDIR)
	$(INSTALL) -m 755 -o root -g wheel -d $(SYSETCDIR)/rc.d
	$(INSTALL) -m 755 -o root -g wheel -d $(SYSETCDIR)/rc.conf.d
	$(INSTALL) -m 755 -o root -g wheel -d $(ETCDIR)
	$(INSTALL) -m 755 -o root -g wheel -d $(BINDIR)
	$(INSTALL) -m 755 -o root -g wheel -d $(RCDIR)
	$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)
	$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/db
	$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/jails
	$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/logs
	$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/sup
	$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/boot
	$(INSTALL) -m 755 -o root -g wheel -d $(VARDIR)/lock
	-rm -rf $(DESTDIR)/etc/testbed
	ln -s emulab $(DESTDIR)/etc/testbed
	-rm -rf $(DESTDIR)/usr/local/etc/testbed
	ln -s emulab $(DESTDIR)/usr/local/etc/testbed

basefbsd-install: dir-install
	(cd ../freebsd5; $(MAKE) all install)
	rm -f $(SYSETCDIR)/rc.conf.d/dhclient
103 104
	rm -f $(DESTDIR)/usr/local/etc/dhclient*
	ln -s /etc/dhclient* $(DESTDIR)/usr/local/etc/
105

106 107 108 109 110 111
basefbsd-subboss-install: dir-install
	(cd ../freebsd5; $(MAKE) all subboss-install)
	rm -f $(SYSETCDIR)/rc.conf.d/dhclient
	rm -f $(DESTDIR)/usr/local/etc/dhclient*
	ln -s /etc/dhclient* $(DESTDIR)/usr/local/etc/

112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
sup-install:	dir-install supfile
	$(INSTALL) -m 755 ./supfile $(ETCDIR)/supfile

bin-install:	dir-install

etc-install:	dir-install sysetc-install
	$(INSTALL) -m 644 $(SRCDIR)/group $(ETCDIR)/group
	$(INSTALL) -m 600 $(SRCDIR)/master.passwd $(ETCDIR)/master.passwd

sysetc-install:	dir-install netif-emulab
	$(INSTALL) -m 444 $(SRCDIR)/rc.conf $(SYSETCDIR)/rc.conf
	$(INSTALL) -m 555 ./netif-emulab $(SYSETCDIR)/rc.d/netif-emulab

script-install:	dir-install
#	$(INSTALL) -m 755 $(SRCDIR)/prepare $(BINDIR)/prepare
Mike Hibler's avatar
Mike Hibler committed
127 128 129

#
# NOTES:
130 131
#  * We still use rc.conf.d/dhclient right now
#    (til we switch to 6.x rc.d files)
Mike Hibler's avatar
Mike Hibler committed
132
#
133
frisbee-mfs-install: destdircheck
134
	$(INSTALL) -m 755 -o root -g wheel -d $(DESTDIR)/usr/local/etc
Mike Hibler's avatar
Mike Hibler committed
135 136 137 138
	(cd ../freebsd5; $(MAKE) all frisbee-mfs-install)
	rm -f $(SYSETCDIR)/testbed/dhclient
	rm -f $(DESTDIR)/usr/local/etc/dhclient*
	ln -s /etc/dhclient* $(DESTDIR)/usr/local/etc/
139 140 141 142 143 144 145
	@if [ -r $(SRCDIR)/master.passwd ]; then \
	    $(INSTALL) -m 600 $(SRCDIR)/master.passwd $(SYSETCDIR); \
	    pwd_mkdb -d $(SYSETCDIR) $(SYSETCDIR)/master.passwd; \
	fi
	@if [ -r $(SRCDIR)/group ]; then \
	    $(INSTALL) -m 644 $(SRCDIR)/group $(SYSETCDIR); \
	fi
Mike Hibler's avatar
Mike Hibler committed
146

147
mfs-install: destdircheck
Mike Hibler's avatar
Mike Hibler committed
148
	(cd ../freebsd5; $(MAKE) all mfs-install)
149
	rm -rf $(JAILDIR)
Mike Hibler's avatar
Mike Hibler committed
150 151 152
	rm -f $(SYSETCDIR)/testbed/dhclient
	rm -f $(DESTDIR)/usr/local/etc/dhclient*
	ln -s /etc/dhclient* $(DESTDIR)/usr/local/etc/
153 154 155 156 157 158 159 160 161 162 163 164
	@if [ -r $(SRCDIR)/master.passwd ]; then \
	    $(INSTALL) -m 600 $(SRCDIR)/master.passwd $(SYSETCDIR); \
	    pwd_mkdb -d $(SYSETCDIR) $(SYSETCDIR)/master.passwd; \
	fi
	@if [ -r $(SRCDIR)/group ]; then \
	    $(INSTALL) -m 644 $(SRCDIR)/group $(SYSETCDIR); \
	fi

newnode-mfs-install: mfs-install
	(cd ../../../tools/teachswitch; $(MAKE) DESTDIR=$(DESTDIR) client-install)
	$(INSTALL) -m 755 $(SRCDIR)/../../../install/newclient $(BINDIR)/newclient
	$(INSTALL) -m 755 $(SRCDIR)/mfs-newnode-testbed.sh $(RCDIR)/testbed.sh
165

166 167 168
#
# CD/Flash install DOES have the FreeBSD 6 stuff
#
169 170
cdboot-install:
	(cd ../freebsd5; $(MAKE) all cdboot-install)
171
	rm -f $(SYSETCDIR)/rc.conf.d/dhclient
172 173
	rm -f $(DESTDIR)/usr/local/etc/dhclient*
	ln -s /etc/dhclient* $(DESTDIR)/usr/local/etc/
174 175 176 177 178 179
	$(INSTALL) -m 644 $(SRCDIR)/group $(ETCDIR)/group
	$(INSTALL) -m 600 $(SRCDIR)/master.passwd $(ETCDIR)/master.passwd
	$(INSTALL) -m 444 $(SRCDIR)/rc.conf $(SYSETCDIR)/rc.conf
	$(INSTALL) -m 755 $(SRCDIR)/dhclient-exit-hooks \
			$(SYSETCDIR)/dhclient-exit-hooks
	$(INSTALL) -m 555 ./netif-emulab $(SYSETCDIR)/rc.d/netif-emulab