GNUmakefile.in 6.02 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@
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 29
		sensors os xmlrpc install/newnode_sshkeys mote tools/whol \
		wiki
30

31
all:		all-subdirs 
32

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

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

50
post-install:
51
	@$(MAKE) -C db post-install
52
	@$(MAKE) -C ipod post-install
53
	@$(MAKE) -C tbsetup post-install
54
	@$(MAKE) -C account post-install
55
	@$(MAKE) -C security post-install
56 57
	@$(MAKE) -C vis post-install
	@$(MAKE) -C www post-install
58
ifeq ($(EVENTSYS),1)
59
	@$(MAKE) -C event post-install
60
endif
61
	@$(MAKE) -C mote post-install
62
	@$(MAKE) -C tools post-install
63
	@$(MAKE) -C wiki post-install
64
	@$(MAKE) -C utils post-install
65

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

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

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

111 112 113 114
client-mkdirs:
	-mkdir -p $(DESTDIR)$(CLIENT_BINDIR)

client:
115
	@$(MAKE) -C lib/libtb client
116
ifeq ($(EVENTSYS),1)
117
	@$(MAKE) -C event client
118
endif
119
	@$(MAKE) -C os client
120
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
121 122
	@$(MAKE) -C capture client
	@$(MAKE) -C tip client
123
endif
124 125 126 127
	@$(MAKE) -C sensors client
	@$(MAKE) -C tmcd client

client-install: client client-mkdirs
128
ifeq ($(EVENTSYS),1)
129
	@$(MAKE) -C event client-install
130
endif
131
	@$(MAKE) -C os client-install
132
ifneq ($(SYSTEM),CYGWIN_NT-5.1)
133 134
	@$(MAKE) -C capture client-install
	@$(MAKE) -C tip client-install
135
endif
136
	@$(MAKE) -C sensors client-install
137 138
	@$(MAKE) -C tmcd client-install

139 140 141 142
destdircheck:
	@if [ -z "$(DESTDIR)" ]; then \
	    echo "You must define DESTDIR for this target!"; \
	    false; \
143 144 145 146
	fi
	@if [ "$(DESTDIR)" = "/" ]; then \
	    echo "DESTDIR is '/', really really bad idea!"; \
	    false; \
147 148
	fi

149 150 151 152 153 154 155
mfsoscheck:
	@if [ `uname -s` != "FreeBSD" ]; then \
	    echo "Must build MFS files on a FreeBSD system!"; \
	    false; \
	fi

mfs: mfsoscheck
156 157 158 159
	@$(MAKE) -C os mfs
	@$(MAKE) -C sensors mfs
	@$(MAKE) -C tmcd mfs

160
mfs-install: destdircheck mfs client-mkdirs
161 162 163 164
	@$(MAKE) -C os mfs-install
	@$(MAKE) -C sensors mfs-install
	@$(MAKE) -C tmcd mfs-install

165 166 167 168 169 170 171 172 173 174
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

175 176 177 178 179
#
# 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)
180
SCHEMACHECK= cd $(OBJDIR)/db && perl schemacheck
181 182 183 184 185 186 187
else
SCHEMACHECK= @echo "Skipping schema check, since prefix isn't /usr/testbed"
endif
install-schemacheck:
	@echo "Checking DB schema..."
	$(SCHEMACHECK)

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

197 198 199 200 201 202 203 204 205
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)

206 207
clean:		clean-subdirs
distclean:	distclean-subdirs
Mike Hibler's avatar
Mike Hibler committed
208
	rm -f Makeconf GNUmakefile config.h config.status config.cache config.log
209
	rm -f $(DISTCLEAN_FILES)
210

211 212 213 214 215
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) .

216 217 218 219 220
# How to recursively descend into subdirectories to make general
# targets such as `all'.
%.MAKE:
	@$(MAKE) -C $(dir $@) $(basename $(notdir $@))
%-subdirs: $(addsuffix /%.MAKE,$(SUBDIRS)) ;
221

222 223
# By default, make any target by descending into subdirectories.
%: %-subdirs ;
224

225
.PHONY: post-install install-mkdirs
226 227 228

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