GNUmakefile.in 3.3 KB
Newer Older
1
#
2
# EMULAB-COPYRIGHT
3
# Copyright (c) 2000-2011 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
SYSTEM	       := $(shell $(TESTBED_SRCDIR)/utils/osstuff.sh -o)
12

13
include $(OBJDIR)/Makeconf
14

15
all:	server
16
server: tmcd tmcd.restart
17

18
# For VPATH.
19 20
MOSTLY_SRCDIRS = ${TESTBED_LIBSRCDIR}/libtb ${TESTBED_SRCDIR}/pxe \
		 ${TESTBED_LIBSRCDIR}/tmcd
21

22
include $(TESTBED_SRCDIR)/GNUmakerules
23

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

#
# For SSL enabled tmcd/tmcc
#
36 37
CFLAGS	+= -DETCDIR='"$(INSTALL_ETCDIR)"'
SSLFLAGS = -DWITHSSL 
38
TMLIBS	+= -lssl -lcrypto
39
NOTPMLIB = ${TESTBED_LIBOBJDIR}/tmcd/libtmcd.a
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
endif

57
ifeq ($(EVENTSYS),1)
58 59
	TMCDCFLAGS  = -I$(TESTBED_LIBSRCDIR)/event -DEVENTSYS
	TMCDLIBS    = ${TESTBED_LIBOBJDIR}/event/libevent.a
60
	ELVINFLAGS  = -lm -L/usr/local/lib -lpubsub 
61
endif
62

63
tmcd: tmcd.c ${TMCDLIBS} tmcd.h version.o $(BOOTINFO) $(NOTPMLIB)
64
	$(CC) $(CFLAGS) $(SSLFLAGS) $(TMCDCFLAGS) -o tmcd $< \
65
		version.o $(NOTPMLIB) $(BOOTINFO) \
66 67
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient \
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS) 
68

69 70
mod_tmcd.so: libtmcd.o
	apxs -c mod_tmcd.c -L/usr/local/lib/mysqlclient -lmysqlclient \
71 72
		-L /usr/local/lib -lxml2 \
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(NOTPMLIB) $(TMLIBS) $<
73

74 75
newtmcd: newtmcd.c libtmcd.o ${TMCDLIBS} tmcd.h version.o \
	$(NOTPMLIB) $(BOOTINFO)
76
	$(CC) $(CFLAGS) $(SSLFLAGS) $(TMCDCFLAGS) -o tmcd $< \
77
		libtmcd.o version.o $(NOTPMLIB) $(BOOTINFO) \
78 79 80
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient  -lxml2 \
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS) 

81
libtmcd.o: libtmcd.c ${TMCDLIBS} tmcd.h version.o $(BOOTINFO)
82
	$(CC) $(CFLAGS) -I/usr/local/include/libxml2 $(SSLFLAGS) \
83
		$(TMCDCFLAGS) -c -o libtmcd.o $< 
84

85
libtmcd.so: libtmcd.o ${TMCDLIBS} tmcd.h $(BOOTINFO)
86
	$(LD) -shared $^ -L/usr/local/lib/mysql -lxml2 -lmysqlclient \
87
		$(TMCDLIBS) $(ELVINFLAGS) $(TESTBED_LIBOBJDIR)/libtb/libtb.a \
88 89
		-o $@

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

93 94
install:	all

95
install:	$(INSTALL_SBINDIR)/tmcd \
96
		$(INSTALL_SBINDIR)/tmcd.restart
97

98 99 100 101
control-install:
boss-install: install
subboss-install:
client-install:
102

103 104 105 106 107
$(INSTALL_BINDIR)/tmcd/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_BINDIR)/tmcd
	$(INSTALL_PROGRAM) $< $@

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

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