GNUmakefile.in 2.81 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
38
LIBS     += `elvin-config --libs vin4c`
ifeq ($(SYSTEM),Linux)
LIBS     += -ldl
39
LOCAL_BINDIR	= linux
40
41
endif

42
43
44
45
46
47
48
ifeq ($(SYSTEM),FreeBSD)
LOCAL_BINDIR	= fbsd
endif


LIBTB_OBJS	= $(LIBTBDIR)/log.o $(LIBTBDIR)/tbdefs.o
DAEMON_OBJS	= linktest.o
49
LTEVENT_OBJS	= ltevent.o
50
51
52
53
54
55
56
57

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

59
binaries: $(LOCAL_BINDIR)/$(DAEMON) $(LOCAL_BINDIR)/$(LTEVENT) 
60

Mike Hibler's avatar
Mike Hibler committed
61
$(LOCAL_BINDIR):
62
	-mkdir -p $(LOCAL_BINDIR)
Mike Hibler's avatar
Mike Hibler committed
63
64

$(LOCAL_BINDIR)/$(DAEMON):	$(LOCAL_BINDIR) $(DAEMON_OBJS) $(LIBTB_OBJS)
65
	$(CC) $(LDFLAGS) $(DAEMON_OBJS) $(LIBTB_OBJS) $(LIBS) -o $@
66

Mike Hibler's avatar
Mike Hibler committed
67
$(LOCAL_BINDIR)/$(LTEVENT):	$(LOCAL_BINDIR) $(LTEVENT_OBJS) $(LIBTB_OBJS)
68
	$(CC) $(LDFLAGS) $(LTEVENT_OBJS) $(LIBTB_OBJS) $(LIBS) -o $@
69

70
$(DAEMON_OBJS):	linktest.h ../lib/libevent.a ../lib/event.h
71

72
73
$(LTEVENT_OBJS): ../lib/libevent.a ../lib/event.h

74
# We install just enough to fire off the test from boss and wait. 
75
install:
76
	$(INSTALL_PROGRAM) $(LOCAL_BINDIR)/$(LTEVENT) $(INSTALL_LIBEXECDIR)
77
	$(INSTALL_PROGRAM) weblinktest $(INSTALL_LIBEXECDIR)
78
	$(INSTALL_PROGRAM) $(SCRIPT_RUN) $(INSTALL_BINDIR)
79
	$(INSTALL_DATA) $(SRCDIR)/linktest.html $(INSTALL_WWWDIR)/doc
80
81

control-install:	install
82

83
84
client-install: all
	$(INSTALL_PROGRAM) -s $(LOCAL_BINDIR)/$(DAEMON) \
85
			$(DESTDIR)$(CLIENT_BINDIR)/$(DAEMON)
86
	$(INSTALL_PROGRAM) -s $(LOCAL_BINDIR)/$(LTEVENT) \
87
			$(DESTDIR)$(CLIENT_BINDIR)/$(LTEVENT)
88
89
	$(INSTALL_PROGRAM) $(SCRIPT) \
			$(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
90
91
	$(INSTALL_PROGRAM) $(SCRIPT_RUN) \
			$(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_RUN)
Mike Hibler's avatar
Mike Hibler committed
92
	$(INSTALL_PROGRAM) $(SRCDIR)/$(SCRIPT_TBCOMPAT) \
93
			$(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_TBCOMPAT)
94
	$(INSTALL_PROGRAM) $(NSTOIRDIR)/$(SCRIPT_NSTB_COMPAT) \
95
96
97
98
99
			$(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_NSTB_COMPAT)

lt-install:
	$(INSTALL_PROGRAM) $(SCRIPT) \
            $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
100
101

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