GNUmakefile.in 6.87 KB
Newer Older
1 2 3
#
# Testbed Makefile
#
4 5 6 7 8
SRCDIR		= @srcdir@
OBJDIR		= .
SUBDIR		= 
TESTBED_SRCDIR  = @top_srcdir@
DISTCLEAN_FILES = @DISTCLEAN_FILES@ 
9
EVENTSYS	= @EVENTSYS@
Christopher Alfeld's avatar
Christopher Alfeld committed
10

11 12
SYSTEM	       := $(shell uname -s)

13 14
include Makeconf

15 16 17
#
# Ordering here matters!
# Things with no dependencies go first: 
18
#   assign db lib www
19 20
# Things that may have dependencies go next:
#   @optional_subdirs@ (has event)
21
#   ipod os security sensors 
22 23 24 25
# Then things that only depend on stuff we've done:
#   pxe tbsetup tmcd utils www tip capture vis
# Then things that depend on stuff we just did:
#
26 27
SUBDIRS = lib db assign www @optional_subdirs@ ipod security sensors \
		pxe tbsetup account tmcd utils tip capture ipod vis \
28
		sensors os xmlrpc install/newnode_sshkeys mote tools/whol \
29
		wiki bugdb collab
Christopher Alfeld's avatar
Christopher Alfeld committed
30

31
all:		all-subdirs 
32

33
install:	
34 35
	@echo "Choose either boss-install, ops-install or fs-install"
	@echo "Choose opsfs-install instead of ops-install for a combined ops/fs machine"
36
	@echo "Choose tipserv-install for dedicated tip server machines."
37 38

#
39
# For installation on boss node (okay, paper).
40
# 
41
boss-install:	install-schemacheck install-sitevarscheck install-dbfillcheck \
42
		install-subdirs install-mkdirs install-setbuildinfo
43 44 45 46 47
	@echo "DON'T FORGET TO RUN A POST-INSTALL AS ROOT"

#
# Same target, with the install-schemacheck dependency omitted
# 
48
boss-install-force:	install-subdirs install-mkdirs install-setbuildinfo
49
	@echo "DON'T FORGET TO RUN A POST-INSTALL AS ROOT"
50

51
post-install:
52
	@$(MAKE) -C db post-install
Mike Hibler's avatar
Mike Hibler committed
53
	@$(MAKE) -C ipod post-install
54
	@$(MAKE) -C tbsetup post-install
55
	@$(MAKE) -C account post-install
56
	@$(MAKE) -C security post-install
57 58
	@$(MAKE) -C vis post-install
	@$(MAKE) -C www post-install
59
ifeq ($(EVENTSYS),1)
60
	@$(MAKE) -C event post-install
61
endif
62
	@$(MAKE) -C mote post-install
63
	@$(MAKE) -C tools post-install
64
	@$(MAKE) -C wiki post-install
65
	@$(MAKE) -C bugdb post-install
66
	@$(MAKE) -C collab post-install
67
	@$(MAKE) -C utils post-install
68

69
#
70
# For installation on the 'ops' or 'users' node (okay, plastic)
71
# 
72
ops-install:
73 74 75 76
	-mkdir -p $(INSTALL_TOPDIR)/log
	-mkdir -p $(INSTALL_TOPDIR)/log/mysql
	-chmod 770 $(INSTALL_TOPDIR)/log/mysql
	-chown mysql.mysql $(INSTALL_TOPDIR)/log/mysql
77 78
	@$(MAKE) -C tbsetup control-install
	@$(MAKE) -C security control-install
79
	@$(MAKE) -C tip control-install
Leigh B. Stoller's avatar
Leigh B. Stoller committed
80
#	@$(MAKE) -C os control-install
81 82
	@$(MAKE) -C db control-install
	@$(MAKE) -C tbsetup control-install
Mac Newbold's avatar
Mac Newbold committed
83
	@$(MAKE) -C utils control-install
84
	@$(MAKE) -C lib control-install
85
ifeq ($(EVENTSYS),1)
86
	@$(MAKE) -C event control-install
87
endif
88
	@$(MAKE) -C sensors control-install
89
	@$(MAKE) -C xmlrpc control-install
90
	@$(MAKE) -C tmcd control-install
Leigh B. Stoller's avatar
Leigh B. Stoller committed
91
	@$(MAKE) -C account control-install
92

93 94 95 96 97 98
fs-install:
	@$(MAKE) -C tbsetup fs-install

opsfs-install: ops-install fs-install
	@echo "Combined ops/fs install done."

99
install-mkdirs:
100
	-mkdir -p $(INSTALL_TOPDIR)/opsdir
101 102
	-mkdir -p $(INSTALL_TOPDIR)/locks
	-mkdir -p $(INSTALL_TOPDIR)/log
103 104
	-mkdir -p $(INSTALL_TOPDIR)/log/mysql
	-mkdir -p $(INSTALL_TOPDIR)/log/exports
105
	-mkdir -p $(INSTALL_TOPDIR)/lists
106
	-mkdir -p $(INSTALL_TOPDIR)/backup
