GNUmakefile.in 3.37 KB
Newer Older
1
#
2
# Copyright (c) 2000-2011, 2018 University of Utah and the Flux Group.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
22 23 24 25 26 27 28
#
SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
OBJDIR		= ../..
SUBDIR		= event/proxy

SYSTEM	       := $(shell uname -s)
29
PROGRAMS	= eventping 
30
ifneq ($(SYSTEM),Linux)
31
PROGRAMS       += version0_gateway
32
endif
33 34 35 36 37 38 39

include $(OBJDIR)/Makeconf

all:	$(PROGRAMS)

include $(TESTBED_SRCDIR)/GNUmakerules

40 41
LIBTBDIR    = $(TESTBED_LIBOBJDIR)/libtb
LIBEVENTDIR = $(TESTBED_LIBOBJDIR)/event
42
CPPC        = g++
43 44 45 46 47 48 49 50 51 52

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

CFLAGS   += -DDEBUG
53
CFLAGS	 += -O2 -g -Wall
54
CFLAGS   += -I. -I${OBJDIR}
55
CFLAGS   += -I$(TESTBED_LIBSRCDIR)/event -I$(TESTBED_LIBSRCDIR)/libtb
56
CFLAGS   += -I/usr/local/include
57

58 59 60
PFLAGS    = -pthread
PFLAGS   += -DDEBUG
PFLAGS	 += -O2 -g -Wall
61
PFLAGS   += -I. -I${OBJDIR}
62
PFLAGS   += -I$(TESTBED_LIBSRCDIR)/event -I$(TESTBED_LIBSRCDIR)/libtb
Mike Hibler's avatar
Mike Hibler committed
63
PFLAGS   += -L/usr/local/lib -lpubsub_r -ltb -lm
64

65 66
PLDFLAGS += -L$(TESTBED_LIBOBJDIR)
PLDFLAGS += -L$(TESTBED_LIBOBJDIR)/libtb -L$(TESTBED_LIBOBJDIR)/event
67
PLIBS     = -levent_r -ltb -lssl -lcrypto -lcrypt
Mike Hibler's avatar
Mike Hibler committed
68
PLIBS    += -L/usr/local/lib -lpubsub_r -ltb -lm
69 70
PLDFLAGS += $(LDSTATIC)

71 72
LDFLAGS  += -L$(TESTBED_LIBOBJDIR)
LDFLAGS  += -L$(TESTBED_LIBOBJDIR)/libtb -L$(TESTBED_LIBOBJDIR)/event
73
LIBS      = -levent -ltb -lssl -lcrypto -lcrypt
Mike Hibler's avatar
Mike Hibler committed
74
LIBS     += -L/usr/local/lib -lpubsub -ltb -lm
75
LDFLAGS  += $(LDSTATIC)
76 77

# Deal with the presence/absence of kerberos in the linux ssl library
78
ifeq ($(SYSTEM),Linux)
79 80
ifneq ($(LDSTATIC),)
NOKERB := $(shell nm /usr/lib/libssl.a | grep -q krb; echo $$?)
81
else
82
NOKERB := 1
83
endif
84 85 86
ifeq ($(NOKERB),0)
CFLAGS   += `/usr/kerberos/bin/krb5-config --cflags`
LIBS     += `/usr/kerberos/bin/krb5-config --libs krb5`
87
PLIBS    += `/usr/kerberos/bin/krb5-config --libs krb5`
88
ifneq ($(wildcard /usr/lib/libkrb5support.a),)
89
LIBS     += -lkrb5support
90
PLIBS    += -lkrb5support
91
endif
92
endif
93
endif
94 95 96

ifeq ($(SYSTEM),Linux)
LIBS     += -ldl -lz
97
PLIBS    += -ldl -lz
98
endif
99

100 101
version0_gateway:    version0_gateway.c
	$(CC) $(CFLAGS) $(PLDFLAGS) -pthread -o $@ $< -L/usr/local/lib \
102
		-lpubsub_r -ltb -lm -lssl -lcrypto -lcrypt
103

104
eventping-debug: eventping.o
Mike Hibler's avatar
Mike Hibler committed
105
	$(CC) $(LDFLAGS) -o $@ eventping.o -pthread $(LIBS)
Sachin Goyal's avatar
Sachin Goyal committed
106

107 108
$(PROGRAMS):	${TESTBED_LIBOBJDIR}/event/libevent.a \
		${TESTBED_LIBSRCDIR}/event/event.h
109

110 111 112 113
control-install:	$(INSTALL_SBINDIR)/version0_gateway

install:		$(INSTALL_DIR)/opsdir/sbin/version0_gateway

114 115
client:
client-install:
116 117

clean:
118
	/bin/rm -f *.o $(PROGRAMS) *-debug
119 120 121 122 123

$(INSTALL_DIR)/opsdir/sbin/%: %
	@echo "Installing $<"
	-mkdir -p $(INSTALL_DIR)/opsdir/sbin
	$(INSTALL) $< $@