]>
Commit | Line | Data |
---|---|---|
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 | LOBJS = $(SRCS:.c=.lo) | |
76 | ||
77 | INCLUDES = -I$(TOP) -I$(TOP)/includes -I$(TOP)/dst -I. | |
78 | CFLAGS = $(DEBUG) $(PREDEFINES) $(INCLUDES) $(COPTS) \ | |
79 | -DCLIENT_PATH=${CLIENT_PATH} -DLIBDHCP -DUSE_MD5 | |
80 | ||
81 | all: $(PROGS) | |
82 | ||
83 | install: all | |
84 | install -p -m 0755 -D libdhcp4client-$(VER).so.0 $(DESTDIR)$(LIBDIR)/libdhcp4client-$(VER).so.0 | |
85 | ln -sf libdhcp4client-$(VER).so.0 $(DESTDIR)/$(LIBDIR)/libdhcp4client.so | |
86 | install -p -m 0644 -D libdhcp4client.a $(DESTDIR)$(LIBDIR)/libdhcp4client.a | |
87 | install -p -m 0644 -D dhcp4client.h $(DESTDIR)$(INCDIR)/dhcp4client/dhcp4client.h | |
88 | for hdr in $(DHCP_HEADERS) ; do \ | |
89 | install -p -m 0644 -D $(TOP)/includes/$${hdr} $(DESTDIR)$(INCDIR)/dhcp4client/$${hdr} ; \ | |
90 | done | |
91 | ||
92 | depend: | |
93 | $(MKDEP) $(INCLUDES) $(PREDEFINES) $(SRCS) | |
94 | ||
95 | clean: | |
96 | -rm -f $(OBJS) $(LOBJS) | |
97 | ||
98 | realclean: clean | |
99 | -rm -f $(PROG) *~ #* | |
100 | ||
101 | distclean: realclean | |
102 | -rm -f Makefile | |
103 | ||
104 | # This isn't the cleanest way to set up links, but I prefer this so I don't | |
105 | # need object targets for each subdirectory. The idea is simple. Since | |
106 | # libdhcp4client is a linked together wad of objects from across the source | |
107 | # tree, we change / to _ when linking source files here. Follow this example: | |
108 | # | |
109 | # We need to use client/dhclient.c, so we make this link: | |
110 | # rm -f client_dhclient.c | |
111 | # ln -s $(TOP)/client/dhclient.c client_dhclient.c | |
112 | # | |
113 | # Simple. Given the way the ISC build system works, this is the easiest to | |
114 | # maintain and least invasive. | |
115 | # | |
116 | # David Cantrell <dcantrell@redhat.com> | |
117 | links: | |
118 | @for target in $(SRCS); do \ | |
119 | source="`echo $$target | sed -e 's|_|/|'`"; \ | |
120 | if [ ! -b $$target ]; then \ | |
121 | rm -f $$target; \ | |
122 | fi; \ | |
123 | ln -s $(TOP)/$$source $$target; \ | |
124 | done; \ | |
125 | for hdr in $(HDRS); do \ | |
126 | if [ ! -b $$hdr ]; then \ | |
127 | rm -f $$hdr; \ | |
128 | fi; \ | |
129 | ln -s $(TOP)/libdhcp4client/$$hdr $$hdr; \ | |
130 | done | |
131 | ||
132 | # minires is difficult to build because it overrides things in common and dst, | |
133 | # so we just link with the already built libres.a since we need it all anyway | |
134 | libres.a: | |
135 | if [ ! -f ../minires/$@ ]; then \ | |
136 | $(MAKE) -C ../minires; \ | |
137 | fi; \ | |
138 | ln ../minires/libres.a .; \ | |
139 | $(AR) x libres.a | |
140 | ||
141 | %.lo: %.c | |
142 | $(CC) -o $@ $(CFLAGS) -fPIC -c $< | |
143 | ||
144 | # Create the libraries | |
145 | # minires/res_query.o contains an undefined symbol __h_errno_set, is not | |
146 | # used by any dhcp code, and is optimized out by the linker when producing | |
147 | # the dhclient executable or a shared library | |
148 | libdhcp4client.a: $(OBJS) libres.a | |
149 | $(AR) crus $@ $(OBJS) `$(AR) t libres.a | grep -v res_query.o` | |
150 | ||
151 | libdhcp4client-$(VER).so.0: $(LOBJS) libres.a | |
152 | $(CC) $(LDFLAGS) $(CFLAGS) -shared -o $@ -Wl,-soname,$@ $(LOBJS) `$(AR) t libres.a | grep -v res_query.o` | |
153 | ||
154 | # Dependencies (semi-automatically-generated) |