GNUmakefile.in 3.22 KB
Newer Older
1
2
#
# EMULAB-COPYRIGHT
3
# Copyright (c) 2000-2004 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
DAEMON	        = linktest
15
LTEVENT		= ltevent
16
SCRIPT		= linktest.pl
17
SCRIPT_RUN	= run_linktest.pl
18
SCRIPT_CONTROL  = linktest_control
19
SCRIPT_TBCOMPAT = tb_compat.tcl
20
SCRIPT_NSTB_COMPAT = nstb_compat.tcl
21
22
23
24
25

SYSTEM	       := $(shell uname -s)

include $(OBJDIR)/Makeconf

26
all:	binaries $(SCRIPT) $(SCRIPT_RUN) weblinktest linktest_control
27
28
29

include $(TESTBED_SRCDIR)/GNUmakerules

30
CFLAGS   += -DDEBUG -DCLIENT_BINDIR='"$(CLIENT_BINDIR)"'
31
32
33
34
35
CFLAGS	 += -O -g -static -Wall
CFLAGS   += -I. -I${OBJDIR} -I$(SRCDIR)/../lib -I$(TESTBED_SRCDIR)/lib/libtb
CFLAGS   += `elvin-config --cflags vin4c`

LDFLAGS  += -static -L../lib -L${OBJDIR}/lib/libtb
36
LIBS     += -levent -lcrypto -lssl
37
38
LIBS     += `elvin-config --libs vin4c`
ifeq ($(SYSTEM),Linux)
39
40
41
42
43
NEEDKERB := $(shell nm /usr/lib/libssl.a | grep -q krb; echo $$?)
ifeq ($(NEEDKERB),0)
 CFLAGS   += `/usr/kerberos/bin/krb5-config --cflags`
 LIBS     += `/usr/kerberos/bin/krb5-config --libs krb5`
endif
44
LIBS     += -ldl
45
LOCAL_BINDIR	= linux
46
47
endif

48
49
50
51
52
53
54
ifeq ($(SYSTEM),FreeBSD)
LOCAL_BINDIR	= fbsd
endif


LIBTB_OBJS	= $(LIBTBDIR)/log.o $(LIBTBDIR)/tbdefs.o
DAEMON_OBJS	= linktest.o
55
LTEVENT_OBJS	= ltevent.o
56
57
58
59
60
61
62
63

# 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)
64

Mike Hibler's avatar
Mike Hibler committed
65
$(LOCAL_BINDIR):
66
	-mkdir -p $(LOCAL_BINDIR)
Mike Hibler's avatar
Mike Hibler committed
67

68
69
70
binaries: $(LOCAL_BINDIR) $(LOCAL_BINDIR)/$(DAEMON) $(LOCAL_BINDIR)/$(LTEVENT) 

$(LOCAL_BINDIR)/$(DAEMON):	$(DAEMON_OBJS) $(LIBTB_OBJS)
71
	$(CC) $(LDFLAGS) $(DAEMON_OBJS) $(LIBTB_OBJS) $(LIBS) -o $@
72

73
$(LOCAL_BINDIR)/$(LTEVENT):	$(LTEVENT_OBJS) $(LIBTB_OBJS)
74
	$(CC) $(LDFLAGS) $(LTEVENT_OBJS) $(LIBTB_OBJS) $(LIBS) -o $@
75

76
$(DAEMON_OBJS):	linktest.h ../lib/libevent.a ../lib/event.h
77

78
79
$(LTEVENT_OBJS): ../lib/libevent.a ../lib/event.h

80
# We install just enough to fire off the test from boss and wait. 
81
install:
82
	$(INSTALL_PROGRAM) $(LOCAL_BINDIR)/$(LTEVENT) $(INSTALL_LIBEXECDIR)
83
	$(INSTALL_PROGRAM) weblinktest $(INSTALL_LIBEXECDIR)
84
	$(INSTALL_PROGRAM) $(SCRIPT_RUN) $(INSTALL_BINDIR)
85
	$(INSTALL_PROGRAM) $(SCRIPT_CONTROL) $(INSTALL_SBINDIR)
86
	$(INSTALL_DATA) $(SRCDIR)/linktest.html $(INSTALL_WWWDIR)/doc
87

88
89
90
control-install:
	$(INSTALL_PROGRAM) $(LOCAL_BINDIR)/$(LTEVENT) $(INSTALL_LIBEXECDIR)
	$(INSTALL_PROGRAM) $(SCRIPT_RUN) $(INSTALL_BINDIR)
91

92
93
94
95
96
97
98
99
client: all
client-install: client
	$(INSTALL_PROGRAM) -s $(LOCAL_BINDIR)/$(DAEMON) $(DESTDIR)$(CLIENT_BINDIR)/$(DAEMON)
	$(INSTALL_PROGRAM) -s $(LOCAL_BINDIR)/$(LTEVENT) $(DESTDIR)$(CLIENT_BINDIR)/$(LTEVENT)
	$(INSTALL_PROGRAM) $(SCRIPT) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
	$(INSTALL_PROGRAM) $(SCRIPT_RUN) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_RUN)
	$(INSTALL_PROGRAM) $(SRCDIR)/$(SCRIPT_TBCOMPAT) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_TBCOMPAT)
	$(INSTALL_PROGRAM) $(NSTOIRDIR)/$(SCRIPT_NSTB_COMPAT) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_NSTB_COMPAT)
100
101

lt-install:
102
	$(INSTALL_PROGRAM) $(SCRIPT) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
103
104

clean:
Mike Hibler's avatar
Mike Hibler committed
105
106
	rm -f *.o $(TESTS)
	rm -rf $(LOCAL_BINDIR)