107
	-mkdir -p $(INSTALL_TOPDIR)/etc
108
	-mkdir -p $(INSTALL_TOPDIR)/expwork
109 110
	-mkdir -p $(INSTALL_TOPDIR)/batch
	-chmod 777 $(INSTALL_TOPDIR)/batch
111 112
	-mkdir -p $(INSTALL_TOPDIR)/expinfo
	-chmod 777 $(INSTALL_TOPDIR)/expinfo
113 114
	-mkdir -p $(INSTALL_TOPDIR)/images
	-chmod 775 $(INSTALL_TOPDIR)/images
115
	-ln -s /usr/testbed/bin/nse $(INSTALL_TOPDIR)/bin
116 117
	-mkdir -p $(INSTALL_TOPDIR)/ssl
	-chmod 770 $(INSTALL_TOPDIR)/ssl
118

119 120
tipserv-install:
	-mkdir -p $(INSTALL_TOPDIR)/log/tiplogs
121
	-mkdir -p $(INSTALL_TOPDIR)/etc
122 123 124 125
	@$(MAKE) -C tip tipserv-install
	@$(MAKE) -C capture tipserv-install
	@$(MAKE) -C tbsetup tipserv-install

126 127 128 129
client-mkdirs:
	-mkdir -p $(DESTDIR)$(CLIENT_BINDIR)

client:
130
	@$(MAKE) -C lib/libtb client
131
ifeq ($(EVENTSYS),1)
132
	@$(MAKE) -C event client
133
endif
134
	@$(MAKE) -C os client
135
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
136 137
	@$(MAKE) -C capture client
	@$(MAKE) -C tip client
138
	@$(MAKE) -C tools client
139
endif
140 141 142 143
	@$(MAKE) -C sensors client
	@$(MAKE) -C tmcd client

client-install: client client-mkdirs
144
ifeq ($(EVENTSYS),1)
145
	@$(MAKE) -C event client-install
146
endif
147
	@$(MAKE) -C os client-install
148
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
149 150
	@$(MAKE) -C capture client-install
	@$(MAKE) -C tip client-install
151
	@$(MAKE) -C tools client-install
152
endif
153
	@$(MAKE) -C sensors client-install
154 155
	@$(MAKE) -C tmcd client-install

156 157 158 159
destdircheck:
	@if [ -z "$(DESTDIR)" ]; then \
	    echo "You must define DESTDIR for this target!"; \
	    false; \
160 161 162 163
	fi
	@if [ "$(DESTDIR)" = "/" ]; then \
	    echo "DESTDIR is '/', really really bad idea!"; \
	    false; \
164 165
	fi

166 167 168 169 170 171 172
mfsoscheck:
	@if [ `uname -s` != "FreeBSD" ]; then \
	    echo "Must build MFS files on a FreeBSD system!"; \
	    false; \
	fi

mfs: mfsoscheck
173 174 175 176
	@$(MAKE) -C os mfs
	@$(MAKE) -C sensors mfs
	@$(MAKE) -C tmcd mfs

177
mfs-install: destdircheck mfs client-mkdirs
178 179 180 181
	@$(MAKE) -C os mfs-install
	@$(MAKE) -C sensors mfs-install
	@$(MAKE) -C tmcd mfs-install

182 183 184 185 186 187 188 189 190 191
frisbee-mfs: mfsoscheck
	@$(MAKE) -C cdrom/groklilo client
	@$(MAKE) -C os frisbee-mfs
	@$(MAKE) -C tmcd frisbee-mfs

frisbee-mfs-install: destdircheck frisbee-mfs
	@CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C cdrom/groklilo client-install
	@$(MAKE) -C os frisbee-mfs-install
	@$(MAKE) -C tmcd frisbee-mfs-install

192 193 194 195 196
#
# 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)
197
SCHEMACHECK= cd $(OBJDIR)/db && perl schemacheck
198 199 200 201 202 203 204
else
SCHEMACHECK= @echo "Skipping schema check, since prefix isn't /usr/testbed"
endif
install-schemacheck:
	@echo "Checking DB schema..."
	$(SCHEMACHECK)

205 206 207 208 209 210 211 212 213
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)

214 215 216 217 218 219 220 221 222
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)

223 224 225 226 227 228 229 230 231
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)

232 233
clean:		clean-subdirs
distclean:	distclean-subdirs
Mike Hibler's avatar
Mike Hibler committed
234
	rm -f Makeconf GNUmakefile config.h config.status config.cache config.log
235
	rm -f $(DISTCLEAN_FILES)
236

237 238 239 240 241
elabinelab:
	-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) .

242 243 244 245 246
# How to recursively descend into subdirectories to make general
# targets such as `all'.
%.MAKE:
	@$(MAKE) -C $(dir $@) $(basename $(notdir $@))
%-subdirs: $(addsuffix /%.MAKE,$(SUBDIRS)) ;
247

248 249
# By default, make any target by descending into subdirectories.
%: %-subdirs ;
250

251
.PHONY: post-install install-mkdirs
252 253 254

# Get rid of a bunch of nasty built-in implicit rules.
.SUFFIXES: