GNUmakefile.in 4.06 KB
Newer Older
1
#
2
# EMULAB-COPYRIGHT
Mike Hibler's avatar
Mike Hibler committed
3
# Copyright (c) 2000-2007 , 2008University 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
SYSTEM	       := $(shell $(TESTBED_SRCDIR)/utils/osstuff.sh -o)
13

14
include $(OBJDIR)/Makeconf
15

16 17
all:	server fullclient client
fullclient: tmcc
18
client: tmcc-nossl findif dostype
19
server: tmcd tmcd.restart
20

21
include $(TESTBED_SRCDIR)/GNUmakerules
22

23
CFLAGS	+= -O -g -Wall -DUDP \
Leigh B. Stoller's avatar
Leigh B. Stoller committed
24 25
		-I${OBJDIR} -I/usr/local/include \
		-I${TESTBED_SRCDIR}/lib/libtb -I${TESTBED_SRCDIR}/pxe
26
TMLIBS	 = ${OBJDIR}/lib/libtb/libtb.a
Leigh B. Stoller's avatar
Leigh B. Stoller committed
27
BOOTINFO = ${OBJDIR}/pxe/bootinfo.o ${OBJDIR}/pxe/bootinfo_mysql.o
28
LDFLAGS += $(LDSTATIC)
29 30 31 32

#
# For SSL enabled tmcd/tmcc
#
33 34
CFLAGS	+= -DETCDIR='"$(INSTALL_ETCDIR)"'
SSLFLAGS = -DWITHSSL 
35 36
TMLIBS	+= -lssl -lcrypto
SSLOBJ   = ssl.o
37

38
ifeq ($(SYSTEM),Linux)
39 40
ifneq ($(LDSTATIC),)
NOKERB := $(shell nm /usr/lib/libssl.a | grep -q krb; echo $$?)
41
else
42 43 44 45 46 47 48
NOKERB := 1
endif
ifeq ($(NOKERB),0)
CFLAGS   += `/usr/kerberos/bin/krb5-config --cflags`
TMLIBS   += `/usr/kerberos/bin/krb5-config --libs krb5`
ifneq ($(wildcard /usr/lib/libkrb5support.a),)
TMLIBS     += -lkrb5support
49
endif
50
endif
51
TMLIBS  += -ldl
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
endif

#
# Take care of historic naming fubars:
#	Redhat 7.x ->  linux
#	Redhat 9.0 ->  linux9
#	Fedora 4/6 ->  fedora
#	Stargate 1  -> linux-sg
#	FreeBSD 4.x -> freebsd
#	Windows XP  -> cygwinxp
#
MDSUBDIR  := $(shell $(TESTBED_SRCDIR)/utils/osstuff.sh -t)

ifeq ($(SYSTEM),Linux)
ifeq ($(MDSUBDIR),redhat7)
Mike Hibler's avatar
Mike Hibler committed
67 68
MDSUBDIR  = linux
endif
69 70 71 72 73 74
ifeq ($(MDSUBDIR),redhat9)
MDSUBDIR  = linux9
endif
ifeq ($(findstring fedora,$(MDSUBDIR)),fedora)
MDSUBDIR  = fedora
endif
75 76 77
ifeq ($(findstring centos,$(MDSUBDIR)),centos)
MDSUBDIR  = fedora
endif
78 79
ifeq ($(MDSUBDIR),stargate1)
MDSUBDIR  = linux-sg
80
endif
81
endif
82

Mike Hibler's avatar
Mike Hibler committed
83
ifeq ($(SYSTEM),FreeBSD)
84
ifeq ($(MDSUBDIR),freebsd4)
Mike Hibler's avatar
Mike Hibler committed
85
MDSUBDIR  = freebsd
86
endif
Mike Hibler's avatar
Mike Hibler committed
87 88 89
ifeq ($(MDSUBDIR),freebsd8)
MDSUBDIR  = freebsd7
endif
Mike Hibler's avatar
Mike Hibler committed
90
endif
91

