GNUmakefile.in 5.46 KB
Newer Older
1
#
2
# EMULAB-COPYRIGHT
3
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
4
# All rights reserved.
5
#
6 7
SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
8
EVENTSYS	= @EVENTSYS@
9 10
OBJDIR		= ..
SUBDIR		= tmcd
11

12
SYSTEM	       := $(shell $(TESTBED_SRCDIR)/utils/osstuff.sh -o)
13

14
include $(OBJDIR)/Makeconf
15

16 17
all:	server fullclient client
fullclient: tmcc
18
client: tmcc-nossl findif dostype
19
server: tmcd tmcd.restart
20

21
include $(TESTBED_SRCDIR)/GNUmakerules
22

23
CFLAGS	+= -O -g -Wall -DUDP \
Leigh B. Stoller's avatar
Leigh B. Stoller committed
24
		-I${OBJDIR} -I/usr/local/include \
25 26
		-I${TESTBED_SRCDIR}/lib/libtb -I${TESTBED_SRCDIR}/pxe \
		-L/usr/local/lib
27
TMLIBS	 = ${OBJDIR}/lib/libtb/libtb.a
Leigh B. Stoller's avatar
Leigh B. Stoller committed
28
BOOTINFO = ${OBJDIR}/pxe/bootinfo.o ${OBJDIR}/pxe/bootinfo_mysql.o
29
LDFLAGS += $(LDSTATIC)
30 31 32 33

#
# For SSL enabled tmcd/tmcc
#
34 35
CFLAGS	+= -DETCDIR='"$(INSTALL_ETCDIR)"'
SSLFLAGS = -DWITHSSL 
36 37
TMLIBS	+= -lssl -lcrypto
SSLOBJ   = ssl.o
38 39
TPMOBJ   = tpm.o
NOTPM	 = notpm
40

41
ifeq ($(SYSTEM),Linux)
42 43
ifneq ($(LDSTATIC),)
NOKERB := $(shell nm /usr/lib/libssl.a | grep -q krb; echo $$?)
44
else
45 46 47 48 49 50 51
NOKERB := 1
endif
ifeq ($(NOKERB),0)
CFLAGS   += `/usr/kerberos/bin/krb5-config --cflags`
TMLIBS   += `/usr/kerberos/bin/krb5-config --libs krb5`
ifneq ($(wildcard /usr/lib/libkrb5support.a),)
TMLIBS     += -lkrb5support
52
endif
53
endif
54
TMLIBS  += -ldl
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
endif

#
# Take care of historic naming fubars:
#	Redhat 7.x ->  linux
#	Redhat 9.0 ->  linux9
#	Fedora 4/6 ->  fedora
#	Stargate 1  -> linux-sg
#	FreeBSD 4.x -> freebsd
#	Windows XP  -> cygwinxp
#
MDSUBDIR  := $(shell $(TESTBED_SRCDIR)/utils/osstuff.sh -t)

ifeq ($(SYSTEM),Linux)
ifeq ($(MDSUBDIR),redhat7)
Mike Hibler's avatar
Mike Hibler committed
70 71
MDSUBDIR  = linux
endif
72 73 74 75 76 77
ifeq ($(MDSUBDIR),redhat9)
MDSUBDIR  = linux9
endif
ifeq ($(findstring fedora,$(MDSUBDIR)),fedora)
MDSUBDIR  = fedora
endif
78 79 80
ifeq ($(findstring centos,$(MDSUBDIR)),centos)
MDSUBDIR  = fedora
endif
81 82
ifeq ($(MDSUBDIR),stargate1)
MDSUBDIR  = linux-sg
83
endif
84
endif
85

Mike Hibler's avatar
Mike Hibler committed
86
ifeq ($(SYSTEM),FreeBSD)
87
ifeq ($(MDSUBDIR),freebsd4)
Mike Hibler's avatar
Mike Hibler committed
88
MDSUBDIR  = freebsd
89
endif
Mike Hibler's avatar
Mike Hibler committed
90 91 92
ifeq ($(MDSUBDIR),freebsd8)
MDSUBDIR  = freebsd7
endif
Mike Hibler's avatar
Mike Hibler committed
93
endif
94

95
ifeq ($(SYSTEM),Cygwin)
96
# Cygwin on  Windows XP (a.k.a. NT 5.1) - resembles the Linux case.
97
ifeq ($(MDSUBDIR),CYGWIN_NT-5.1)
98
MDSUBDIR  = cygwinxp
99
TMSLIBS   += -lminires
100
endif
Kirk Webb's avatar
 
Kirk Webb committed
101 102
endif

103
ifeq ($(EVENTSYS),1)
104
	TMCDCFLAGS  = -I$(TESTBED_SRCDIR)/event/lib -DEVENTSYS
105
	TMCDLIBS    = ${OBJDIR}/event/lib/libevent.a
106
	ELVINFLAGS  = -lm -L/usr/local/lib -lpubsub 
107
endif
108

109
tmcd: tmcd.c ${TMCDLIBS} decls.h version.o $(SSLOBJ) $(BOOTINFO) $(NOTPM)
110
	$(CC) $(CFLAGS) $(SSLFLAGS) $(TMCDCFLAGS) -o tmcd $< \
111
		version.o $(SSLOBJ) $(TPMOBJ) $(BOOTINFO) \
112 113
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient \
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS) 
114

115 116 117 118 119
mod_tmcd.so: libtmcd.o
	apxs -c mod_tmcd.c -L/usr/local/lib/mysqlclient -lmysqlclient \
		-L /usr/local/lib -lxml2 $(SSLOBJ) \
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS) $<

