GNUmakefile.in 2.09 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#

SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
OBJDIR		= ../..
SUBDIR		= event/linktest
11 12 13
LIBTBDIR    = $(OBJDIR)/lib/libtb
LIBEVENTDIR = ../lib
DAEMON	        = linktest
14
LTEVENT		= ltevent
15
SCRIPT		= linktest.pl
16
SCRIPT_RUN	= run_linktest.pl
17 18 19 20 21

SYSTEM	       := $(shell uname -s)

include $(OBJDIR)/Makeconf

22
all:	$(DAEMON) $(LTEVENT) $(SCRIPT) $(SCRIPT_RUN)
23 24 25 26 27 28 29 30 31

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
32
LIBS     += -levent -lcrypto -lssl
33 34 35
LIBS     += `elvin-config --libs vin4c`
ifeq ($(SYSTEM),Linux)
LIBS     += -ldl
36
LOCAL_BINDIR	= linux
37 38
endif

39 40 41 42 43 44 45
ifeq ($(SYSTEM),FreeBSD)
LOCAL_BINDIR	= fbsd
endif


LIBTB_OBJS	= $(LIBTBDIR)/log.o $(LIBTBDIR)/tbdefs.o
DAEMON_OBJS	= linktest.o
46
LTEVENT_OBJS	= ltevent.o
47 48 49 50 51 52 53 54

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

56

57 58 59
$(DAEMON):	$(DAEMON_OBJS) $(LIBTB_OBJS)
	-mkdir $(LOCAL_BINDIR)
	$(CC) $(LDFLAGS) $(DAEMON_OBJS) $(LIBTB_OBJS) $(LIBS) -o $(LOCAL_BINDIR)/$@
60

61 62 63 64
$(LTEVENT):	$(LTEVENT_OBJS) $(LIBTB_OBJS)
	-mkdir $(LOCAL_BINDIR)
	$(CC) $(LDFLAGS) $(LTEVENT_OBJS) $(LIBTB_OBJS) $(LIBS) -o $(LOCAL_BINDIR)/$@

65
$(DAEMON_OBJS):	linktest.h ../lib/libevent.a ../lib/event.h
66

67 68
$(LTEVENT_OBJS): ../lib/libevent.a ../lib/event.h

69 70
install:

71 72 73
client-install:
	$(INSTALL_PROGRAM)  $(LOCAL_BINDIR)/$(DAEMON) \
			$(DESTDIR)$(CLIENT_BINDIR)/$(DAEMON)
74 75
	$(INSTALL_PROGRAM)  $(LOCAL_BINDIR)/$(LTEVENT) \
			$(DESTDIR)$(CLIENT_BINDIR)/$(LTEVENT)
76 77
	$(INSTALL_PROGRAM) $(SCRIPT) \
			$(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
78 79
	$(INSTALL_PROGRAM) $(SCRIPT_RUN) \
			$(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_RUN)
80 81 82

clean:
	/bin/rm -f *.o $(TESTS)
83
	/bin/rm -f $(LOCAL_BINDIR)/$(DAEMON)
84 85 86
	/bin/rm -f $(LOCAL_BINDIR)/$(LTEVENT)
	/bin/rm -f $(SCRIPT)
	/bin/rm -f $(SCRIPT_RUN)