GNUmakefile.in 4.24 KB
Newer Older
1
#
2
# Copyright (c) 2000-2014 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
SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
25
EVENTSYS	= @EVENTSYS@
26 27
OBJDIR		= ..
SUBDIR		= tmcd
28
SYSTEM	       := $(shell $(TESTBED_SRCDIR)/utils/osstuff.sh -o)
29

30
include $(OBJDIR)/Makeconf
31

32
all:	server
33
server: tmcd tmcd.restart Ec2MetaServer.py
34

35
# For VPATH.
36 37
MOSTLY_SRCDIRS = ${TESTBED_LIBSRCDIR}/libtb ${TESTBED_SRCDIR}/pxe \
		 ${TESTBED_LIBSRCDIR}/tmcd
38

39
include $(TESTBED_SRCDIR)/GNUmakerules
40

41
CFLAGS	+= -O -g -Wall -DUDP \
Leigh B. Stoller's avatar
Leigh B. Stoller committed
42
		-I${OBJDIR} -I/usr/local/include \
43 44
		-I${TESTBED_LIBSRCDIR}/libtb -I${TESTBED_SRCDIR}/pxe \
		-I${TESTBED_LIBSRCDIR}/tmcd \
45
		-L/usr/local/lib
46
TMLIBS	 = ${TESTBED_LIBOBJDIR}/libtb/libtb.a
Leigh B. Stoller's avatar
Leigh B. Stoller committed
47
BOOTINFO = ${OBJDIR}/pxe/bootinfo.o ${OBJDIR}/pxe/bootinfo_mysql.o
48
LDFLAGS += $(LDSTATIC)
49 50 51 52

#
# For SSL enabled tmcd/tmcc
#
53 54
CFLAGS	+= -DETCDIR='"$(INSTALL_ETCDIR)"'
SSLFLAGS = -DWITHSSL 
55
TMLIBS	+= -lssl -lcrypto -lcrypt
56
NOTPMLIB = ${TESTBED_LIBOBJDIR}/tmcd/libtmcd.a
57

58
ifeq ($(SYSTEM),Linux)
59 60
ifneq ($(LDSTATIC),)
NOKERB := $(shell nm /usr/lib/libssl.a | grep -q krb; echo $$?)
61
else
62 63 64 65 66 67 68
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
69
endif
70
endif
71
TMLIBS  += -ldl
72 73
endif

74
ifeq ($(EVENTSYS),1)
75 76 77
TMCDCFLAGS  = -I$(TESTBED_LIBSRCDIR)/event -DEVENTSYS
TMCDLIBS    = ${TESTBED_LIBOBJDIR}/event/libevent.a
ELVINFLAGS  = -lm -L/usr/local/lib -lpubsub 
78
endif
79

80
tmcd: tmcd.c ${TMCDLIBS} tmcd.h version.o $(BOOTINFO) $(NOTPMLIB)
81
	$(CC) $(TMCDCFLAGS) $(CFLAGS) $(SSLFLAGS) -o tmcd $< \
82
		version.o $(NOTPMLIB) $(BOOTINFO) \
83 84
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient \
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS) 
85

86 87
mod_tmcd.so: libtmcd.o
	apxs -c mod_tmcd.c -L/usr/local/lib/mysqlclient -lmysqlclient \
88 89
		-L /usr/local/lib -lxml2 \
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(NOTPMLIB) $(TMLIBS) $<
90

91 92
newtmcd: newtmcd.c libtmcd.o ${TMCDLIBS} tmcd.h version.o \
	$(NOTPMLIB) $(BOOTINFO)
93
	$(CC) $(TMCDCFLAGS) $(CFLAGS) $(SSLFLAGS) -o tmcd $< \
94
		libtmcd.o version.o $(NOTPMLIB) $(BOOTINFO) \
95 96 97
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient  -lxml2 \
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS) 

98
libtmcd.o: libtmcd.c ${TMCDLIBS} tmcd.h version.o $(BOOTINFO)
99 100
	$(CC) $(TMCDCFLAGS) $(CFLAGS) $(SSLFLAGS) \
		-I/usr/local/include/libxml2 -c -o libtmcd.o $< 
101

102
libtmcd.so: libtmcd.o ${TMCDLIBS} tmcd.h $(BOOTINFO)
103
	$(LD) -shared $^ -L/usr/local/lib/mysql -lxml2 -lmysqlclient \
104
		$(TMCDLIBS) $(ELVINFLAGS) $(TESTBED_LIBOBJDIR)/libtb/libtb.a \
105 106
		-o $@

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

110 111
install:	all

112
install:	$(INSTALL_SBINDIR)/tmcd \
113 114
		$(INSTALL_SBINDIR)/tmcd.restart \
        $(INSTALL_SBINDIR)/Ec2MetaServer.py
115

116 117 118 119
control-install:
boss-install: install
subboss-install:
client-install:
120

121 122 123 124 125
$(INSTALL_BINDIR)/tmcd/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_BINDIR)/tmcd
	$(INSTALL_PROGRAM) $< $@

126 127 128 129 130 131
# XXX using ${OBJDIR}/pxe/% didn't seem to work
${OBJDIR}/pxe/bootinfo.o:
	cd ${OBJDIR}/pxe && gmake bootinfo.o
${OBJDIR}/pxe/bootinfo_mysql.o:
	cd ${OBJDIR}/pxe && gmake bootinfo_mysql.o

132 133 134 135
#
# Here so that the event system libraries, and libraries they depend upon,
# can get made.
#
136 137 138 139 140 141
${TESTBED_LIBOBJDIR}/event/%:
	cd ${TESTBED_LIBOBJDIR}/event && gmake $<
${TESTBED_LIBOBJDIR}/libtb/%:
	cd ${TESTBED_LIBOBJDIR}/tbdb && gmake $<
${TESTBED_LIBOBJDIR}/tmcd/%:
	cd ${TESTBED_LIBOBJDIR}/tmcd && gmake $<
142

Leigh B Stoller's avatar
Leigh B Stoller committed
143
clean:
144
	rm -f *.o core tmcd *-debug version.c