GNUmakefile.in 2.81 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 fullclient client
fullclient: tmcc
client: tmcc-nossl findif
17
server: tmcd tmcd.restart
18

19
include $(TESTBED_SRCDIR)/GNUmakerules
20

21 22 23 24 25 26 27
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
#
28 29
CFLAGS	+= -DETCDIR='"$(INSTALL_ETCDIR)"'
SSLFLAGS = -DWITHSSL 
30 31
TMLIBS	+= -lssl -lcrypto
SSLOBJ   = ssl.o
32
ifeq ($(SYSTEM),Linux)
33
RHLVERSION    := $(shell cat /etc/redhat-release | sed -e 's/Red Hat Linux release \([0-9]\).*/Linux\1/')
34 35 36 37 38
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
39
TMLIBS  += -ldl
40 41 42
ifeq ($(RHLVERSION),Linux9)
MDSUBDIR  = linux9
else
Mike Hibler's avatar
Mike Hibler committed
43 44
MDSUBDIR  = linux
endif
45
endif
Mike Hibler's avatar
Mike Hibler committed
46
ifeq ($(SYSTEM),FreeBSD)
47 48 49 50
FBSDVERSION    := $(shell uname -v | sed -e 's/FreeBSD \([0-9]\).*/FreeBSD\1/')
ifeq ($(FBSDVERSION),FreeBSD5)
MDSUBDIR  = freebsd5
else
Mike Hibler's avatar
Mike Hibler committed
51
MDSUBDIR  = freebsd
52
endif
53
endif
54

55
ifeq ($(EVENTSYS),1)
56
	TMCDCFLAGS = `elvin-config --cflags vin4c` \
57
		     -I$(TESTBED_SRCDIR)/event/lib -DEVENTSYS
58
	TMCDLIBS    = ${OBJDIR}/event/lib/libevent.a
59 60
	ELVINFLAGS = `elvin-config --libs vin4c`
endif
61

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

68 69 70 71
tmcc: tmcc.c decls.h $(SSLOBJ)
	$(CC) $(CFLAGS) $(SSLFLAGS) -static -g -o tmcc $< $(SSLOBJ) \
		$(LFLAGS) $(TMLIBS)

72 73 74 75
tmcc-shared: tmcc.c decls.h $(SSLOBJ)
	$(CC) $(CFLAGS) $(SSLFLAGS) -g -o tmcc $< $(SSLOBJ) \
		$(LFLAGS) $(TMLIBS)

76 77
tmcc-nossl: tmcc.c decls.h
	$(CC) $(CFLAGS) -static -g -o tmcc-nossl $< $(LFLAGS)
78 79 80

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

82
ssl.o:	ssl.c ssl.h decls.h
83

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

87 88
install:	all

89 90
install:	$(INSTALL_SBINDIR)/tmcd \
		$(INSTALL_SBINDIR)/tmcd.restart
91

92

93
client-install: client
Mike Hibler's avatar
Mike Hibler committed
94
	@$(MAKE) -C $(MDSUBDIR) install
95

Mike Hibler's avatar
Mike Hibler committed
96 97 98 99 100
mfs: client

mfs-install: mfs
	@$(MAKE) -C $(MDSUBDIR) mfs-install

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

106 107 108 109 110 111 112 113 114
#
# 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
115 116 117 118 119
clean:	subdir-clean
	rm -f *.o core tmcd tmcc tmcc-nossl findif version.c

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