GNUmakefile.in 2.78 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) $(SCRIPT_TBCOMPAT)
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

61
$(LOCAL_BINDIR)/$(DAEMON):	$(DAEMON_OBJS) $(LIBTB_OBJS)
62
	-mkdir -p $(LOCAL_BINDIR)
63
	$(CC) $(LDFLAGS) $(DAEMON_OBJS) $(LIBTB_OBJS) $(LIBS) -o $@
64

65
$(LOCAL_BINDIR)/$(LTEVENT):	$(LTEVENT_OBJS) $(LIBTB_OBJS)
66
	-mkdir -p $(LOCAL_BINDIR)
67
	$(CC) $(LDFLAGS) $(LTEVENT_OBJS) $(LIBTB_OBJS) $(LIBS) -o $@
68

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

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

73
# We install just enough to fire off the test from boss and wait. 
74
install:
75
76
77
78
	$(INSTALL_PROGRAM) $(LOCAL_BINDIR)/$(LTEVENT) $(INSTALL_LIBEXECDIR)
	$(INSTALL_PROGRAM) $(SCRIPT_RUN) $(INSTALL_BINDIR)

control-install:	install
79

80
81
client-install: all
	$(INSTALL_PROGRAM) -s $(LOCAL_BINDIR)/$(DAEMON) \
82
			$(DESTDIR)$(CLIENT_BINDIR)/$(DAEMON)
83
	$(INSTALL_PROGRAM) -s $(LOCAL_BINDIR)/$(LTEVENT) \
84
			$(DESTDIR)$(CLIENT_BINDIR)/$(LTEVENT)
85
86
	$(INSTALL_PROGRAM) $(SCRIPT) \
			$(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
87
88
	$(INSTALL_PROGRAM) $(SCRIPT_RUN) \
			$(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_RUN)
89
90
	$(INSTALL_PROGRAM) $(SCRIPT_TBCOMPAT) \
			$(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_TBCOMPAT)
91
	$(INSTALL_PROGRAM) $(NSTOIRDIR)/$(SCRIPT_NSTB_COMPAT) \
92
93
94
95
96
			$(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_NSTB_COMPAT)

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

clean:
	/bin/rm -f *.o $(TESTS)
100
	/bin/rm -f $(LOCAL_BINDIR)/$(DAEMON)
101
102
103
	/bin/rm -f $(LOCAL_BINDIR)/$(LTEVENT)
	/bin/rm -f $(SCRIPT)
	/bin/rm -f $(SCRIPT_RUN)