GNUmakefile.in 3.56 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
ifeq ($(NOSTATIC),)
45
NEEDKERB := $(shell nm /usr/lib/libssl.a | grep -q krb; echo $$?)
46 47 48
else
NEEDKERB := 1
endif
49 50 51 52
ifeq ($(NEEDKERB),0)
 CFLAGS   += `/usr/kerberos/bin/krb5-config --cflags`
 TMLIBS   += `/usr/kerberos/bin/krb5-config --libs krb5`
endif
53
TMLIBS  += -ldl
54 55 56
ifeq ($(RHLVERSION),Linux9)
MDSUBDIR  = linux9
else
Mike Hibler's avatar
Mike Hibler committed
57 58
MDSUBDIR  = linux
endif
59
endif
60

Mike Hibler's avatar
Mike Hibler committed
61
ifeq ($(SYSTEM),FreeBSD)
62
FBSDVERSION    := $(shell uname -v | sed -e 's/FreeBSD \([0-9]\).*/freebsd\1/')
Mike Hibler's avatar
Mike Hibler committed
63 64 65
ifeq ($(FBSDVERSION),freebsd4)
MDSUBDIR  = freebsd
else
66
MDSUBDIR  = $(FBSDVERSION)
67
endif
Mike Hibler's avatar
Mike Hibler committed
68
endif
69

70 71 72
ifeq ($(SYSTEM),CYGWIN_NT-5.1)
# Cygwin on  Windows XP (a.k.a. NT 5.1) - resembles the Linux case.
MDSUBDIR  = cygwinxp
73
TMSLIBS   += -lminires
74 75
endif

Kirk Webb's avatar
 
Kirk Webb committed
76 77 78 79
ifeq ($(host_cpu),arm)
MDSUBDIR  = linux-sg
endif

80
ifeq ($(EVENTSYS),1)
81
	TMCDCFLAGS  = -I$(TESTBED_SRCDIR)/event/lib -DEVENTSYS
82
	TMCDLIBS    = ${OBJDIR}/event/lib/libevent.a
83
	ELVINFLAGS  = -lm -L/usr/local/lib -lpubsub 
84
endif
85

86
tmcd: tmcd.c ${TMCDLIBS} decls.h version.o $(SSLOBJ)
87
	$(CC) $(CFLAGS) $(SSLFLAGS) $(TMCDCFLAGS) -o tmcd $< \
88 89 90
		version.o $(SSLOBJ) \
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient \
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS) 
91

92
tmcc: tmcc.c decls.h $(SSLOBJ)
Mike Hibler's avatar
Mike Hibler committed
93
	$(CC) $(CFLAGS) $(SSLFLAGS) $(LDSTATIC) -g -o tmcc $< $(SSLOBJ) \
94 95
		$(LFLAGS) $(TMLIBS)

96 97 98 99
tmcc-shared: tmcc.c decls.h $(SSLOBJ)
	$(CC) $(CFLAGS) $(SSLFLAGS) -g -o tmcc $< $(SSLOBJ) \
		$(LFLAGS) $(TMLIBS)

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

Timothy Stack's avatar
 
Timothy Stack committed
103
findif-debug: findif.o
Mike Hibler's avatar
Mike Hibler committed
104
	$(CC) $(CFLAGS) -g -o $@ findif.o $(LFLAGS) $(LDSTATIC)
105

106 107 108
dostype-debug: dostype.o
	$(CC) $(CFLAGS) -g -o $@ dostype.o $(LFLAGS)

109
ssl.o:	ssl.c ssl.h decls.h
110

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

114 115
install:	all

116 117
install:	$(INSTALL_SBINDIR)/tmcd \
		$(INSTALL_SBINDIR)/tmcd.restart
118 119
	$(INSTALL_PROGRAM) $(SRCDIR)/common/config/rc.mkelab \
			   $(INSTALL_ETCDIR)/rc.mkelab
120

121
control-install: tmcc
122
	@$(MAKE) -C freebsd control-install
123

124
client-install: client
Mike Hibler's avatar
Mike Hibler committed
125
	@$(MAKE) -C $(MDSUBDIR) install
126

Mike Hibler's avatar
Mike Hibler committed
127 128 129 130 131
mfs: client

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

132 133 134 135 136
frisbee-mfs: client

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

137 138 139 140 141
$(INSTALL_BINDIR)/tmcd/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_BINDIR)/tmcd
	$(INSTALL_PROGRAM) $< $@

142 143 144 145 146 147 148 149 150
#
# 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
151
clean:	subdir-clean
Mike Hibler's avatar
Mike Hibler committed
152
	rm -f *.o core tmcd tmcc tmcc-nossl findif dostype *-debug version.c
Mike Hibler's avatar
Mike Hibler committed
153 154 155

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