GNUmakefile.in 5.76 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
include Makeconf

13 14 15
#
# Ordering here matters!
# Things with no dependencies go first: 
16
#   assign db lib www
17 18
# Things that may have dependencies go next:
#   @optional_subdirs@ (has event)
19
#   ipod os security sensors 
20 21 22 23
# 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:
#
24 25
SUBDIRS = lib db assign www @optional_subdirs@ ipod security sensors \
		pxe tbsetup account tmcd utils tip capture ipod vis \
26 27
		sensors os xmlrpc install/newnode_sshkeys mote tools/whol \
		wiki
Christopher Alfeld's avatar
Christopher Alfeld committed
28

29
all:		all-subdirs 
30

31
install:	
32
	@echo "Choose either boss-install (paper) or ops-install (plastic)"
33
	@echo "Choose tipserv-install for dedicated tip server machines."
34 35

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

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

48
post-install:
49
	@$(MAKE) -C db post-install
Mike Hibler's avatar
Mike Hibler committed
50
	@$(MAKE) -C ipod post-install
51
	@$(MAKE) -C tbsetup post-install
52
	@$(MAKE) -C account post-install
53
	@$(MAKE) -C security post-install
54 55
	@$(MAKE) -C vis post-install
	@$(MAKE) -C www post-install
56
ifeq ($(EVENTSYS),1)
57
	@$(MAKE) -C event post-install
58
endif
59
	@$(MAKE) -C mote post-install
60
	@$(MAKE) -C tools post-install
61
	@$(MAKE) -C wiki post-install
62

63
#
64
# For installation on the 'ops' or 'users' node (okay, plastic)
65
# 
66
ops-install:
67 68
	@$(MAKE) -C tbsetup control-install
	@$(MAKE) -C security control-install
69
	@$(MAKE) -C tip control-install
Leigh B. Stoller's avatar
Leigh B. Stoller committed
70
#	@$(MAKE) -C os control-install
71 72
	@$(MAKE) -C db control-install
	@$(MAKE) -C tbsetup control-install
Mac Newbold's avatar
Mac Newbold committed
73
	@$(MAKE) -C utils control-install
74
	@$(MAKE) -C lib control-install
75
ifeq ($(EVENTSYS),1)
76
	@$(MAKE) -C event control-install
77
endif
78
	@$(MAKE) -C xmlrpc control-install
79
	@$(MAKE) -C tmcd control-install
80

81
install-mkdirs:
82
	-mkdir -p $(INSTALL_TOPDIR)/opsdir
83 84
	-mkdir -p $(INSTALL_TOPDIR)/locks
	-mkdir -p $(INSTALL_TOPDIR)/log
85 86
	-mkdir -p $(INSTALL_TOPDIR)/log/mysql
	-mkdir -p $(INSTALL_TOPDIR)/log/exports
87
	-mkdir -p $(INSTALL_TOPDIR)/lists
88
	-mkdir -p $(INSTALL_TOPDIR)/backup
89
	-mkdir -p $(INSTALL_TOPDIR)/etc
90
	-mkdir -p $(INSTALL_TOPDIR)/expwork
91 92
	-mkdir -p $(INSTALL_TOPDIR)/batch
	-chmod 777 $(INSTALL_TOPDIR)/batch
93 94
	-mkdir -p $(INSTALL_TOPDIR)/expinfo
	-chmod 777 $(INSTALL_TOPDIR)/expinfo
95 96
	-mkdir -p $(INSTALL_TOPDIR)/images
	-chmod 775 $(INSTALL_TOPDIR)/images
97
	-ln -s /usr/testbed/bin/nse $(INSTALL_TOPDIR)/bin
98 99
	-mkdir -p $(INSTALL_TOPDIR)/ssl
	-chmod 770 $(INSTALL_TOPDIR)/ssl
100

101 102
tipserv-install:
	-mkdir -p $(INSTALL_TOPDIR)/log/tiplogs
103
	-mkdir -p $(INSTALL_TOPDIR)/etc
104 105 106 107
	@$(MAKE) -C tip tipserv-install
	@$(MAKE) -C capture tipserv-install
	@$(MAKE) -C tbsetup tipserv-install

108 109 110 111
client-mkdirs:
	-mkdir -p $(DESTDIR)$(CLIENT_BINDIR)

client:
112
	@$(MAKE) -C lib/libtb client
113
ifeq ($(EVENTSYS),1)
114
	@$(MAKE) -C event client
115
endif
116 117 118 119 120
	@$(MAKE) -C os client
	@$(MAKE) -C sensors client
	@$(MAKE) -C tmcd client

client-install: client client-mkdirs
121
ifeq ($(EVENTSYS),1)
122
	@$(MAKE) -C event client-install
123
endif
124
	@$(MAKE) -C os client-install
125
	@$(MAKE) -C sensors client-install
126 127
	@$(MAKE) -C tmcd client-install

128 129 130 131
destdircheck:
	@if [ -z "$(DESTDIR)" ]; then \
	    echo "You must define DESTDIR for this target!"; \
	    false; \
132 133 134 135
	fi
	@if [ "$(DESTDIR)" = "/" ]; then \
	    echo "DESTDIR is '/', really really bad idea!"; \
	    false; \
136 137
	fi

138 139 140 141 142 143 144
mfsoscheck:
	@if [ `uname -s` != "FreeBSD" ]; then \
	    echo "Must build MFS files on a FreeBSD system!"; \
	    false; \
	fi

mfs: mfsoscheck
145 146 147 148
	@$(MAKE) -C os mfs
	@$(MAKE) -C sensors mfs
	@$(MAKE) -C tmcd mfs

149
mfs-install: destdircheck mfs client-mkdirs
150 151 152 153
	@$(MAKE) -C os mfs-install
	@$(MAKE) -C sensors mfs-install
	@$(MAKE) -C tmcd mfs-install

154 155 156 157 158 159 160 161 162 163
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

164 165 166 167 168
#
# 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)
169
SCHEMACHECK= cd $(OBJDIR)/db && perl schemacheck
170 171 172 173 174 175 176
else
SCHEMACHECK= @echo "Skipping schema check, since prefix isn't /usr/testbed"
endif
install-schemacheck:
	@echo "Checking DB schema..."
	$(SCHEMACHECK)

177 178 179 180 181 182 183 184 185
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)

186 187 188 189 190 191 192 193 194
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)

195 196
clean:		clean-subdirs
distclean:	distclean-subdirs
Mike Hibler's avatar
Mike Hibler committed
197
	rm -f Makeconf GNUmakefile config.h config.status config.cache config.log
198
	rm -f $(DISTCLEAN_FILES)
199

200 201 202 203 204
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) .

205 206 207 208 209
# How to recursively descend into subdirectories to make general
# targets such as `all'.
%.MAKE:
	@$(MAKE) -C $(dir $@) $(basename $(notdir $@))
%-subdirs: $(addsuffix /%.MAKE,$(SUBDIRS)) ;
210

211 212
# By default, make any target by descending into subdirectories.
%: %-subdirs ;
213

214
.PHONY: post-install install-mkdirs
215 216 217

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