827332
#
827332
# Makefile.dist for libdhcp4client
827332
#
827332
# We get the libdhcp4client library from the patched ISC source code.  We
827332
# rebuild key C files with -DLIBDHCP to turn on the library features we
827332
# need.  Normal build results in standard ISC code (i.e., not LIBDHCP
827332
# stuff enabled).  We then link together a static library and a shared
827332
# library with the new resulting objects.
827332
#
827332
# Copyright (C) 2006, 2007  Red Hat, Inc. All rights reserved.
827332
#
827332
# This copyrighted material is made available to anyone wishing to use,
827332
# modify, copy, or redistribute it subject to the terms and conditions of
827332
# the GNU General Public License v.2, or (at your option) any later version.
827332
# This program is distributed in the hope that it will be useful, but WITHOUT
827332
# ANY WARRANTY expressed or implied, including the implied warranties of
827332
# MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE.  See the GNU General
827332
# Public License for more details.  You should have received a copy of the
827332
# GNU General Public License along with this program; if not, write to the
827332
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
827332
# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
827332
# source code or documentation are not subject to the GNU General Public
827332
# License and may only be used or replicated with the express permission of
827332
# Red Hat, Inc.
827332
#
827332
# Red Hat Author(s): Jason Vas Dias
827332
#                    David Cantrell <dcantrell@redhat.com>
827332
#
827332
827332
# What version of ISC DHCP is this?
827332
VER   = $(shell grep DHCP_VERSION ../../includes/version.h | head -1 | cut -d '"' -f 2 | cut -d 'V' -f 2 | cut -d '-' -f 1)
827332
827332
PROGS = libdhcp4client.a libdhcp4client-$(VER).so.0
827332
827332
# NOTE: The ordering of these file lists is important!  We are using the
827332
# whole program optimization features of gcc, so the order matters here.
827332
827332
# Source files shared by all objects
827332
COMMON_SRCS = client_clparse.c client_dhclient.c common_alloc.c common_bpf.c \
827332
              common_comapi.c common_conflex.c common_discover.c \
827332
              common_dispatch.c common_dns.c common_ethernet.c \
827332
              common_execute.c common_inet.c common_lpf.c common_memory.c \
827332
              common_options.c common_packet.c common_parse.c common_print.c \
827332
              common_socket.c common_tables.c common_tr.c common_tree.c \
827332
              dst_dst_api.c dst_base64.c dst_hmac_link.c dst_md5_dgst.c \
827332
              omapip_alloc.c omapip_array.c omapip_auth.c omapip_buffer.c \
827332
              omapip_connection.c omapip_convert.c omapip_dispatch.c \
827332
              omapip_errwarn.c omapip_handle.c omapip_hash.c \
827332
              omapip_listener.c omapip_mrtrace.c omapip_result.c \
827332
              omapip_support.c omapip_toisc.c omapip_trace.c
827332
827332
# Source files for libdhcp4client.o
827332
CLIENT_SRCS = common_ctrace.c common_dlpi.c common_nit.c common_upf.c \
827332
              dst_dst_support.c dst_prandom.c omapip_generic.c \
827332
              omapip_message.c omapip_protocol.c
827332
827332
# Source files for libres.o (minires)
827332
MINIRES_SRCS = minires_ns_date.c minires_ns_name.c minires_ns_parse.c \
827332
               minires_ns_samedomain.c minires_ns_sign.c minires_ns_verify.c \
827332
               minires_res_comp.c minires_res_findzonecut.c \
827332
               minires_res_init.c minires_res_mkquery.c \
827332
               minires_res_mkupdate.c minires_res_query.c minires_res_send.c \
827332
               minires_res_sendsigned.c minires_res_update.c
827332
827332
# ISC dhcp headers we need to copy to /usr/include/dhcp4client
827332
DHCP_HEADERS = dhcpd.h cdefs.h osdep.h arpa/nameser.h minires/minires.h \
827332
               site.h cf/linux.h dhcp.h statement.h tree.h inet.h dhctoken.h \
827332
               omapip/omapip_p.h failover.h ctrace.h minires/resolv.h \
