GNUmakefile.in 4.06 KB
Newer Older
1 2
#
# EMULAB-COPYRIGHT
Timothy Stack's avatar
 
Timothy Stack committed
3
# Copyright (c) 2000-2005 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 15
DAEMON	        = linktest
LTEVENT		= ltevent
16
SCRIPT		= linktest.pl
17
SCRIPT_RUN	= run_linktest.pl
18
SCRIPT_PROXY	= linktest.proxy
19
SCRIPT_CONTROL  = linktest_control
20
SCRIPT_TBCOMPAT = tb_compat.tcl
21
SCRIPT_NSTB_COMPAT = nstb_compat.tcl
22

23
SYSTEM	       := $(patsubst CYGWIN%,CYGWIN,$(shell uname -s))
24 25 26

include $(OBJDIR)/Makeconf

27 28
all:	binaries $(SCRIPT) $(SCRIPT_RUN) $(SCRIPT_PROXY) \
		weblinktest linktest_control
29 30 31

include $(TESTBED_SRCDIR)/GNUmakerules

32
CFLAGS   += -DDEBUG -DCLIENT_BINDIR='"$(CLIENT_BINDIR)"'
Timothy Stack's avatar
 
Timothy Stack committed
33
CFLAGS	 += -O -g -Wall
34
CFLAGS   += -I. -I${OBJDIR} -I$(SRCDIR)/../lib -I$(TESTBED_SRCDIR)/lib/libtb
Timothy Stack's avatar
 
Timothy Stack committed
35
CFLAGS   += `$(ELVIN_CONFIG) --cflags vin4c`
36

Timothy Stack's avatar
 
Timothy Stack committed
37
LDFLAGS  += -L../lib -L${OBJDIR}/lib/libtb
38
LIBS     += -levent -lcrypto -lssl
Timothy Stack's avatar
 
Timothy Stack committed
39 40 41 42 43
LIBS     += `$(ELVIN_CONFIG) --libs vin4c`

ifeq ($(host_cpu),arm)
else
LDFLAGS  += -static
44
ifeq ($(SYSTEM),Linux)
45 46 47 48 49
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
Timothy Stack's avatar
 
Timothy Stack committed
50 51 52 53 54
endif
endif

ifeq ($(SYSTEM),Linux)
LIBS     	+= -ldl
55
LOCAL_BINDIR	= linux
56 57
endif

58 59 60 61
ifeq ($(SYSTEM),FreeBSD)
LOCAL_BINDIR	= fbsd
endif

62 63 64
ifeq ($(SYSTEM),CYGWIN)
LOCAL_BINDIR	= windows
endif
65 66 67

LIBTB_OBJS	= $(LIBTBDIR)/log.o $(LIBTBDIR)/tbdefs.o
DAEMON_OBJS	= linktest.o
68
LTEVENT_OBJS	= ltevent.o
69 70 71 72 73 74 75 76

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

Mike Hibler's avatar
Mike Hibler committed
78
$(LOCAL_BINDIR):
79
	-mkdir -p $(LOCAL_BINDIR)
Mike Hibler's avatar
Mike Hibler committed
80

81 82
binaries: $(LOCAL_BINDIR) $(LOCAL_BINDIR)/$(DAEMON) $(LOCAL_BINDIR)/$(LTEVENT) 

83
$(LOCAL_BINDIR)/$(DAEMON)-debug: $(LOCAL_BINDIR) $(DAEMON_OBJS) $(LIBTB_OBJS)
84
	$(CC) $(LDFLAGS) $(DAEMON_OBJS) $(LIBTB_OBJS) $(LIBS) -o $@
85

86
$(LOCAL_BINDIR)/$(LTEVENT)-debug: $(LOCAL_BINDIR) $(LTEVENT_OBJS) $(LIBTB_OBJS)
87
	$(CC) $(LDFLAGS) $(LTEVENT_OBJS) $(LIBTB_OBJS) $(LIBS) -o $@
88

89
$(DAEMON_OBJS):	linktest.h ../lib/libevent.a ../lib/event.h
90

91 92
$(LTEVENT_OBJS): ../lib/libevent.a ../lib/event.h

93
# We install just enough to fire off the test from boss and wait. 
94
install: weblinktest $(SCRIPT_CONTROL) $(SCRIPT_RUN) $(SCRIPT_PROXY) $(LOCAL_BINDIR)/$(LTEVENT)
95
	$(INSTALL_PROGRAM) weblinktest $(INSTALL_LIBEXECDIR)
96
	$(INSTALL_PROGRAM) $(SCRIPT_CONTROL) $(INSTALL_SBINDIR)
97
	$(INSTALL_DATA) $(SRCDIR)/linktest.html $(INSTALL_WWWDIR)/doc
98 99 100
	-mkdir -p $(INSTALL_DIR)/opsdir/bin
	-mkdir -p $(INSTALL_DIR)/opsdir/sbin
	-mkdir -p $(INSTALL_DIR)/opsdir/libexec
101 102
	$(INSTALL_PROGRAM) $(SCRIPT_RUN) \
			$(INSTALL_DIR)/opsdir/bin/$(SCRIPT_RUN)
103 104
	$(INSTALL_PROGRAM) $(SCRIPT_PROXY) \
			$(INSTALL_DIR)/opsdir/sbin/$(SCRIPT_PROXY)
105 106
	$(INSTALL_PROGRAM) $(LOCAL_BINDIR)/$(LTEVENT) \
			$(INSTALL_DIR)/opsdir/libexec/$(LTEVENT)
107 108 109 110 111
	@echo "Don't forget to do a post-install as root"

post-install: 
	chown root $(INSTALL_SBINDIR)/$(SCRIPT_CONTROL)
	chmod u+s $(INSTALL_SBINDIR)/$(SCRIPT_CONTROL)
112

113
control-install:	binaries
114 115
	$(INSTALL_PROGRAM) $(LOCAL_BINDIR)/$(LTEVENT) $(INSTALL_LIBEXECDIR)
	$(INSTALL_PROGRAM) $(SCRIPT_RUN) $(INSTALL_BINDIR)
116
	$(INSTALL_PROGRAM) $(SCRIPT_PROXY) $(INSTALL_BINDIR)
117

118 119
client: all
client-install: client
Timothy Stack's avatar
 
Timothy Stack committed
120 121
	$(INSTALL_PROGRAM) $(LOCAL_BINDIR)/$(DAEMON) $(DESTDIR)$(CLIENT_BINDIR)/$(DAEMON)
	$(INSTALL_PROGRAM) $(LOCAL_BINDIR)/$(LTEVENT) $(DESTDIR)$(CLIENT_BINDIR)/$(LTEVENT)
122 123 124 125
	$(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)
126 127

lt-install:
128
	$(INSTALL_PROGRAM) $(SCRIPT) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
129 130

clean:
131
	rm -f *.o $(TESTS) $(SCRIPT) $(SCRIPT_RUN) weblinktest linktest_control
Mike Hibler's avatar
Mike Hibler committed
132
	rm -rf $(LOCAL_BINDIR)