GNUmakefile.in 3.46 KB
Newer Older
1
#
2
# Copyright (c) 2000-2018 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 Stoller's avatar
Leigh Stoller committed
42
		-I${OBJDIR} -I/usr/local/include \
43
		-I${TESTBED_LIBSRCDIR}/libtb -I${TESTBED_SRCDIR}/pxe \
44
		-I${TESTBED_SRCDIR}/clientside/os/bootinfo \
45
		-I${TESTBED_LIBSRCDIR}/tmcd
46
TMLIBS	 = ${TESTBED_LIBOBJDIR}/libtb/libtb.a
Leigh Stoller's avatar
Leigh Stoller committed
47
BOOTINFO = ${OBJDIR}/pxe/bootinfo.o ${OBJDIR}/pxe/bootinfo_mysql.o
48
LDFLAGS += -L/usr/local/lib $(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
		$(LDFLAGS) -L/usr/local/lib/mysql -lmysqlclient \
84
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS) 
85

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

89 90
install:	all

91
install:	$(INSTALL_SBINDIR)/tmcd \
92 93
		$(INSTALL_SBINDIR)/tmcd.restart \
        $(INSTALL_SBINDIR)/Ec2MetaServer.py
94

95 96 97 98
control-install:
boss-install: install
subboss-install:
client-install:
99

100 101 102 103 104
$(INSTALL_BINDIR)/tmcd/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_BINDIR)/tmcd
	$(INSTALL_PROGRAM) $< $@

105 106 107 108 109 110
# 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

111 112 113 114
#
# Here so that the event system libraries, and libraries they depend upon,
# can get made.
#
115 116 117 118 119 120
${TESTBED_LIBOBJDIR}/event/%:
	cd ${TESTBED_LIBOBJDIR}/event && gmake $<
${TESTBED_LIBOBJDIR}/libtb/%:
	cd ${TESTBED_LIBOBJDIR}/tbdb && gmake $<
${TESTBED_LIBOBJDIR}/tmcd/%:
	cd ${TESTBED_LIBOBJDIR}/tmcd && gmake $<
121

Leigh Stoller's avatar
Leigh Stoller committed
122
clean:
123
	rm -f *.o core tmcd *-debug version.c