827332
               minires/res_update.h omapip/convert.h omapip/hash.h \
827332
               omapip/trace.h
827332
827332
HDRS = dhcp4client.h
827332
SRCS = $(COMMON_SRCS) $(CLIENT_SRCS)
827332
OBJS = $(SRCS:.c=.o)
827332
827332
INCLUDES = -I$(TOP) -I$(TOP)/includes -I$(TOP)/dst -I.
827332
CFLAGS   = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS) \
827332
           -DCLIENT_PATH=${CLIENT_PATH} -DLIBDHCP -DUSE_MD5
827332
827332
all: $(PROGS)
827332
827332
install: all
827332
	install -p -m 0755 -D libdhcp4client-$(VER).so.0 $(DESTDIR)$(LIBDIR)/libdhcp4client-$(VER).so.0
827332
	ln -sf libdhcp4client-$(VER).so.0 $(DESTDIR)/$(LIBDIR)/libdhcp4client.so
827332
	install -p -m 0644 -D libdhcp4client.a $(DESTDIR)$(LIBDIR)/libdhcp4client.a
827332
	install -p -m 0644 -D dhcp4client.h $(DESTDIR)$(INCDIR)/dhcp4client/dhcp4client.h
827332
	for hdr in $(DHCP_HEADERS) ; do \
827332
		install -p -m 0644 -D $(TOP)/includes/$${hdr} $(DESTDIR)$(INCDIR)/dhcp4client/$${hdr} ; \
827332
	done
827332
827332
depend:
827332
	$(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRCS)
827332
827332
clean:
827332
	-rm -f $(OBJS)
827332
827332
realclean: clean
827332
	-rm -f $(PROG) *~ #*
827332
827332
distclean: realclean
827332
	-rm -f Makefile
827332
827332
# This isn't the cleanest way to set up links, but I prefer this so I don't
827332
# need object targets for each subdirectory.  The idea is simple.  Since
827332
# libdhcp4client is a linked together wad of objects from across the source
827332
# tree, we change / to _ when linking source files here.  Follow this example:
827332
#
827332
# We need to use client/dhclient.c, so we make this link:
827332
#     rm -f client_dhclient.c
827332
#     ln -s $(TOP)/client/dhclient.c client_dhclient.c
827332
#
827332
# Simple.  Given the way the ISC build system works, this is the easiest to
827332
# maintain and least invasive.
827332
#
827332
# David Cantrell <dcantrell@redhat.com>
827332
links:
827332
	@for target in $(SRCS); do \
827332
		source="`echo $$target | sed -e 's|_|/|'`"; \
827332
		if [ ! -b $$target ]; then \
827332
			rm -f $$target; \
827332
		fi; \
827332
		ln -s $(TOP)/$$source $$target; \
827332
	done; \
827332
	for hdr in $(HDRS); do \
827332
		if [ ! -b $$hdr ]; then \
827332
			rm -f $$hdr; \
827332
		fi; \
827332
		ln -s $(TOP)/libdhcp4client/$$hdr $$hdr; \
827332
	done
827332
827332
# minires is difficult to build because it overrides things in common and dst,
827332
# so we just link with the already built libres.a since we need it all anyway
827332
libres.a:
827332
	if [ ! -f ../minires/$@ ]; then \
827332
		$(MAKE) -C ../minires; \
827332
	fi; \
827332
	ln ../minires/libres.a .; \
827332
	$(AR) x libres.a
827332
827332
# Create the libraries
827332
# minires/res_query.o contains an undefined symbol __h_errno_set, is not
827332
# used by any dhcp code, and is optimized out by the linker when producing
827332
# the dhclient executable or a shared library
827332
libdhcp4client.a: $(OBJS) libres.a
827332
	$(AR) crus $@ $(OBJS) `$(AR) t libres.a | grep -v res_query.o`
827332
827332
libdhcp4client-$(VER).so.0: $(OBJS) libres.a
827332
	$(CC) -shared -o $@ -Wl,-soname,$@ $(OBJS) `$(AR) t libres.a | grep -v res_query.o`
827332
827332
# Dependencies (semi-automatically-generated)