GNUmakefile.in 4 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
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
endif
88

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

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

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

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

113 114 115 116
tmcc-shared: tmcc.c decls.h $(SSLOBJ)
	$(CC) $(CFLAGS) $(SSLFLAGS) -g -o tmcc $< $(SSLOBJ) \
		$(LFLAGS) $(TMLIBS)

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

Timothy Stack's avatar
 
Timothy Stack committed
120
findif-debug: findif.o
Mike Hibler's avatar
Mike Hibler committed
121
	$(CC) $(CFLAGS) -g -o $@ findif.o $(LFLAGS) $(LDSTATIC)
122

123 124 125
dostype-debug: dostype.o
	$(CC) $(CFLAGS) -g -o $@ dostype.o $(LFLAGS)

126
ssl.o:	ssl.c ssl.h decls.h
127

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

131 132
install:	all

133
install:	$(INSTALL_SBINDIR)/tmcd \
134 135
		$(INSTALL_SBINDIR)/tmcd.restart \
		$(INSTALL_SBINDIR)/findif
136 137
	$(INSTALL_PROGRAM) $(SRCDIR)/common/config/rc.mkelab \
			   $(INSTALL_ETCDIR)/rc.mkelab
138

139
control-install: tmcc
140
	@$(MAKE) -C freebsd control-install
141

142
client-install: client
Mike Hibler's avatar
Mike Hibler committed
143
	@$(MAKE) -C $(MDSUBDIR) install
144

Mike Hibler's avatar
Mike Hibler committed
145 146 147 148 149
mfs: client

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

150 151 152 153 154
frisbee-mfs: client

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

155 156 157 158 159
$(INSTALL_BINDIR)/tmcd/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_BINDIR)/tmcd
	$(INSTALL_PROGRAM) $< $@

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

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