GNUmakefile.in 3.8 KB
Newer Older
1
#
2
# EMULAB-COPYRIGHT
Mike Hibler's avatar
Mike Hibler committed
3
# Copyright (c) 2000-2007 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

12 13
SYSTEM	       := $(shell uname -s)

14
include $(OBJDIR)/Makeconf
15

Mike Hibler's avatar
Mike Hibler committed
16 17 18 19 20 21 22
ifeq ($(NOSTATIC),)
# for now we link everything static
LDSTATIC	= -static
else
LDSTATIC	= 
endif

23 24
all:	server fullclient client
fullclient: tmcc
25
client: tmcc-nossl findif dostype
26
server: tmcd tmcd.restart
27

28
include $(TESTBED_SRCDIR)/GNUmakerules
29

30 31 32 33 34 35 36
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
#
37 38
CFLAGS	+= -DETCDIR='"$(INSTALL_ETCDIR)"'
SSLFLAGS = -DWITHSSL 
39 40
TMLIBS	+= -lssl -lcrypto
SSLOBJ   = ssl.o
41

42
ifeq ($(SYSTEM),Linux)
43
RHLVERSION    := $(shell cat /etc/redhat-release | sed -e 's/Red Hat Linux release \([0-9]\).*/Linux\1/')
44 45 46
ifeq ($(RHLVERSION),)
RHLVERSION    := $(shell cat /etc/redhat-release | sed -e 's/Fedora Core release \([0-9]\).*/Fedora\1/')
endif
47
ifeq ($(NOSTATIC),)
48
NEEDKERB := $(shell nm /usr/lib/libssl.a | grep -q krb; echo $$?)
49 50 51
else
NEEDKERB := 1
endif
52 53 54 55
ifeq ($(NEEDKERB),0)
 CFLAGS   += `/usr/kerberos/bin/krb5-config --cflags`
 TMLIBS   += `/usr/kerberos/bin/krb5-config --libs krb5`
endif
56
TMLIBS  += -ldl
57 58 59
ifeq ($(findstring Fedora,$(RHLVERSION)),Fedora)
MDSUBDIR  = fedora
else
60 61 62
ifeq ($(RHLVERSION),Linux9)
MDSUBDIR  = linux9
else
Mike Hibler's avatar
Mike Hibler committed
63 64
MDSUBDIR  = linux
endif
65
endif
66
endif
67

Mike Hibler's avatar
Mike Hibler committed
68
ifeq ($(SYSTEM),FreeBSD)
69
FBSDVERSION    := $(shell uname -v | sed -e 's/FreeBSD \([0-9]\).*/freebsd\1/')
Mike Hibler's avatar
Mike Hibler committed
70 71 72
ifeq ($(FBSDVERSION),freebsd4)
MDSUBDIR  = freebsd
else
73
MDSUBDIR  = $(FBSDVERSION)
74
endif
Mike Hibler's avatar
Mike Hibler committed
75
endif
76

77 78 79
ifeq ($(SYSTEM),CYGWIN_NT-5.1)
# Cygwin on  Windows XP (a.k.a. NT 5.1) - resembles the Linux case.
MDSUBDIR  = cygwinxp
80
TMSLIBS   += -lminires
81 82
endif

Kirk Webb's avatar
 
Kirk Webb committed
83 84 85 86
ifeq ($(host_cpu),arm)
MDSUBDIR  = linux-sg
endif

87
ifeq ($(EVENTSYS),1)
88
	TMCDCFLAGS  = -I$(TESTBED_SRCDIR)/event/lib -DEVENTSYS
89
	TMCDLIBS    = ${OBJDIR}/event/lib/libevent.a
90
	ELVINFLAGS  = -lm -L/usr/local/lib -lpubsub 
91
endif
92

93
tmcd: tmcd.c ${TMCDLIBS} decls.h version.o $(SSLOBJ)
94
	$(CC) $(CFLAGS) $(SSLFLAGS) $(TMCDCFLAGS) -o tmcd $< \
95 96 97
		version.o $(SSLOBJ) \
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient \
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS) 
98

99
tmcc: tmcc.c decls.h $(SSLOBJ)
Mike Hibler's avatar
Mike Hibler committed
100
	$(CC) $(CFLAGS) $(SSLFLAGS) $(LDSTATIC) -g -o tmcc $< $(SSLOBJ) \
101 102
		$(LFLAGS) $(TMLIBS)

103 104 105 106
tmcc-shared: tmcc.c decls.h $(SSLOBJ)
	$(CC) $(CFLAGS) $(SSLFLAGS) -g -o tmcc $< $(SSLOBJ) \
		$(LFLAGS) $(TMLIBS)

Timothy Stack's avatar
 
Timothy Stack committed
107
tmcc-nossl-debug: tmcc.c decls.h
Mike Hibler's avatar
Mike Hibler committed
108
	$(CC) $(CFLAGS) $(LDSTATIC) -g -o $@ $< $(LFLAGS) $(TMSLIBS)
109

Timothy Stack's avatar
 
Timothy Stack committed
110
findif-debug: findif.o
Mike Hibler's avatar
Mike Hibler committed
111
	$(CC) $(CFLAGS) -g -o $@ findif.o $(LFLAGS) $(LDSTATIC)
112

113 114 115
dostype-debug: dostype.o
	$(CC) $(CFLAGS) -g -o $@ dostype.o $(LFLAGS)

116
ssl.o:	ssl.c ssl.h decls.h
117

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

121 122
install:	all

123
install:	$(INSTALL_SBINDIR)/tmcd \
124 125
		$(INSTALL_SBINDIR)/tmcd.restart \
		$(INSTALL_SBINDIR)/findif
126 127
	$(INSTALL_PROGRAM) $(SRCDIR)/common/config/rc.mkelab \
			   $(INSTALL_ETCDIR)/rc.mkelab
128

129
control-install: tmcc
130
	@$(MAKE) -C freebsd control-install
131

132
client-install: client
Mike Hibler's avatar
Mike Hibler committed
133
	@$(MAKE) -C $(MDSUBDIR) install
134

Mike Hibler's avatar
Mike Hibler committed
135 136 137 138 139
mfs: client

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

140 141 142 143 144
frisbee-mfs: client

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

145 146 147 148 149
$(INSTALL_BINDIR)/tmcd/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_BINDIR)/tmcd
	$(INSTALL_PROGRAM) $< $@

150 151 152 153 154 155 156 157 158
#
# 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
159
clean:	subdir-clean
Mike Hibler's avatar
Mike Hibler committed
160
	rm -f *.o core tmcd tmcc tmcc-nossl findif dostype *-debug version.c
Mike Hibler's avatar
Mike Hibler committed
161 162 163

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