]> git.pld-linux.org Git - packages/dhcp.git/blob - dhcp-libdhcp4client.make
- enable timeouts even if not debugging
[packages/dhcp.git] / dhcp-libdhcp4client.make
1 #
2 # Makefile.dist for libdhcp4client
3 #
4 # We get the libdhcp4client library from the patched ISC source code.  We
5 # rebuild key C files with -DLIBDHCP to turn on the library features we
6 # need.  Normal build results in standard ISC code (i.e., not LIBDHCP
7 # stuff enabled).  We then link together a static library and a shared
8 # library with the new resulting objects.
9 #
10 # Copyright (C) 2006, 2007  Red Hat, Inc. All rights reserved.
11 #
12 # This copyrighted material is made available to anyone wishing to use,
13 # modify, copy, or redistribute it subject to the terms and conditions of
14 # the GNU General Public License v.2, or (at your option) any later version.
15 # This program is distributed in the hope that it will be useful, but WITHOUT
16 # ANY WARRANTY expressed or implied, including the implied warranties of
17 # MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE.  See the GNU General
18 # Public License for more details.  You should have received a copy of the
19 # GNU General Public License along with this program; if not, write to the
20 # Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21 # 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
22 # source code or documentation are not subject to the GNU General Public
23 # License and may only be used or replicated with the express permission of
24 # Red Hat, Inc.
25 #
26 # Red Hat Author(s): Jason Vas Dias
27 #                    David Cantrell <dcantrell@redhat.com>
28 #
29
30 # What version of ISC DHCP is this?
31 VER   = $(shell grep DHCP_VERSION ../../includes/version.h | head -1 | cut -d '"' -f 2 | cut -d 'V' -f 2 | cut -d '-' -f 1)
32
33 PROGS = libdhcp4client.a libdhcp4client-$(VER).so.0
34
35 # NOTE: The ordering of these file lists is important!  We are using the
36 # whole program optimization features of gcc, so the order matters here.
37
38 # Source files shared by all objects
39 COMMON_SRCS = client_clparse.c client_dhclient.c common_alloc.c common_bpf.c \
40               common_comapi.c common_conflex.c common_discover.c \
41               common_dispatch.c common_dns.c common_ethernet.c \
42               common_execute.c common_inet.c common_lpf.c common_memory.c \
43               common_options.c common_packet.c common_parse.c common_print.c \
44               common_socket.c common_tables.c common_tr.c common_tree.c \
45               dst_dst_api.c dst_base64.c dst_hmac_link.c dst_md5_dgst.c \
46               omapip_alloc.c omapip_array.c omapip_auth.c omapip_buffer.c \
47               omapip_connection.c omapip_convert.c omapip_dispatch.c \
48               omapip_errwarn.c omapip_handle.c omapip_hash.c \
49               omapip_listener.c omapip_mrtrace.c omapip_result.c \
50               omapip_support.c omapip_toisc.c omapip_trace.c
51
52 # Source files for libdhcp4client.o
53 CLIENT_SRCS = common_ctrace.c common_dlpi.c common_nit.c common_upf.c \
54               dst_dst_support.c dst_prandom.c omapip_generic.c \
55               omapip_message.c omapip_protocol.c
56
57 # Source files for libres.o (minires)
58 MINIRES_SRCS = minires_ns_date.c minires_ns_name.c minires_ns_parse.c \
59                minires_ns_samedomain.c minires_ns_sign.c minires_ns_verify.c \
60                minires_res_comp.c minires_res_findzonecut.c \
61                minires_res_init.c minires_res_mkquery.c \
62                minires_res_mkupdate.c minires_res_query.c minires_res_send.c \
63                minires_res_sendsigned.c minires_res_update.c
64
65 # ISC dhcp headers we need to copy to /usr/include/dhcp4client
66 DHCP_HEADERS = dhcpd.h cdefs.h osdep.h arpa/nameser.h minires/minires.h \
67                site.h cf/linux.h dhcp.h statement.h tree.h inet.h dhctoken.h \
68                omapip/omapip_p.h failover.h ctrace.h minires/resolv.h \
69                minires/res_update.h omapip/convert.h omapip/hash.h \
70                omapip/trace.h
71
72 HDRS = dhcp4client.h
73 SRCS = $(COMMON_SRCS) $(CLIENT_SRCS)
74 OBJS = $(SRCS:.c=.o)
75
76 INCLUDES = -I$(TOP) -I$(TOP)/includes -I$(TOP)/dst -I.
77 CFLAGS   = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS) \
78            -DCLIENT_PATH=${CLIENT_PATH} -DLIBDHCP -DUSE_MD5
79
80 all: $(PROGS)
81
82 install: all
83         install -p -m 0755 -D libdhcp4client-$(VER).so.0 $(DESTDIR)$(LIBDIR)/libdhcp4client-$(VER).so.0
84         ln -sf libdhcp4client-$(VER).so.0 $(DESTDIR)/$(LIBDIR)/libdhcp4client.so
85         install -p -m 0644 -D libdhcp4client.a $(DESTDIR)$(LIBDIR)/libdhcp4client.a
86         install -p -m 0644 -D dhcp4client.h $(DESTDIR)$(INCDIR)/dhcp4client/dhcp4client.h
87         for hdr in $(DHCP_HEADERS) ; do \
88                 install -p -m 0644 -D $(TOP)/includes/$${hdr} $(DESTDIR)$(INCDIR)/dhcp4client/$${hdr} ; \
89         done
90
91 depend:
92         $(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRCS)
93
94 clean:
95         -rm -f $(OBJS)
96
97 realclean: clean
98         -rm -f $(PROG) *~ #*
99
100 distclean: realclean
101         -rm -f Makefile
102
103 # This isn't the cleanest way to set up links, but I prefer this so I don't
104 # need object targets for each subdirectory.  The idea is simple.  Since
105 # libdhcp4client is a linked together wad of objects from across the source
106 # tree, we change / to _ when linking source files here.  Follow this example:
107 #
108 # We need to use client/dhclient.c, so we make this link:
109 #     rm -f client_dhclient.c
110 #     ln -s $(TOP)/client/dhclient.c client_dhclient.c
111 #
112 # Simple.  Given the way the ISC build system works, this is the easiest to
113 # maintain and least invasive.
114 #
115 # David Cantrell <dcantrell@redhat.com>
116 links:
117         @for target in $(SRCS); do \
118                 source="`echo $$target | sed -e 's|_|/|'`"; \
119                 if [ ! -b $$target ]; then \
120                         rm -f $$target; \
121                 fi; \
122                 ln -s $(TOP)/$$source $$target; \
123         done; \
124         for hdr in $(HDRS); do \
125                 if [ ! -b $$hdr ]; then \
126                         rm -f $$hdr; \
127                 fi; \
128                 ln -s $(TOP)/libdhcp4client/$$hdr $$hdr; \
129         done
130
131 # minires is difficult to build because it overrides things in common and dst,
132 # so we just link with the already built libres.a since we need it all anyway
133 libres.a:
134         if [ ! -f ../minires/$@ ]; then \
135                 $(MAKE) -C ../minires; \
136         fi; \
137         ln ../minires/libres.a .; \
138         $(AR) x libres.a
139
140 # Create the libraries
141 # minires/res_query.o contains an undefined symbol __h_errno_set, is not
142 # used by any dhcp code, and is optimized out by the linker when producing
143 # the dhclient executable or a shared library
144 libdhcp4client.a: $(OBJS) libres.a
145         $(AR) crus $@ $(OBJS) `$(AR) t libres.a | grep -v res_query.o`
146
147 libdhcp4client-$(VER).so.0: $(OBJS) libres.a
148         $(CC) -shared -o $@ -Wl,-soname,$@ $(OBJS) `$(AR) t libres.a | grep -v res_query.o`
149
150 # Dependencies (semi-automatically-generated)
This page took 0.149267 seconds and 3 git commands to generate.