GNUmakefile.in 4.93 KB
Newer Older
1
2
#
# EMULAB-COPYRIGHT
Leigh B. Stoller's avatar
Leigh B. Stoller committed
3
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
4
5
6
7
8
9
10
# All rights reserved.
#

SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
OBJDIR		= ../..
SUBDIR		= event/linktest
11
12
LIBTBDIR    = $(OBJDIR)/lib/libtb
LIBEVENTDIR = ../lib
13
NSTOIRDIR	= $(TESTBED_SRCDIR)/tbsetup/ns2ir
14
15
DAEMON	        = linktest
LTEVENT		= ltevent
16
SCRIPT		= linktest.pl
17
SCRIPT_RUN	= run_linktest.pl
18
SCRIPT_PROXY	= linktest.proxy
19
SCRIPT_CONTROL  = linktest_control
20
SCRIPT_TBCOMPAT = tb_compat.tcl
21
SCRIPT_NSTB_COMPAT = nstb_compat.tcl
22

23
24
25
26
27
28
# These scripts installed setuid, with sudo. 
SETUID_BIN_SCRIPTS   = 
SETUID_SBIN_SCRIPTS  = $(SCRIPT_CONTROL)
SETUID_LIBX_SCRIPTS  = 


29
SYSTEM	       := $(patsubst CYGWIN%,CYGWIN,$(shell uname -s))
30
31
32

include $(OBJDIR)/Makeconf

33
34
all:	binaries $(SCRIPT) $(SCRIPT_RUN) $(SCRIPT_PROXY) \
		weblinktest linktest_control
35
36
37

include $(TESTBED_SRCDIR)/GNUmakerules

38
CFLAGS   += -DDEBUG -DCLIENT_BINDIR='"$(CLIENT_BINDIR)"'
Timothy Stack's avatar
   
Timothy Stack committed
39
CFLAGS	 += -O -g -Wall
40
CFLAGS   += -I. -I${OBJDIR} -I$(SRCDIR)/../lib -I$(TESTBED_SRCDIR)/lib/libtb
41
CFLAGS   += -I/usr/local/include
42

Timothy Stack's avatar
   
Timothy Stack committed
43
LDFLAGS  += -L../lib -L${OBJDIR}/lib/libtb
44
LIBS     += -levent -lcrypto -lssl
45
LIBS     += -L/usr/local/lib -lpubsub -lm
46
LDFLAGS  += $(LDSTATIC)
47
48

# Deal with the presence/absence of kerberos in the linux ssl library
49
ifeq ($(SYSTEM),Linux)
50
51
ifneq ($(LDSTATIC),)
NOKERB := $(shell nm /usr/lib/libssl.a | grep -q krb; echo $$?)
52
else
53
NOKERB := 1
54
endif
55
56
57
ifeq ($(NOKERB),0)
CFLAGS   += `/usr/kerberos/bin/krb5-config --cflags`
LIBS     += `/usr/kerberos/bin/krb5-config --libs krb5`
58
ifneq ($(wildcard /usr/lib/libkrb5support.a),)
59
LIBS     += -lkrb5support
60
endif
Timothy Stack's avatar
   
Timothy Stack committed
61
62
endif
endif
63
64
65

ifeq ($(SYSTEM),Linux)
LIBS     += -ldl -lz
66
endif
67

68
LIBTB_OBJS	= $(LIBTBDIR)/log.o $(LIBTBDIR)/tbdefs.o $(LIBTBDIR)/be_user.o
Timothy Stack's avatar
   
Timothy Stack committed
69
DAEMON_OBJS	= linktest.o version.o
70
LTEVENT_OBJS	= ltevent.o
71
72
73
74
75
76
77
78

# Rules to make sure that some libraries we need from other directories get
# built first
$(LIBTBDIR)/%.o:
	@$(MAKE) -C $(LIBTBDIR) $(@F)

$(LIBEVENTDIR)/%.a:
	@$(MAKE) -C $(LIBEVENTDIR) $(@F)
79

Timothy Stack's avatar
   
Timothy Stack committed
80
binaries: $(DAEMON) $(LTEVENT) 
81

Timothy Stack's avatar
   
Timothy Stack committed
82
$(DAEMON)-debug: $(DAEMON_OBJS) $(LIBTB_OBJS)
83
	$(CC) $(LDFLAGS) $(DAEMON_OBJS) $(LIBTB_OBJS) $(LIBS) -o $@
84

Timothy Stack's avatar
   
Timothy Stack committed
85
$(LTEVENT)-debug: $(LTEVENT_OBJS) $(LIBTB_OBJS)
86
	$(CC) $(LDFLAGS) $(LTEVENT_OBJS) $(LIBTB_OBJS) $(LIBS) -o $@
