GNUmakefile.in 4.52 KB
Newer Older
1
#
2
# Copyright (c) 2000-2014 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
#
SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
OBJDIR		= @top_builddir@
26
SUBDIR		= $(subst $(TESTBED_SRCDIR)/,,$(SRCDIR))
27
SYSTEM	       := $(shell uname -s)
28 29
ARCH	       := $(shell uname -p)
REL	       := $(shell $(SRCDIR)/tmcc/osstuff.sh -r)
30 31 32

include $(OBJDIR)/Makeconf

33 34 35 36
SUBDIRS         = lib tools os sensors tmcc protogeni
ifneq ($(EVENTSYS),0)
SUBDIRS += event
endif
37

Leigh B Stoller's avatar
Leigh B Stoller committed
38
ifeq ($(WITH_EMULAB),1)
39
all:	all-subdirs
40
install:all boss-install-subdirs
Leigh B Stoller's avatar
Leigh B Stoller committed
41 42
else
all:	client-subdirs
Leigh B Stoller's avatar
Leigh B Stoller committed
43 44 45 46
install:
	@echo "Choose an appropriate install target, and make sure you "
	@echo "you are on a node of that type. Basically, do not do a "
	@echo "client-install on boss, cause you will be hating life!"
Leigh B Stoller's avatar
Leigh B Stoller committed
47
endif
48 49 50
include $(TESTBED_SRCDIR)/GNUmakerules

client:		client-subdirs
51
client-install: client client-mkdirs client-install-subdirs client-setversion
52
control-install: control-install-subdirs
53
fs-install:     fs-install-subdirs
Leigh B Stoller's avatar
Leigh B Stoller committed
54
subboss:	subboss-subdirs
55
subboss-install: client client-mkdirs subboss-install-subdirs
56
post-install:	post-install-subdirs
57 58
clean:		clean-subdirs
distclean:	distclean-subdirs
Leigh B Stoller's avatar
Leigh B Stoller committed
59
mfs:		mfs-subdirs
Leigh B Stoller's avatar
Leigh B Stoller committed
60
mfs-install:	client-mkdirs mfs-install-subdirs
Leigh B Stoller's avatar
Leigh B Stoller committed
61
frisbee-mfs:	frisbee-mfs-subdirs
Leigh B Stoller's avatar
Leigh B Stoller committed
62
frisbee-mfs-install:	client-mkdirs frisbee-mfs-install-subdirs
63 64
newnode-mfs:	newnode-mfs-subdirs
newnode-mfs-install:	client-mkdirs newnode-mfs-install-subdirs
Leigh B Stoller's avatar
Leigh B Stoller committed
65

66
TARBALLDESTDIR = /var/tmp/emulab-client
67
tarball-check:
68 69 70 71 72 73 74 75 76
	@if [ `id -u` -ne 0 ]; then \
	    echo '*** Must run as root!'; \
	    false; \
	fi
	@if [ -d "$(TARBALLDESTDIR)" ]; then \
	    echo "$(TARBALLDESTDIR) already exists."; \
	    echo "Remove it and try again."; \
	    false; \
	fi
77 78

client-tarball: tarball-check
79 80 81 82 83
	echo "Building and installing client-side in $(TARBALLDESTDIR)..."
	DESTDIR=$(TARBALLDESTDIR) $(MAKE) client-install
	echo "Creating tarball..."
	tar czf emulab-client.tar.gz -C $(TARBALLDESTDIR) .

Leigh B Stoller's avatar
Leigh B Stoller committed
84 85 86
client-mkdirs:
	-mkdir -p $(DESTDIR)$(CLIENT_BINDIR)
	-mkdir -p $(DESTDIR)$(CLIENT_MANDIR)
87

88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
freenas-os-check:
	@if [ "$(SYSTEM)" != "FreeBSD" -o "$(ARCH)" != "amd64" -o \
	      \( "$(REL)" != "9.2" -a "$(REL)" != "8.3" \) ]; then \
	    echo "Must run on FreeBSD 8.3 or 9.2 amd64"; \
	    false; \
	fi

#
# XXX when we have a real freenas9 target, all the moving files around
# should be done there...
#
freenas-tarball: freenas-os-check tarball-check
	echo "Building and installing client-side in $(TARBALLDESTDIR)..."
	DESTDIR=$(TARBALLDESTDIR) $(MAKE) client-install
	echo "Tweaking for FreeNAS..."
	(cd $(TARBALLDESTDIR); \
	    mkdir -p cfg cfg/rc.d cfg/local data local; \
	    mv etc/emulab cfg/emulab; \
	    mv usr/local/etc/emulab local/emulab; \
	    mv var/emulab data/emulab; \
	    ln -sf /data/emulab conf/base/var/emulab; \
	    rm -rf var data/emulab/sup; \
	    mkdir -p data/emulab/shadow data/emulab/vms; \
	    chflags noschg sbin/init; \
	    rm -rf boot etc root sbin usr/*; \
	    mv local usr/local; \
	    ln -sf /usr/local/emulab cfg/local/emulab)
	(cd $(SRCDIR)/tmcc/freenas8; \
	    cp genvmtype $(TARBALLDESTDIR)/cfg/emulab/; \
	    cp testbed $(TARBALLDESTDIR)/cfg/rc.d/; \
	    cp bscontrol.proxy.pl $(TARBALLDESTDIR)/usr/local/emulab/bscontrol.proxy; \
	    cp freenas-config libfreenas.pm libvnode_blockstore.pm $(TARBALLDESTDIR)/usr/local/emulab/; \
	    rm -f $(TARBALLDESTDIR)/usr/local/emulab/rc/rc.kname; \
	    chmod -R g-w $(TARBALLDESTDIR)/usr/local/emulab)
	echo "Creating tarball freenas-client.tar.gz..."
	tar czf freenas-client.tar.gz -C $(TARBALLDESTDIR) .

125 126 127 128 129 130 131
#
# Attempt to find a git commit hash and stash in /etc/emulab.
#
client-setversion: setversion
	@echo "Setting Version info"
	@perl setversion

132 133 134 135 136 137 138
# How to recursively descend into subdirectories to make general
# targets such as `all'.
%.MAKE:
	@$(MAKE) -C $(dir $@) $(basename $(notdir $@))
%-subdirs: $(addsuffix /%.MAKE,$(SUBDIRS)) ;

.PHONY:	$(SUBDIRS)