92
ifeq ($(SYSTEM),Cygwin)
93
# Cygwin on  Windows XP (a.k.a. NT 5.1) - resembles the Linux case.
94
ifeq ($(MDSUBDIR),CYGWIN_NT-5.1)
95
MDSUBDIR  = cygwinxp
96
TMSLIBS   += -lminires
97
endif
Kirk Webb's avatar
 
Kirk Webb committed
98 99
endif

100
ifeq ($(EVENTSYS),1)
101
	TMCDCFLAGS  = -I$(TESTBED_SRCDIR)/event/lib -DEVENTSYS
102
	TMCDLIBS    = ${OBJDIR}/event/lib/libevent.a
103
	ELVINFLAGS  = -lm -L/usr/local/lib -lpubsub 
104
endif
105

Leigh B. Stoller's avatar
Leigh B. Stoller committed
106
tmcd: tmcd.c ${TMCDLIBS} decls.h version.o $(SSLOBJ) $(BOOTINFO)
107
	$(CC) $(CFLAGS) $(SSLFLAGS) $(TMCDCFLAGS) -o tmcd $< \
Leigh B. Stoller's avatar
Leigh B. Stoller committed
108
		version.o $(SSLOBJ) $(BOOTINFO) \
109 110
		$(LFLAGS) -L/usr/local/lib/mysql -lmysqlclient \
		$(ELVINFLAGS) $(TMCDLDFLAGS) $(TMCDLIBS) $(TMLIBS) 
111

112
tmcc: tmcc.c decls.h $(SSLOBJ)
Mike Hibler's avatar
Mike Hibler committed
113
	$(CC) $(CFLAGS) $(SSLFLAGS) $(LDSTATIC) -g -o tmcc $< $(SSLOBJ) \
114 115
		$(LFLAGS) $(TMLIBS)

116 117 118 119
tmcc-shared: tmcc.c decls.h $(SSLOBJ)
	$(CC) $(CFLAGS) $(SSLFLAGS) -g -o tmcc $< $(SSLOBJ) \
		$(LFLAGS) $(TMLIBS)

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

Timothy Stack's avatar
 
Timothy Stack committed
123
findif-debug: findif.o
Mike Hibler's avatar
Mike Hibler committed
124
	$(CC) $(CFLAGS) -g -o $@ findif.o $(LFLAGS) $(LDSTATIC)
125

126 127 128
dostype-debug: dostype.o
	$(CC) $(CFLAGS) -g -o $@ dostype.o $(LFLAGS)

129
ssl.o:	ssl.c ssl.h decls.h
130

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

134 135
install:	all

136
install:	$(INSTALL_SBINDIR)/tmcd \
137 138
		$(INSTALL_SBINDIR)/tmcd.restart \
		$(INSTALL_SBINDIR)/findif
139 140
	$(INSTALL_PROGRAM) $(SRCDIR)/common/config/rc.mkelab \
			   $(INSTALL_ETCDIR)/rc.mkelab
141

142
control-install: tmcc
143
	@$(MAKE) -C freebsd control-install
144

145
client-install: client
Mike Hibler's avatar
Mike Hibler committed
146
	@$(MAKE) -C $(MDSUBDIR) install
147

Mike Hibler's avatar
Mike Hibler committed
148 149 150 151 152
mfs: client

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

153 154 155 156 157
frisbee-mfs: client

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

158 159 160 161 162
$(INSTALL_BINDIR)/tmcd/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_BINDIR)/tmcd
	$(INSTALL_PROGRAM) $< $@

163 164 165 166 167 168 169 170 171
#
# 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
172
clean:	subdir-clean
Mike Hibler's avatar
Mike Hibler committed
173
	rm -f *.o core tmcd tmcc tmcc-nossl findif dostype *-debug version.c
Mike Hibler's avatar
Mike Hibler committed
174 175 176

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