GNUmakefile.in 2.97 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_TBCOMPAT = tb_compat.tcl
19
SCRIPT_NSTB_COMPAT = nstb_compat.tcl
20
21
22
23
24

SYSTEM	       := $(shell uname -s)

include $(OBJDIR)/Makeconf

25
all:	binaries $(SCRIPT) $(SCRIPT_RUN) weblinktest
26
27
28
29
30
31
32
33
34

include $(TESTBED_SRCDIR)/GNUmakerules

CFLAGS   += -DDEBUG
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
35
LIBS     += -levent -lcrypto -lssl
36
37
LIBS     += `elvin-config --libs vin4c`
ifeq ($(SYSTEM),Linux)
38
39
40
41
42
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
43
LIBS     += -ldl
44
LOCAL_BINDIR	= linux
45
46
endif

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


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

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

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

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

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

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

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

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

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

control-install:	install
87

88
89
90
91
92
93
94
95
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)
96
97

lt-install:
98
	$(INSTALL_PROGRAM) $(SCRIPT) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
99
100

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