120 121
newtmcd: newtmcd.c libtmcd.o ${TMCDLIBS} decls.h version.o $(SSLOBJ) \
	$(NOTPMOBJ) $(BOOTINFO)
122
	$(CC) $(CFLAGS) $(SSLFLAGS) $(TMCDCFLAGS) -o tmcd $< \
123
		libtmcd.o version.o $(SSLOBJ) $(TPMOBJ) $(BOOTINFO) \
124 125 126 127
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient  -lxml2 \
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS) 

libtmcd.o: libtmcd.c ${TMCDLIBS} decls.h version.o $(SSLOBJ) $(BOOTINFO)
128 129
	$(CC) $(CFLAGS) -I/usr/local/include/libxml2 $(SSLFLAGS) \
		$(TMCDCFLAGS) -c -o libtmcd.o $<
130

131 132 133 134 135
libtmcd.so: libtmcd.o ${TMCDLIBS} decls.h $(BOOTINFO)
	$(LD) -shared $^ -L/usr/local/lib/mysql -lxml2 -lmysqlclient \
		$(TMCDLIBS) $(ELVINFLAGS) ../lib/libtb/libtb.a \
		-o $@

136 137 138
tmcc: tmcc.c decls.h $(SSLOBJ) $(TPMOBJ) 
	$(CC) $(CFLAGS) $(SSLFLAGS) $(LDSTATIC) -g -o tmcc \
		$< $(SSLOBJ) $(TPMOBJ) $(LFLAGS) $(TMLIBS)
139

140
tmcc-shared: tmcc.c decls.h $(SSLOBJ) $(TPMOBJ) 
141
	$(CC) $(CFLAGS) $(SSLFLAGS) -g -o tmcc $< $(SSLOBJ) \
142
		$(TPMOBJ) $(LFLAGS) $(TMLIBS)
143

Timothy Stack's avatar
 
Timothy Stack committed
144
tmcc-nossl-debug: tmcc.c decls.h
Mike Hibler's avatar
Mike Hibler committed
145
	$(CC) $(CFLAGS) $(LDSTATIC) -g -o $@ $< $(LFLAGS) $(TMSLIBS)
146

Timothy Stack's avatar
 
Timothy Stack committed
147
findif-debug: findif.o
Mike Hibler's avatar
Mike Hibler committed
148
	$(CC) $(CFLAGS) -g -o $@ findif.o $(LFLAGS) $(LDSTATIC)
149

150 151 152
dostype-debug: dostype.o
	$(CC) $(CFLAGS) -g -o $@ dostype.o $(LFLAGS)

153
ssl.o:	ssl.c ssl.h decls.h
154

155 156 157 158 159 160 161 162
tpm.o:	tpm.c tpm.h
	$(CC) -c $(CFLAGS) $(TESTBED_SRCDIR)/tmcd/tpm.c \
		-I$(TESTBED_SRCDIR)/tmcd/

notpm: tpm.c tpm.h
	$(CC) -c $(CFLAGS) -DTPMOVERRIDE $(TESTBED_SRCDIR)/tmcd/tpm.c \
		-I$(TESTBED_SRCDIR)/tmcd/

163 164 165
version.c: tmcd.c
	echo >$@ "char build_info[] = \"Built `date +%d-%b-%Y` by `id -nu`@`hostname | sed 's/\..*//'`:`pwd`\";"

166 167
install:	all

168
install:	$(INSTALL_SBINDIR)/tmcd \
169
		$(INSTALL_SBINDIR)/tmcd.restart \
170 171
		$(INSTALL_SBINDIR)/findif \
		elabinelabfiles
172

173
control-install: tmcc
174
	@$(MAKE) -C freebsd control-install
175

176 177 178 179
subboss-install: client
	@$(MAKE) -C $(MDSUBDIR) install
	@$(MAKE) -C common subboss-install

180
client-install: client
Mike Hibler's avatar
Mike Hibler committed
181
	@$(MAKE) -C $(MDSUBDIR) install
182

183 184 185 186 187 188 189 190 191
#
# XXX argh!  assumes FreeBSD inner boss
#
elabinelabfiles:
	$(INSTALL_PROGRAM) $(SRCDIR)/common/config/rc.mkelab \
			   $(INSTALL_ETCDIR)/rc.mkelab
	$(INSTALL_PROGRAM) $(SRCDIR)/freebsd/mkextrafs.pl \
			   $(INSTALL_ETCDIR)/mkextrafs.pl

Mike Hibler's avatar
Mike Hibler committed
192 193 194 195 196
mfs: client

mfs-install: mfs
	@$(MAKE) -C $(MDSUBDIR) mfs-install

197 198 199 200 201
frisbee-mfs: client

frisbee-mfs-install: frisbee-mfs
	@$(MAKE) -C $(MDSUBDIR) frisbee-mfs-install

202 203 204 205 206
$(INSTALL_BINDIR)/tmcd/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_BINDIR)/tmcd
	$(INSTALL_PROGRAM) $< $@

207 208 209 210 211 212 213 214 215
#
# Here so that the event system libraries, and libraries they depend upon,
# can get made.
#
${OBJDIR}/event/lib/%:
	cd ${OBJDIR}/event/lib && gmake $<
${OBJDIR}/lib/libtb/%:
	cd ${OBJDIR}/lib/tbdb && gmake $<

Mike Hibler's avatar
Mike Hibler committed
216
clean:	subdir-clean
Mike Hibler's avatar
Mike Hibler committed
217
	rm -f *.o core tmcd tmcc tmcc-nossl findif dostype *-debug version.c
Mike Hibler's avatar
Mike Hibler committed
218 219 220

subdir-clean:
	@$(MAKE) -C $(MDSUBDIR) clean