GNUmakefile.in 5.05 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 23 24 25
#
SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
OBJDIR		= @top_builddir@
26
MOBILESUPPORT   = @MOBILESUPPORT@
27
SUBDIR		= $(subst $(TESTBED_SRCDIR)/,,$(SRCDIR))
28
SYSTEM	       := $(shell uname -s)
29 30
ARCH	       := $(shell uname -p)
REL	       := $(shell $(SRCDIR)/tmcc/osstuff.sh -r)
31 32 33

include $(OBJDIR)/Makeconf

34
SUBDIRS         = lib tools os sensors protogeni xmlrpc
35 36 37
ifneq ($(EVENTSYS),0)
SUBDIRS += event
endif
38 39 40
ifeq ($(MOBILESUPPORT),1)
SUBDIRS += mobile
endif
41 42 43
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
SUBDIRS += tip
endif
44 45
# tmcc should be last as the freenas* install targets mess with the hierarchy
SUBDIRS += tmcc
46

Leigh B Stoller's avatar
Leigh B Stoller committed
47
ifeq ($(WITH_EMULAB),1)
48
all:	all-subdirs
49
install:all boss-install-subdirs
Leigh B Stoller's avatar
Leigh B Stoller committed
50 51
else
all:	client-subdirs
Leigh B Stoller's avatar
Leigh B Stoller committed
52 53 54 55
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
56
endif
57 58 59
include $(TESTBED_SRCDIR)/GNUmakerules

client:		client-subdirs
60
client-install: client client-mkdirs client-install-subdirs client-setversion
61
control-install: control-install-subdirs
62
fs-install:     fs-install-subdirs
Leigh B Stoller's avatar
Leigh B Stoller committed
63
subboss:	subboss-subdirs
64
subboss-install: client client-mkdirs subboss-install-subdirs
65
post-install:	post-install-subdirs
66 67
clean:		clean-subdirs
distclean:	distclean-subdirs
Mike Hibler's avatar
Mike Hibler committed
68

69 70 71 72 73 74 75 76 77 78
onie-dongle:
	$(MAKE) -C lib onie-dongle
	$(MAKE) -C os onie-dongle
	$(MAKE) -C tmcc onie-dongle

onie-dongle-install: onie-dongle
	$(MAKE) -C lib onie-dongle-install
	$(MAKE) -C os onie-dongle-install
	$(MAKE) -C tmcc onie-dongle-install

Mike Hibler's avatar
Mike Hibler committed
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
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

mfsoscheck:
	@if [ `uname -s` != "FreeBSD" ]; then \
	    echo "Must build CDROM/MFS files on a FreeBSD system!"; \
	    false; \
	fi

mfs:		mfsoscheck mfs-subdirs
mfs-install:	destdircheck mfs client-mkdirs mfs-install-subdirs
frisbee-mfs:	mfsoscheck frisbee-mfs-subdirs
98
frisbee-mfs-install:	destdircheck frisbee-mfs frisbee-mfs-mkdirs frisbee-mfs-install-subdirs
Mike Hibler's avatar
Mike Hibler committed
99 100
newnode-mfs:	mfsoscheck newnode-mfs-subdirs
newnode-mfs-install:	destdircheck newnode-mfs client-mkdirs newnode-mfs-install-subdirs
Leigh B Stoller's avatar
Leigh B Stoller committed
101

102
TARBALLDESTDIR = /var/tmp/emulab-client
103
tarball-check:
104 105 106 107 108 109 110 111 112
	@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
113 114

client-tarball: tarball-check
115 116 117 118 119
	echo "Building and installing client-side in $(TARBALLDESTDIR)..."
	DESTDIR=$(TARBALLDESTDIR) $(MAKE) client-install
	echo "Creating tarball..."
	tar czf emulab-client.tar.gz -C $(TARBALLDESTDIR) .

120 121 122 123 124 125 126
xen-client-tarball: tarball-check
	echo "Building and installing client-side in $(TARBALLDESTDIR)..."
	DESTDIR=$(TARBALLDESTDIR) $(MAKE) client-install
	DESTDIR=$(TARBALLDESTDIR) $(MAKE) -C tmcc/linux xen-install
	echo "Creating tarball..."
	tar czf emulab-client.tar.gz -C $(TARBALLDESTDIR) .

Leigh B Stoller's avatar
Leigh B Stoller committed
127 128 129
client-mkdirs:
	-mkdir -p $(DESTDIR)$(CLIENT_BINDIR)
	-mkdir -p $(DESTDIR)$(CLIENT_MANDIR)
130

131
frisbee-mfs-mkdirs:
132
	-mkdir -p $(DESTDIR)/etc/rc.d
133 134
	-mkdir -p $(DESTDIR)/etc/emulab
	-mkdir -p $(DESTDIR)/etc/testbed
135
	-mkdir -p $(DESTDIR)/usr/local/etc
136

137 138
freenas-os-check:
	@if [ "$(SYSTEM)" != "FreeBSD" -o "$(ARCH)" != "amd64" -o \
Mike Hibler's avatar
Mike Hibler committed
139 140
	      \( "$(REL)" != "11.1" -a "$(REL)" != "10.3" -a "$(REL)" != "9.3" \) ]; then \
	    echo "Must run on FreeBSD 9.3 or 10.3 or 11.1 amd64"; \
141 142 143 144 145 146 147 148 149
	    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)..."
150 151
	OSSTUFF="OS=FreeBSD DIST=FreeNAS REL=$(REL)" \
	    DESTDIR=$(TARBALLDESTDIR) $(MAKE) client-install
152 153 154
	echo "Creating tarball freenas-client.tar.gz..."
	tar czf freenas-client.tar.gz -C $(TARBALLDESTDIR) .

155 156 157 158 159 160 161
#
# Attempt to find a git commit hash and stash in /etc/emulab.
#
client-setversion: setversion
	@echo "Setting Version info"
	@perl setversion

162 163 164 165 166 167 168
# 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)