GNUmakefile.in 3.29 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
all:	server fullclient client
fullclient: tmcc
16
client: tmcc-nossl findif dostype
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

33
ifeq ($(SYSTEM),Linux)
34
RHLVERSION    := $(shell cat /etc/redhat-release | sed -e 's/Red Hat Linux release \([0-9]\).*/Linux\1/')
35 36 37 38 39
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
40
TMLIBS  += -ldl
41 42 43
ifeq ($(RHLVERSION),Linux9)
MDSUBDIR  = linux9
else
Mike Hibler's avatar
Mike Hibler committed
44 45
MDSUBDIR  = linux
endif
46
endif
47

Mike Hibler's avatar
Mike Hibler committed
48
ifeq ($(SYSTEM),FreeBSD)
49 50
FBSDVERSION    := $(shell uname -v | sed -e 's/FreeBSD \([0-9]\).*/freebsd\1/')
MDSUBDIR  = $(FBSDVERSION)
51
endif
52

53 54 55
ifeq ($(SYSTEM),CYGWIN_NT-5.1)
# Cygwin on  Windows XP (a.k.a. NT 5.1) - resembles the Linux case.
MDSUBDIR  = cygwinxp
56
TMSLIBS   += -lminires
57 58
endif

Kirk Webb's avatar
 
Kirk Webb committed
59 60 61 62
ifeq ($(host_cpu),arm)
MDSUBDIR  = linux-sg
endif

63
ifeq ($(EVENTSYS),1)
64
	TMCDCFLAGS = `elvin-config --cflags vin4c` \
65
		     -I$(TESTBED_SRCDIR)/event/lib -DEVENTSYS
66
	TMCDLIBS    = ${OBJDIR}/event/lib/libevent.a
67 68
	ELVINFLAGS = `elvin-config --libs vin4c`
endif
69

70
tmcd: tmcd.c ${TMCDLIBS} decls.h version.o $(SSLOBJ)
71
	$(CC) $(CFLAGS) $(SSLFLAGS) $(TMCDCFLAGS) -o tmcd $< \
72 73 74
		version.o $(SSLOBJ) \
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient \
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS) 
75

76 77 78 79
tmcc: tmcc.c decls.h $(SSLOBJ)
	$(CC) $(CFLAGS) $(SSLFLAGS) -static -g -o tmcc $< $(SSLOBJ) \
		$(LFLAGS) $(TMLIBS)

80 81 82 83
tmcc-shared: tmcc.c decls.h $(SSLOBJ)
	$(CC) $(CFLAGS) $(SSLFLAGS) -g -o tmcc $< $(SSLOBJ) \
		$(LFLAGS) $(TMLIBS)

Timothy Stack's avatar
 
Timothy Stack committed
84 85
tmcc-nossl-debug: tmcc.c decls.h
	$(CC) $(CFLAGS) -static -g -o $@ $< $(LFLAGS) $(TMSLIBS)
86

Timothy Stack's avatar
 
Timothy Stack committed
87 88
findif-debug: findif.o
	$(CC) $(CFLAGS) -g -o $@ findif.o $(LFLAGS) -static
89

90 91 92
dostype-debug: dostype.o
	$(CC) $(CFLAGS) -g -o $@ dostype.o $(LFLAGS)

93
ssl.o:	ssl.c ssl.h decls.h
94

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

98 99
install:	all

100 101
install:	$(INSTALL_SBINDIR)/tmcd \
		$(INSTALL_SBINDIR)/tmcd.restart
102 103
	$(INSTALL_PROGRAM) $(SRCDIR)/common/config/rc.mkelab \
			   $(INSTALL_ETCDIR)/rc.mkelab
104

105
control-install: tmcc
106
	@$(MAKE) -C freebsd control-install
107

108
client-install: client
Mike Hibler's avatar
Mike Hibler committed
109
	@$(MAKE) -C $(MDSUBDIR) install
110

Mike Hibler's avatar
Mike Hibler committed
111 112 113 114 115
mfs: client

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

116 117 118 119 120
frisbee-mfs: client

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

121 122 123 124 125
$(INSTALL_BINDIR)/tmcd/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_BINDIR)/tmcd
	$(INSTALL_PROGRAM) $< $@

126 127 128 129 130 131 132 133 134
#
# 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
135
clean:	subdir-clean
136
	rm -f *.o core tmcd tmcc tmcc-nossl findif dostype version.c
Mike Hibler's avatar
Mike Hibler committed
137 138 139

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