87

Timothy Stack's avatar
   
Timothy Stack committed
88
89
90
91
version.c: linktest.c
	echo >$@ "char build_info[] = \"Built `date +%d-%b-%Y` by `id -nu`@`hostname | sed 's/\..*//'`:`pwd`\";"

$(DAEMON_OBJS): ../lib/libevent.a ../lib/event.h
92

93
94
$(LTEVENT_OBJS): ../lib/libevent.a ../lib/event.h

95
# We install just enough to fire off the test from boss and wait. 
96
97
install: weblinktest $(SCRIPT_RUN) $(SCRIPT_PROXY) $(LTEVENT) \
		$(INSTALL_SBINDIR)/$(SCRIPT_CONTROL) 
98
	$(INSTALL_PROGRAM) weblinktest $(INSTALL_LIBEXECDIR)
99
100
101
	-mkdir -p $(INSTALL_DIR)/opsdir/bin
	-mkdir -p $(INSTALL_DIR)/opsdir/sbin
	-mkdir -p $(INSTALL_DIR)/opsdir/libexec
102
103
104
105
106
107
	$(INSTALL_PROGRAM) $(SCRIPT_RUN) \
			$(INSTALL_DIR)/opsdir/bin/$(SCRIPT_RUN)
	$(INSTALL_PROGRAM) $(SCRIPT_PROXY) \
			$(INSTALL_DIR)/opsdir/sbin/$(SCRIPT_PROXY)
	$(INSTALL_PROGRAM) $(LTEVENT) \
			$(INSTALL_DIR)/opsdir/libexec/$(LTEVENT)
108
109
110
111
112
	@echo "Don't forget to do a post-install as root"

post-install: 
	chown root $(INSTALL_SBINDIR)/$(SCRIPT_CONTROL)
	chmod u+s $(INSTALL_SBINDIR)/$(SCRIPT_CONTROL)
113

Leigh B. Stoller's avatar
Leigh B. Stoller committed
114
control-install:	binaries $(SCRIPT_RUN) $(SCRIPT_PROXY)
Timothy Stack's avatar
   
Timothy Stack committed
115
	$(INSTALL_PROGRAM) $(LTEVENT) $(INSTALL_LIBEXECDIR)
116
	$(INSTALL_PROGRAM) $(SCRIPT_RUN) $(INSTALL_BINDIR)
117
	$(INSTALL_PROGRAM) $(SCRIPT_PROXY) $(INSTALL_BINDIR)
118

119
client: all
120
	$(MAKE) -C iperf client
121
	$(MAKE) -C rude client
122

123
client-install: client
124
125
126
	@if test ! -x '$(CLIENT_BINDIR)/emulab-rude$(EXE)' -o \
	    	 ! -x '$(CLIENT_BINDIR)/emulab-crude$(EXE)' -o \
		 ! -x '$(CLIENT_BINDIR)/emulab-iperf$(EXE)'; then \
Timothy Stack's avatar
   
Timothy Stack committed
127
128
129
130
131
132
	  echo "**********************************************************"; \
	  echo "*                                                        *"; \
	  echo "* WARNING: Some tools needed by linktest were not found. *"; \
	  echo "*                                                        *"; \
	  echo "* Make sure the following executables are installed:     *"; \
	  echo "*                                                        *"; \
133
134
135
	  echo "*   $(CLIENT_BINDIR)/emulab-rude$(EXE)                   *"; \
	  echo "*   $(CLIENT_BINDIR)/emulab-crude$(EXE)                  *"; \
	  echo "*   $(CLIENT_BINDIR)/emulab-iperf$(EXE)                  *"; \
Timothy Stack's avatar
   
Timothy Stack committed
136
137
138
139
140
	  echo "*                                                        *"; \
	  echo "**********************************************************"; \
	fi
	$(INSTALL_PROGRAM) $(DAEMON) $(DESTDIR)$(CLIENT_BINDIR)/$(DAEMON)
	$(INSTALL_PROGRAM) $(LTEVENT) $(DESTDIR)$(CLIENT_BINDIR)/$(LTEVENT)
141
142
	$(INSTALL_PROGRAM) $(SCRIPT) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
	$(INSTALL_PROGRAM) $(SCRIPT_RUN) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_RUN)
143
	$(MAKE) -C iperf client-install
144
	$(MAKE) -C rude client-install
145
146

clean:
147
148
	rm -f *.o *-debug $(TESTS) $(SCRIPT) $(SCRIPT_RUN) $(SCRIPT_PROXY) \
		weblinktest linktest_control $(DAEMON) $(LTEVENT) version.c
149
	-$(MAKE) -C iperf clean
150
	-$(MAKE) -C rude clean