GNUmakefile.in 2.43 KB
Newer Older
1 2 3
#
# Insert Copyright Here.
#
4 5
SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
6
EVENTSYS	= @EVENTSYS@
7 8
OBJDIR		= ..
SUBDIR		= tmcd
9

10 11
SYSTEM	       := $(shell uname -s)

12
include $(OBJDIR)/Makeconf
13

14 15 16
all:	server client
client: tmcc tmcc-nossl findif
server: tmcd tmcd.restart
17

18
include $(TESTBED_SRCDIR)/GNUmakerules
19

20 21 22 23 24 25 26
CFLAGS	+= -O -g -Wall -DUDP \
		-I${OBJDIR} -I/usr/local/include -I${TESTBED_SRCDIR}/lib/libtb
TMLIBS	 = ${OBJDIR}/lib/libtb/libtb.a

#
# For SSL enabled tmcd/tmcc
#
27 28
CFLAGS	+= -DETCDIR='"$(INSTALL_ETCDIR)"'
SSLFLAGS = -DWITHSSL 
29 30
TMLIBS	+= -lssl -lcrypto
SSLOBJ   = ssl.o
31
ifeq ($(SYSTEM),Linux)
32 33 34 35 36
NEEDKERB := $(shell nm /usr/lib/libssl.a | grep -q krb; echo $$?)
ifeq ($(NEEDKERB),0)
 CFLAGS   += `/usr/kerberos/bin/krb5-config --cflags`
 TMLIBS   += `/usr/kerberos/bin/krb5-config --libs krb5`
endif
37
TMLIBS  += -ldl
Mike Hibler's avatar
Mike Hibler committed
38 39 40 41
MDSUBDIR  = linux
endif
ifeq ($(SYSTEM),FreeBSD)
MDSUBDIR  = freebsd
42
endif
43

44
ifeq ($(EVENTSYS),1)
45
	TMCDCFLAGS = `elvin-config --cflags vin4c` \
46
		     -I$(TESTBED_SRCDIR)/event/lib -DEVENTSYS
47
	TMCDLIBS    = ${OBJDIR}/event/lib/libevent.a
48 49
	ELVINFLAGS = `elvin-config --libs vin4c`
endif
50

51
tmcd: tmcd.c ${TMCDLIBS} decls.h version.o $(SSLOBJ)
52
	$(CC) $(CFLAGS) $(SSLFLAGS) $(TMCDCFLAGS) -o tmcd $< \
53 54 55
		version.o $(SSLOBJ) \
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient \
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS) 
56

57 58 59 60
tmcc: tmcc.c decls.h $(SSLOBJ)
	$(CC) $(CFLAGS) $(SSLFLAGS) -static -g -o tmcc $< $(SSLOBJ) \
		$(LFLAGS) $(TMLIBS)

61 62 63 64
tmcc-shared: tmcc.c decls.h $(SSLOBJ)
	$(CC) $(CFLAGS) $(SSLFLAGS) -g -o tmcc $< $(SSLOBJ) \
		$(LFLAGS) $(TMLIBS)

65 66
tmcc-nossl: tmcc.c decls.h
	$(CC) $(CFLAGS) -static -g -o tmcc-nossl $< $(LFLAGS)
67 68 69

findif: findif.o
	$(CC) $(CFLAGS) -g -o findif findif.o $(LFLAGS) -static
70

71
ssl.o:	ssl.c ssl.h decls.h
72

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

76 77
install:	all

78 79
install:	$(INSTALL_SBINDIR)/tmcd \
		$(INSTALL_SBINDIR)/tmcd.restart
80

81

82
client-install: tmcc-nossl findif
Mike Hibler's avatar
Mike Hibler committed
83
	@$(MAKE) -C $(MDSUBDIR) install
84

85 86 87 88 89
$(INSTALL_BINDIR)/tmcd/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_BINDIR)/tmcd
	$(INSTALL_PROGRAM) $< $@

90 91 92 93 94 95 96 97 98
#
# 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
99 100 101 102 103
clean:	subdir-clean
	rm -f *.o core tmcd tmcc tmcc-nossl findif version.c

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