GNUmakefile.in 2.95 KB
Newer Older
Leigh B. Stoller's avatar
Leigh B. Stoller committed
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/>.
# 
# }}}
Leigh B. Stoller's avatar
Leigh B. Stoller committed
22
#
23 24
SRCDIR		= @srcdir@
TESTBED_SRCDIR	= @top_srcdir@
25
OBJDIR		= @top_builddir@
26
SUBDIR		= $(subst $(TESTBED_SRCDIR)/,,$(SRCDIR))
27

28
SYSTEM	       := $(shell uname -s)
29 30 31 32 33 34 35 36 37
PROGRAMS	= program-agent

include $(OBJDIR)/Makeconf

all:	$(PROGRAMS)

include $(TESTBED_SRCDIR)/GNUmakerules

CFLAGS   += -DDEBUG
38
CFLAGS	 += -O -g -Wall
39
CFLAGS   += -I. -I${OBJDIR}
40
CFLAGS   += -I$(TESTBED_LIBSRCDIR)/event -I$(TESTBED_LIBSRCDIR)/libtb
41 42
CFLAGS	 += -I/usr/local/include
CFLAGS	 += -DHAVE_PUBSUB
43
CFLAGS   += -DCLIENT_BINDIR='"$(CLIENT_BINDIR)"'
44

45
LDFLAGS  += -g -L${TESTBED_LIBOBJDIR}/event -L${TESTBED_LIBOBJDIR}/libtb
46 47
LIBS     += -levent -ltb 
LIBS	 += -L/usr/local/lib -lpubsub -lssl -lcrypto -lcrypt
48
LDFLAGS  += $(LDSTATIC)
49 50

# Deal with the presence/absence of kerberos in the linux ssl library
51
ifeq ($(SYSTEM),Linux)
52 53
ifneq ($(LDSTATIC),)
NOKERB := $(shell nm /usr/lib/libssl.a | grep -q krb; echo $$?)
54
else
55
NOKERB := 1
56
endif
57 58 59
ifeq ($(NOKERB),0)
CFLAGS   += `/usr/kerberos/bin/krb5-config --cflags`
LIBS     += `/usr/kerberos/bin/krb5-config --libs krb5`
60
ifneq ($(wildcard /usr/lib/libkrb5support.a),)
61
LIBS     += -lkrb5support
62
endif
63
endif
64
LIBS	 += -ldl
65
endif
66

67 68 69 70 71
version.c: program-agent.c
	echo >$@ "char build_info[] = \"Built on `date +%d-%b-%Y` by `id -nu`@`hostname | sed 's/\..*//'`:`pwd`\";"

program-agent-debug: program-agent.o version.o
	$(CC) $(LDFLAGS) -o $@ program-agent.o version.o $(LIBS)
72

73 74
$(PROGRAMS):	${TESTBED_LIBOBJDIR}/event/libevent.a \
		${TESTBED_LIBSRCDIR}/event/event.h
75

76
boss-install:	$(INSTALL_DIR)/opsdir/sbin/program-agent
77 78 79
	-mkdir -p $(INSTALL_DIR)/opsdir/man/man8
	$(INSTALL) -m 0644 $(SRCDIR)/program-agent.8 \
		$(INSTALL_DIR)/opsdir/man/man8/program-agent.8
80

81 82
control-install:	$(INSTALL_SBINDIR)/program-agent

83 84
post-install:

85 86
client: $(PROGRAMS)
client-install: client
87
	$(INSTALL_PROGRAM) program-agent$(EXE) $(DESTDIR)$(CLIENT_BINDIR)/program-agent$(EXE)
88
	chmod u+s-w $(DESTDIR)$(CLIENT_BINDIR)/program-agent
89
	-mkdir -p $(DESTDIR)$(CLIENT_MANDIR)/man8
90
	$(INSTALL) -m 644 $(SRCDIR)/program-agent.8 $(DESTDIR)$(CLIENT_MANDIR)/man8/program-agent.8
91 92 93

clean:
	/bin/rm -f *.o $(PROGRAMS)
94 95 96 97 98

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