GNUmakefile.in 1.85 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
include $(OBJDIR)/Makeconf
11

12 13 14
all:	server client
client: tmcc tmcc-nossl findif
server: tmcd tmcd.restart
15

16
include $(TESTBED_SRCDIR)/GNUmakerules
17

18 19 20 21 22 23 24
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
#
25 26
CFLAGS	+= -DETCDIR='"$(INSTALL_ETCDIR)"'
SSLFLAGS = -DWITHSSL 
27 28
TMLIBS	+= -lssl -lcrypto
SSLOBJ   = ssl.o
29

30
ifeq ($(EVENTSYS),1)
31
	TMCDCFLAGS = `elvin-config --cflags vin4c` \
32
		     -I$(TESTBED_SRCDIR)/event/lib -DEVENTSYS
33
	TMCDLIBS    = ${OBJDIR}/event/lib/libevent.a
34 35
	ELVINFLAGS = `elvin-config --libs vin4c`
endif
36

37
tmcd: tmcd.c ${TMCDLIBS} decls.h version.o $(SSLOBJ)
38
	$(CC) $(CFLAGS) $(SSLFLAGS) $(TMCDCFLAGS) -o tmcd $< \
39 40 41
		version.o $(SSLOBJ) \
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient \
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS) 
42

43 44 45 46 47 48
tmcc: tmcc.c decls.h $(SSLOBJ)
	$(CC) $(CFLAGS) $(SSLFLAGS) -static -g -o tmcc $< $(SSLOBJ) \
		$(LFLAGS) $(TMLIBS)

tmcc-nossl: tmcc.c decls.h
	$(CC) $(CFLAGS) -static -g -o tmcc-nossl $< $(LFLAGS)
49 50 51

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

53
ssl.o:	ssl.c ssl.h decls.h
54

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

58 59
install:	all

60 61
install:	$(INSTALL_SBINDIR)/tmcd \
		$(INSTALL_SBINDIR)/tmcd.restart
62 63 64 65 66 67

$(INSTALL_BINDIR)/tmcd/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_BINDIR)/tmcd
	$(INSTALL_PROGRAM) $< $@

68 69 70 71 72 73 74 75 76
#
# 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 $<

77
clean: 
78
	rm -f *.o core tmcd tmcc tmcc-nossl findif version.c