Deleted Added
full compact
Makefile.in (235426) Makefile.in (241231)
1# Copyright (c) 1993, 1994, 1995, 1996
2# The Regents of the University of California. All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that: (1) source code distributions
6# retain the above copyright notice and this paragraph in its entirety, (2)
7# distributions including binary code include the above copyright notice and
8# this paragraph in its entirety in the documentation or other materials
9# provided with the distribution, and (3) all advertising materials mentioning
10# features or use of this software display the following acknowledgement:
11# ``This product includes software developed by the University of California,
12# Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
13# the University nor the names of its contributors may be used to endorse
14# or promote products derived from this software without specific prior
15# written permission.
16# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19#
20# @(#) $Header: /tcpdump/master/libpcap/Makefile.in,v 1.142 2008-11-22 17:30:24 guy Exp $ (LBL)
21
22#
23# Various configurable paths (remember to edit Makefile.in, not Makefile)
24#
25
26# Top level hierarchy
27prefix = @prefix@
28exec_prefix = @exec_prefix@
29datarootdir = @datarootdir@
30# Pathname of directory to install the configure program
31bindir = @bindir@
32# Pathname of directory to install the include files
33includedir = @includedir@
34# Pathname of directory to install the library
35libdir = @libdir@
36# Pathname of directory to install the man pages
37mandir = @mandir@
38
39# VPATH
40srcdir = @srcdir@
41VPATH = @srcdir@
42
43#
44# You shouldn't need to edit anything below.
45#
46
47LD = /usr/bin/ld
48CC = @CC@
49AR = @AR@
50CCOPT = @V_CCOPT@
51INCLS = -I. @V_INCLS@
52DEFS = @DEFS@ @V_DEFS@
53ADDLOBJS = @ADDLOBJS@
54ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@
55LIBS = @LIBS@
56CFLAGS = @CFLAGS@
57LDFLAGS = @LDFLAGS@
58DYEXT = @DYEXT@
59V_RPATH_OPT = @V_RPATH_OPT@
60PROG=libpcap
61
62# Standard CFLAGS
63FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
64
65INSTALL = @INSTALL@
66INSTALL_PROGRAM = @INSTALL_PROGRAM@
67INSTALL_DATA = @INSTALL_DATA@
68RANLIB = @RANLIB@
69
70#
71# Flex and bison allow you to specify the prefixes of the global symbols
72# used by the generated parser. This allows programs to use lex/yacc
73# and link against libpcap. If you don't have flex or bison, get them.
74#
75LEX = @V_LEX@
76YACC = @V_YACC@
77
78# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
79# Also, gcc does not remove the .o before forking 'as', which can be a
80# problem if you don't own the file but can write to the directory.
81.c.o:
82 @rm -f $@
83 $(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
84
1# Copyright (c) 1993, 1994, 1995, 1996
2# The Regents of the University of California. All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that: (1) source code distributions
6# retain the above copyright notice and this paragraph in its entirety, (2)
7# distributions including binary code include the above copyright notice and
8# this paragraph in its entirety in the documentation or other materials
9# provided with the distribution, and (3) all advertising materials mentioning
10# features or use of this software display the following acknowledgement:
11# ``This product includes software developed by the University of California,
12# Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
13# the University nor the names of its contributors may be used to endorse
14# or promote products derived from this software without specific prior
15# written permission.
16# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19#
20# @(#) $Header: /tcpdump/master/libpcap/Makefile.in,v 1.142 2008-11-22 17:30:24 guy Exp $ (LBL)
21
22#
23# Various configurable paths (remember to edit Makefile.in, not Makefile)
24#
25
26# Top level hierarchy
27prefix = @prefix@
28exec_prefix = @exec_prefix@
29datarootdir = @datarootdir@
30# Pathname of directory to install the configure program
31bindir = @bindir@
32# Pathname of directory to install the include files
33includedir = @includedir@
34# Pathname of directory to install the library
35libdir = @libdir@
36# Pathname of directory to install the man pages
37mandir = @mandir@
38
39# VPATH
40srcdir = @srcdir@
41VPATH = @srcdir@
42
43#
44# You shouldn't need to edit anything below.
45#
46
47LD = /usr/bin/ld
48CC = @CC@
49AR = @AR@
50CCOPT = @V_CCOPT@
51INCLS = -I. @V_INCLS@
52DEFS = @DEFS@ @V_DEFS@
53ADDLOBJS = @ADDLOBJS@
54ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@
55LIBS = @LIBS@
56CFLAGS = @CFLAGS@
57LDFLAGS = @LDFLAGS@
58DYEXT = @DYEXT@
59V_RPATH_OPT = @V_RPATH_OPT@
60PROG=libpcap
61
62# Standard CFLAGS
63FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
64
65INSTALL = @INSTALL@
66INSTALL_PROGRAM = @INSTALL_PROGRAM@
67INSTALL_DATA = @INSTALL_DATA@
68RANLIB = @RANLIB@
69
70#
71# Flex and bison allow you to specify the prefixes of the global symbols
72# used by the generated parser. This allows programs to use lex/yacc
73# and link against libpcap. If you don't have flex or bison, get them.
74#
75LEX = @V_LEX@
76YACC = @V_YACC@
77
78# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
79# Also, gcc does not remove the .o before forking 'as', which can be a
80# problem if you don't own the file but can write to the directory.
81.c.o:
82 @rm -f $@
83 $(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
84
85PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@ @NETFILTER_SRC@
85PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@ @NETFILTER_SRC@ @CANUSB_SRC@
86FSRC = fad-@V_FINDALLDEVS@.c
87SSRC = @SSRC@
88CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c etherent.c \
89 savefile.c sf-pcap.c sf-pcap-ng.c pcap-common.c \
90 bpf_image.c bpf_dump.c
91GENSRC = scanner.c grammar.c bpf_filter.c version.c
92LIBOBJS = @LIBOBJS@
93
94SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(GENSRC)
95
96# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
97# hack the extra indirection
98OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
99PUBHDR = \
100 pcap.h \
101 pcap-bpf.h \
102 pcap-namedb.h \
103 pcap/bpf.h \
104 pcap/bluetooth.h \
105 pcap/ipnet.h \
106 pcap/namedb.h \
107 pcap/pcap.h \
108 pcap/sll.h \
109 pcap/vlan.h \
110 pcap/usb.h
111
112HDR = $(PUBHDR) \
113 arcnet.h \
114 atmuni31.h \
115 ethertype.h \
116 gencode.h \
117 ieee80211.h \
118 llc.h \
119 nlpid.h \
120 pcap-common.h \
121 pcap-int.h \
122 pcap-stdinc.h \
123 ppp.h \
124 sf-pcap.h \
125 sf-pcap-ng.h \
126 sunatmpos.h
127
128TESTS = \
129 filtertest \
130 findalldevstest \
131 nonblocktest \
132 opentest \
133 selpolltest
134
135TESTS_SRC = \
136 tests/filtertest.c \
137 tests/findalldevstest.c \
138 tests/nonblocktest.c \
139 tests/opentest.c \
140 tests/reactivatetest.c \
141 tests/selpolltest.c
142
143GENHDR = \
144 scanner.h tokdefs.h version.h
145
146TAGFILES = \
147 $(SRC) $(HDR)
148
149CLEANFILES = $(OBJ) libpcap.* $(TESTS) \
150 $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
151 lex.yy.c pcap-config
152
153MAN1 = pcap-config.1
154
155MAN3PCAP_EXPAND = \
156 pcap.3pcap.in \
157 pcap_compile.3pcap.in \
158 pcap_datalink.3pcap.in \
159 pcap_dump_open.3pcap.in \
160 pcap_list_datalinks.3pcap.in \
161 pcap_list_tstamp_types.3pcap.in \
162 pcap_open_dead.3pcap.in \
163 pcap_open_offline.3pcap.in \
164 pcap_set_tstamp_type.3pcap.in
165
166MAN3PCAP_NOEXPAND = \
167 pcap_activate.3pcap \
168 pcap_breakloop.3pcap \
169 pcap_can_set_rfmon.3pcap \
170 pcap_close.3pcap \
171 pcap_create.3pcap \
172 pcap_datalink_name_to_val.3pcap \
173 pcap_datalink_val_to_name.3pcap \
174 pcap_dump.3pcap \
175 pcap_dump_close.3pcap \
176 pcap_dump_file.3pcap \
177 pcap_dump_flush.3pcap \
178 pcap_dump_ftell.3pcap \
179 pcap_file.3pcap \
180 pcap_fileno.3pcap \
181 pcap_findalldevs.3pcap \
182 pcap_freecode.3pcap \
183 pcap_get_selectable_fd.3pcap \
184 pcap_geterr.3pcap \
185 pcap_inject.3pcap \
186 pcap_is_swapped.3pcap \
187 pcap_lib_version.3pcap \
188 pcap_lookupdev.3pcap \
189 pcap_lookupnet.3pcap \
190 pcap_loop.3pcap \
191 pcap_major_version.3pcap \
192 pcap_next_ex.3pcap \
193 pcap_offline_filter.3pcap \
194 pcap_open_live.3pcap \
195 pcap_set_buffer_size.3pcap \
196 pcap_set_datalink.3pcap \
197 pcap_set_promisc.3pcap \
198 pcap_set_rfmon.3pcap \
199 pcap_set_snaplen.3pcap \
200 pcap_set_timeout.3pcap \
201 pcap_setdirection.3pcap \
202 pcap_setfilter.3pcap \
203 pcap_setnonblock.3pcap \
204 pcap_snapshot.3pcap \
205 pcap_stats.3pcap \
206 pcap_statustostr.3pcap \
207 pcap_strerror.3pcap \
208 pcap_tstamp_type_name_to_val.3pcap \
209 pcap_tstamp_type_val_to_name.3pcap
210
211MAN3PCAP = $(MAN3PCAP_NOEXPAND) $(MAN3PCAP_EXPAND:.in=)
212
213MANFILE = \
214 pcap-savefile.manfile.in
215
216MANMISC = \
217 pcap-filter.manmisc.in \
218 pcap-linktype.manmisc.in \
219 pcap-tstamp.manmisc.in
220
221EXTRA_DIST = \
222 $(TESTS_SRC) \
223 CHANGES \
224 ChmodBPF/ChmodBPF \
225 ChmodBPF/StartupParameters.plist \
226 CREDITS \
227 INSTALL.txt \
228 LICENSE \
229 Makefile.in \
230 README \
231 README.aix \
232 README.dag \
233 README.hpux \
234 README.linux \
235 README.macosx \
236 README.septel \
237 README.sita \
238 README.tru64 \
239 README.Win32 \
240 SUNOS4/nit_if.o.sparc \
241 SUNOS4/nit_if.o.sun3 \
242 SUNOS4/nit_if.o.sun4c.4.0.3c \
243 TODO \
244 VERSION \
245 aclocal.m4 \
246 bpf/net/bpf_filter.c \
247 chmod_bpf \
248 config.guess \
249 config.h.in \
250 config.sub \
251 configure \
252 configure.in \
253 dlpisubs.c \
254 dlpisubs.h \
255 fad-getad.c \
256 fad-gifc.c \
257 fad-glifc.c \
258 fad-null.c \
259 fad-sita.c \
260 fad-win32.c \
261 grammar.y \
262 install-sh \
263 lbl/os-aix4.h \
264 lbl/os-hpux11.h \
265 lbl/os-osf4.h \
266 lbl/os-osf5.h \
267 lbl/os-solaris2.h \
268 lbl/os-sunos4.h \
269 lbl/os-ultrix4.h \
270 missing/snprintf.c \
271 mkdep \
272 msdos/bin2c.c \
273 msdos/common.dj \
274 msdos/makefile \
275 msdos/makefile.dj \
276 msdos/makefile.wc \
277 msdos/ndis2.c \
278 msdos/ndis2.h \
279 msdos/ndis_0.asm \
280 msdos/pkt_rx0.asm \
281 msdos/pkt_rx1.s \
282 msdos/pktdrvr.c \
283 msdos/pktdrvr.h \
284 msdos/readme.dos \
285 org.tcpdump.chmod_bpf.plist \
286 packaging/pcap.spec.in \
287 pcap-bpf.c \
288 pcap-bt-linux.c \
289 pcap-bt-linux.h \
290 pcap-can-linux.c \
291 pcap-can-linux.h \
86FSRC = fad-@V_FINDALLDEVS@.c
87SSRC = @SSRC@
88CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c etherent.c \
89 savefile.c sf-pcap.c sf-pcap-ng.c pcap-common.c \
90 bpf_image.c bpf_dump.c
91GENSRC = scanner.c grammar.c bpf_filter.c version.c
92LIBOBJS = @LIBOBJS@
93
94SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(GENSRC)
95
96# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
97# hack the extra indirection
98OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
99PUBHDR = \
100 pcap.h \
101 pcap-bpf.h \
102 pcap-namedb.h \
103 pcap/bpf.h \
104 pcap/bluetooth.h \
105 pcap/ipnet.h \
106 pcap/namedb.h \
107 pcap/pcap.h \
108 pcap/sll.h \
109 pcap/vlan.h \
110 pcap/usb.h
111
112HDR = $(PUBHDR) \
113 arcnet.h \
114 atmuni31.h \
115 ethertype.h \
116 gencode.h \
117 ieee80211.h \
118 llc.h \
119 nlpid.h \
120 pcap-common.h \
121 pcap-int.h \
122 pcap-stdinc.h \
123 ppp.h \
124 sf-pcap.h \
125 sf-pcap-ng.h \
126 sunatmpos.h
127
128TESTS = \
129 filtertest \
130 findalldevstest \
131 nonblocktest \
132 opentest \
133 selpolltest
134
135TESTS_SRC = \
136 tests/filtertest.c \
137 tests/findalldevstest.c \
138 tests/nonblocktest.c \
139 tests/opentest.c \
140 tests/reactivatetest.c \
141 tests/selpolltest.c
142
143GENHDR = \
144 scanner.h tokdefs.h version.h
145
146TAGFILES = \
147 $(SRC) $(HDR)
148
149CLEANFILES = $(OBJ) libpcap.* $(TESTS) \
150 $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
151 lex.yy.c pcap-config
152
153MAN1 = pcap-config.1
154
155MAN3PCAP_EXPAND = \
156 pcap.3pcap.in \
157 pcap_compile.3pcap.in \
158 pcap_datalink.3pcap.in \
159 pcap_dump_open.3pcap.in \
160 pcap_list_datalinks.3pcap.in \
161 pcap_list_tstamp_types.3pcap.in \
162 pcap_open_dead.3pcap.in \
163 pcap_open_offline.3pcap.in \
164 pcap_set_tstamp_type.3pcap.in
165
166MAN3PCAP_NOEXPAND = \
167 pcap_activate.3pcap \
168 pcap_breakloop.3pcap \
169 pcap_can_set_rfmon.3pcap \
170 pcap_close.3pcap \
171 pcap_create.3pcap \
172 pcap_datalink_name_to_val.3pcap \
173 pcap_datalink_val_to_name.3pcap \
174 pcap_dump.3pcap \
175 pcap_dump_close.3pcap \
176 pcap_dump_file.3pcap \
177 pcap_dump_flush.3pcap \
178 pcap_dump_ftell.3pcap \
179 pcap_file.3pcap \
180 pcap_fileno.3pcap \
181 pcap_findalldevs.3pcap \
182 pcap_freecode.3pcap \
183 pcap_get_selectable_fd.3pcap \
184 pcap_geterr.3pcap \
185 pcap_inject.3pcap \
186 pcap_is_swapped.3pcap \
187 pcap_lib_version.3pcap \
188 pcap_lookupdev.3pcap \
189 pcap_lookupnet.3pcap \
190 pcap_loop.3pcap \
191 pcap_major_version.3pcap \
192 pcap_next_ex.3pcap \
193 pcap_offline_filter.3pcap \
194 pcap_open_live.3pcap \
195 pcap_set_buffer_size.3pcap \
196 pcap_set_datalink.3pcap \
197 pcap_set_promisc.3pcap \
198 pcap_set_rfmon.3pcap \
199 pcap_set_snaplen.3pcap \
200 pcap_set_timeout.3pcap \
201 pcap_setdirection.3pcap \
202 pcap_setfilter.3pcap \
203 pcap_setnonblock.3pcap \
204 pcap_snapshot.3pcap \
205 pcap_stats.3pcap \
206 pcap_statustostr.3pcap \
207 pcap_strerror.3pcap \
208 pcap_tstamp_type_name_to_val.3pcap \
209 pcap_tstamp_type_val_to_name.3pcap
210
211MAN3PCAP = $(MAN3PCAP_NOEXPAND) $(MAN3PCAP_EXPAND:.in=)
212
213MANFILE = \
214 pcap-savefile.manfile.in
215
216MANMISC = \
217 pcap-filter.manmisc.in \
218 pcap-linktype.manmisc.in \
219 pcap-tstamp.manmisc.in
220
221EXTRA_DIST = \
222 $(TESTS_SRC) \
223 CHANGES \
224 ChmodBPF/ChmodBPF \
225 ChmodBPF/StartupParameters.plist \
226 CREDITS \
227 INSTALL.txt \
228 LICENSE \
229 Makefile.in \
230 README \
231 README.aix \
232 README.dag \
233 README.hpux \
234 README.linux \
235 README.macosx \
236 README.septel \
237 README.sita \
238 README.tru64 \
239 README.Win32 \
240 SUNOS4/nit_if.o.sparc \
241 SUNOS4/nit_if.o.sun3 \
242 SUNOS4/nit_if.o.sun4c.4.0.3c \
243 TODO \
244 VERSION \
245 aclocal.m4 \
246 bpf/net/bpf_filter.c \
247 chmod_bpf \
248 config.guess \
249 config.h.in \
250 config.sub \
251 configure \
252 configure.in \
253 dlpisubs.c \
254 dlpisubs.h \
255 fad-getad.c \
256 fad-gifc.c \
257 fad-glifc.c \
258 fad-null.c \
259 fad-sita.c \
260 fad-win32.c \
261 grammar.y \
262 install-sh \
263 lbl/os-aix4.h \
264 lbl/os-hpux11.h \
265 lbl/os-osf4.h \
266 lbl/os-osf5.h \
267 lbl/os-solaris2.h \
268 lbl/os-sunos4.h \
269 lbl/os-ultrix4.h \
270 missing/snprintf.c \
271 mkdep \
272 msdos/bin2c.c \
273 msdos/common.dj \
274 msdos/makefile \
275 msdos/makefile.dj \
276 msdos/makefile.wc \
277 msdos/ndis2.c \
278 msdos/ndis2.h \
279 msdos/ndis_0.asm \
280 msdos/pkt_rx0.asm \
281 msdos/pkt_rx1.s \
282 msdos/pktdrvr.c \
283 msdos/pktdrvr.h \
284 msdos/readme.dos \
285 org.tcpdump.chmod_bpf.plist \
286 packaging/pcap.spec.in \
287 pcap-bpf.c \
288 pcap-bt-linux.c \
289 pcap-bt-linux.h \
290 pcap-can-linux.c \
291 pcap-can-linux.h \
292 pcap-canusb-linux.c \
293 pcap-canusb-linux.h \
292 pcap-config.in \
293 pcap-dag.c \
294 pcap-dag.h \
295 pcap-dlpi.c \
296 pcap-dos.c \
297 pcap-dos.h \
298 pcap-enet.c \
299 pcap-int.h \
300 pcap-libdlpi.c \
301 pcap-linux.c \
302 pcap-namedb.h \
303 pcap-netfilter-linux.c \
304 pcap-netfilter-linux.h \
305 pcap-nit.c \
306 pcap-null.c \
307 pcap-pf.c \
308 pcap-septel.c \
309 pcap-septel.h \
310 pcap-sita.h \
311 pcap-sita.c \
312 pcap-sita.html \
313 pcap-snf.c \
314 pcap-snf.h \
315 pcap-snit.c \
316 pcap-snoop.c \
317 pcap-usb-linux.c \
318 pcap-usb-linux.h \
319 pcap-win32.c \
320 runlex.sh \
321 scanner.l \
322 Win32/Include/Gnuc.h \
323 Win32/Include/addrinfo.h \
324 Win32/Include/bittypes.h \
325 Win32/Include/cdecl_ext.h \
326 Win32/Include/inetprivate.h \
327 Win32/Include/ip6_misc.h \
328 Win32/Include/sockstorage.h \
329 Win32/Include/arpa/nameser.h \
330 Win32/Include/net/if.h \
331 Win32/Include/net/netdb.h \
332 Win32/Include/net/paths.h \
333 Win32/Prj/libpcap.dsp \
334 Win32/Prj/libpcap.dsw \
335 Win32/Src/ffs.c \
336 Win32/Src/gai_strerror.c \
337 Win32/Src/getaddrinfo.c \
338 Win32/Src/getnetbynm.c \
339 Win32/Src/getnetent.c \
340 Win32/Src/getopt.c \
341 Win32/Src/getservent.c \
342 Win32/Src/inet_aton.c \
343 Win32/Src/inet_net.c \
344 Win32/Src/inet_pton.c
345
346all: libpcap.a shared pcap-config
347
348libpcap.a: $(OBJ)
349 @rm -f $@
350 $(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
351 $(RANLIB) $@
352
353shared: libpcap.$(DYEXT)
354
355libpcap.so: $(OBJ)
356 @rm -f $@
357 VER=`cat $(srcdir)/VERSION`; \
358 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
359 @V_SHLIB_CMD@ @V_SHLIB_OPT@ @V_SONAME_OPT@$@.$$MAJOR_VER $(LDFLAGS) \
360 -o $@.$$VER $(OBJ) $(ADDLOBJS) $(LIBS)
361
362#
363# The following rule succeeds, but the result is untested.
364#
365# In Mac OS X, the libpcap dylib has the name "libpcap.A.dylib", with
366# its full path as the install_name, and with the compatibility and
367# current version both set to 1. The compatibility version is set to
368# 1 so that programs built with a newer version of the library will run
369# against older versions; multi-platform software probably will fail if
370# it uses APIs added in the newer version, but Mac OS X-specific software
371# will use weak linking and check at run time whether those APIs are
372# available.
373#
374# We also use "A" as the major version, and 1 as the compatibility version,
375# but set the current version to the value in VERSION, with any non-numeric
376# stuff stripped off (the compatibility and current version must be of the
377# form X[.Y[.Z]], with Y and Z possibly absent, and with all components
378# numeric).
379#
380libpcap.dylib: $(OBJ)
381 rm -f libpcap*.dylib
382 VER=`cat $(srcdir)/VERSION`; \
383 MAJOR_VER=A; \
384 COMPAT_VER=1; \
385 CURRENT_VER=`sed 's/[^0-9.].*$$//' $(srcdir)/VERSION`; \
386 $(CC) -dynamiclib -undefined error $(LDFLAGS) \
387 -o libpcap.$$VER.dylib $(OBJ) $(ADDLOBJS) $(LIBS) \
388 -install_name $(libdir)/libpcap.$$MAJOR_VER.dylib \
389 -compatibility_version $$COMPAT_VER \
390 -current_version $$CURRENT_VER
391
392#
393# The HP-UX linker manual says that the convention for a versioned library
394# is libXXX.{number}, not libXXX.sl.{number}. That appears to be the case
395# on at least one HP-UX 11.00 system; libXXX.sl is a symlink to
396# libXXX.{number}.
397#
398# The manual also says "library-level versioning" (think "sonames") was
399# added in HP-UX 10.0.
400#
401# XXX - this assumes we're using the HP linker, rather than the GNU
402# linker, even with GCC.
403#
404libpcap.sl: $(OBJ)
405 @MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
406 rm -f libpcap.$$MAJOR_VER
407 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
408 ld -b $(LDFLAGS) -o libpcap.$$MAJOR_VER +h libpcap.$$MAJOR_VER \
409 $(OBJ) $(ADDLOBJS) $(LIBS)
410
411#
412# AIX is different from everybody else. A shared library is an archive
413# library with one or more shared-object components. We still build a
414# normal static archive library on AIX, for the benefit of the traditional
415# scheme of building libpcap and tcpdump in subdirectories of the
416# same directory, with tcpdump statically linked with the libpcap
417# in question, but we also build a shared library as "libpcap.shareda"
418# and install *it*, rather than the static library, as "libpcap.a".
419#
420libpcap.shareda: $(OBJ)
421 @rm -f $@ shr.o
422 $(CC) @V_SHLIB_OPT@ -o shr.o $(OBJ) $(ADDLOBJS) $(LDFLAGS) $(LIBS)
423 $(AR) rc $@ shr.o
424
425#
426# For platforms that don't support shared libraries (or on which we
427# don't support shared libraries).
428#
429libpcap.none:
430
431scanner.c: $(srcdir)/scanner.l
432 @rm -f $@
433 $(srcdir)/runlex.sh $(LEX) -o$@ $<
434
435scanner.o: scanner.c tokdefs.h
436 $(CC) $(FULL_CFLAGS) -c scanner.c
437
438pcap.o: version.h
439
440tokdefs.h: grammar.c
441grammar.c: $(srcdir)/grammar.y
442 @rm -f grammar.c tokdefs.h
443 $(YACC) -d $<
444 mv y.tab.c grammar.c
445 mv y.tab.h tokdefs.h
446
447grammar.o: grammar.c
448 @rm -f $@
449 $(CC) $(FULL_CFLAGS) -Dyylval=pcap_lval -c grammar.c
450
451version.o: version.c
452 $(CC) $(FULL_CFLAGS) -c version.c
453
454snprintf.o: $(srcdir)/missing/snprintf.c
455 $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
456
457version.c: $(srcdir)/VERSION
458 @rm -f $@
459 if grep GIT ${srcdir}/VERSION >/dev/null; then \
460 read ver <${srcdir}/VERSION; \
461 echo $$ver | tr -d '\012'; \
462 date +_%Y_%m_%d; \
463 else \
464 cat ${srcdir}/VERSION; \
465 fi | sed -e 's/.*/char pcap_version[] = "&";/' > $@
466
467#
468# NOTE: this really is supposed to be static; importing a string
469# from a shared library does not work very well on many
470# versions of UNIX (Solaris, Linux, and the BSDs, for example),
471# so we make the version string static and return it from
472# a function, which does work.
473#
474version.h: $(srcdir)/VERSION
475 @rm -f $@
476 if grep GIT ${srcdir}/VERSION >/dev/null; then \
477 read ver <${srcdir}/VERSION; \
478 echo $$ver | tr -d '\012'; \
479 date +_%Y_%m_%d; \
480 else \
481 cat ${srcdir}/VERSION; \
482 fi | sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' > $@
483
484bpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c
485 rm -f bpf_filter.c
486 ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c
487
488bpf_filter.o: bpf_filter.c
489 $(CC) $(FULL_CFLAGS) -c bpf_filter.c
490
491#
492# Generate the pcap-config script.
493#
494# Some Makes, e.g. AIX Make and Solaris Make, can't handle "--file=$@.tmp:$<";
495# for example, the Solaris 9 make man page says
496#
497# Because make assigns $< and $* as it would for implicit rules
498# (according to the suffixes list and the directory contents),
499# they may be unreliable when used within explicit target entries.
500#
501# and this is an explicit target entry.
502#
503# Therefore, instead of using $<, we explicitly put in $(srcdir)/pcap-config.in.
504#
505pcap-config: $(srcdir)/pcap-config.in ./config.status
506 @rm -f $@ $@.tmp
507 ./config.status --file=$@.tmp:$(srcdir)/pcap-config.in
508 mv $@.tmp $@
509 chmod a+x $@
510
511#
512# Test programs - not built by default, and not installed.
513#
514tests: $(TESTS)
515
516filtertest: tests/filtertest.c libpcap.a
517 $(CC) $(FULL_CFLAGS) -I. -L. -o filtertest $(srcdir)/tests/filtertest.c libpcap.a $(LIBS)
518
519findalldevstest: tests/findalldevstest.c libpcap.a
520 $(CC) $(FULL_CFLAGS) -I. -L. -o findalldevstest $(srcdir)/tests/findalldevstest.c libpcap.a $(LIBS)
521
522nonblocktest: tests/nonblocktest.c libpcap.a
523 $(CC) $(FULL_CFLAGS) -I. -L. -o nonblocktest $(srcdir)/tests/nonblocktest.c libpcap.a $(LIBS)
524
525opentest: tests/opentest.c libpcap.a
526 $(CC) $(FULL_CFLAGS) -I. -L. -o opentest $(srcdir)/tests/opentest.c libpcap.a $(LIBS)
527
528selpolltest: tests/selpolltest.c libpcap.a
529 $(CC) $(FULL_CFLAGS) -I. -L. -o selpolltest $(srcdir)/tests/selpolltest.c libpcap.a $(LIBS)
530
531install: install-shared install-archive pcap-config
532 [ -d $(DESTDIR)$(libdir) ] || \
533 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
534 [ -d $(DESTDIR)$(includedir) ] || \
535 (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
536 [ -d $(DESTDIR)$(includedir)/pcap ] || \
537 (mkdir -p $(DESTDIR)$(includedir)/pcap; chmod 755 $(DESTDIR)$(includedir)/pcap)
538 [ -d $(DESTDIR)$(mandir)/man1 ] || \
539 (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
540 [ -d $(DESTDIR)$(mandir)/man3 ] || \
541 (mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
542 [ -d $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@ ] || \
543 (mkdir -p $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@)
544 [ -d $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@ ] || \
545 (mkdir -p $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@)
546 for i in $(PUBHDR); do \
547 $(INSTALL_DATA) $(srcdir)/$$i \
548 $(DESTDIR)$(includedir)/$$i; done
549 [ -d $(DESTDIR)$(bindir) ] || \
550 (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir))
551 $(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config
552 for i in $(MAN1); do \
553 $(INSTALL_DATA) $(srcdir)/$$i \
554 $(DESTDIR)$(mandir)/man1/$$i; done
555 for i in $(MAN3PCAP_NOEXPAND); do \
556 $(INSTALL_DATA) $(srcdir)/$$i \
557 $(DESTDIR)$(mandir)/man3/$$i; done
558 for i in $(MAN3PCAP_EXPAND:.in=); do \
559 $(INSTALL_DATA) $$i \
560 $(DESTDIR)$(mandir)/man3/$$i; done
561 rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
562 ln $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_name.3pcap \
563 $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
564 rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
565 ln $(DESTDIR)$(mandir)/man3/pcap_dump_open.3pcap \
566 $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
567 rm -f $(DESTDIR)$(mandir)/man3/pcap_freealldevs.3pcap
568 ln $(DESTDIR)$(mandir)/man3/pcap_findalldevs.3pcap \
569 $(DESTDIR)$(mandir)/man3/pcap_freealldevs.3pcap
570 rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
571 ln $(DESTDIR)$(mandir)/man3/pcap_geterr.3pcap \
572 $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
573 rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
574 ln $(DESTDIR)$(mandir)/man3/pcap_inject.3pcap \
575 $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
576 rm -f $(DESTDIR)$(mandir)/man3/pcap_free_datalinks.3pcap
577 ln $(DESTDIR)$(mandir)/man3/pcap_list_datalinks.3pcap \
578 $(DESTDIR)$(mandir)/man3/pcap_free_datalinks.3pcap
579 rm -f $(DESTDIR)$(mandir)/man3/pcap_free_tstamp_types.3pcap
580 ln $(DESTDIR)$(mandir)/man3/pcap_list_tstamp_types.3pcap \
581 $(DESTDIR)$(mandir)/man3/pcap_free_tstamp_types.3pcap
582 rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
583 ln $(DESTDIR)$(mandir)/man3/pcap_loop.3pcap \
584 $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
585 rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
586 ln $(DESTDIR)$(mandir)/man3/pcap_major_version.3pcap \
587 $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
588 rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
589 ln $(DESTDIR)$(mandir)/man3/pcap_next_ex.3pcap \
590 $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
591 rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
592 ln $(DESTDIR)$(mandir)/man3/pcap_open_offline.3pcap \
593 $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
594 rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
595 ln $(DESTDIR)$(mandir)/man3/pcap_setnonblock.3pcap \
596 $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
597 for i in $(MANFILE); do \
598 $(INSTALL_DATA) `echo $$i | sed 's/.manfile.in/.manfile/'` \
599 $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
600 for i in $(MANMISC); do \
601 $(INSTALL_DATA) `echo $$i | sed 's/.manmisc.in/.manmisc/'` \
602 $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
603
604install-shared: install-shared-$(DYEXT)
605install-shared-so: libpcap.so
606 [ -d $(DESTDIR)$(libdir) ] || \
607 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
608 VER=`cat $(srcdir)/VERSION`; \
609 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
610 $(INSTALL_PROGRAM) libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
611 ln -sf libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
612 ln -sf libpcap.so.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.so
613install-shared-dylib: libpcap.dylib
614 [ -d $(DESTDIR)$(libdir) ] || \
615 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
616 VER=`cat $(srcdir)/VERSION`; \
617 MAJOR_VER=A; \
618 $(INSTALL_PROGRAM) libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
619 ln -sf libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
620 ln -sf libpcap.$$MAJOR_VER.dylib $(DESTDIR)$(libdir)/libpcap.dylib
621install-shared-sl: libpcap.sl
622 [ -d $(DESTDIR)$(libdir) ] || \
623 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
624 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
625 $(INSTALL_PROGRAM) libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)
626 ln -sf libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.sl
627install-shared-shareda: libpcap.shareda
628 #
629 # AIX shared libraries are weird. They're archive libraries
630 # with one or more shared object components.
631 #
632 [ -d $(DESTDIR)$(libdir) ] || \
633 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
634 $(INSTALL_PROGRAM) libpcap.shareda $(DESTDIR)$(libdir)/libpcap.a
635install-shared-none:
636
637install-archive: install-archive-$(DYEXT)
638install-archive-so install-archive-dylib install-archive-sl install-archive-none: libpcap.a
639 #
640 # Most platforms have separate suffixes for shared and
641 # archive libraries, so we install both.
642 #
643 [ -d $(DESTDIR)$(libdir) ] || \
644 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
645 $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
646 $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
647install-archive-shareda:
648 #
649 # AIX, however, doesn't, so we don't install the archive
650 # library on AIX.
651 #
652
653uninstall: uninstall-shared
654 rm -f $(DESTDIR)$(libdir)/libpcap.a
655 for i in $(PUBHDR); do \
656 rm -f $(DESTDIR)$(includedir)/$$i; done
657 -rmdir $(DESTDIR)$(includedir)/pcap
658 rm -f $(DESTDIR)/$(bindir)/pcap-config
659 for i in $(MAN1); do \
660 rm -f $(DESTDIR)$(mandir)/man1/$$i; done
661 for i in $(MAN3PCAP); do \
662 rm -f $(DESTDIR)$(mandir)/man3/$$i; done
663 rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
664 rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
665 rm -f $(DESTDIR)$(mandir)/man3/pcap_freealldevs.3pcap
666 rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
667 rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
668 rm -f $(DESTDIR)$(mandir)/man3/pcap_free_datalinks.3pcap
669 rm -f $(DESTDIR)$(mandir)/man3/pcap_free_tstamp_types.3pcap
670 rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
671 rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
672 rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
673 rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
674 rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
675 for i in $(MANFILE); do \
676 rm -f $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
677 for i in $(MANMISC); do \
678 rm -f $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
679
680uninstall-shared: uninstall-shared-$(DYEXT)
681uninstall-shared-so:
682 VER=`cat $(srcdir)/VERSION`; \
683 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
684 rm -f $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
685 rm -f $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
686 rm -f $(DESTDIR)$(libdir)/libpcap.so
687uninstall-shared-dylib:
688 VER=`cat $(srcdir)/VERSION`; \
689 MAJOR_VER=A; \
690 rm -f $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
691 rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
692 rm -f $(DESTDIR)$(libdir)/libpcap.dylib
693uninstall-shared-sl:
694 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
695 rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER; \
696 rm -f $(DESTDIR)$(libdir)/libpcap.sl
697uninstall-shared-shareda:
698 rm -f $(DESTDIR)$(libdir)/libpcap.a
699uninstall-shared-none:
700
701clean:
702 rm -f $(CLEANFILES)
703
704distclean: clean
705 rm -f Makefile config.cache config.log config.status \
706 config.h gnuc.h net os-proto.h bpf_filter.c pcap-config \
707 stamp-h stamp-h.in
708 rm -f $(MAN3PCAP_EXPAND:.in=) $(MANFILE:.in=) $(MANMISC:.in=)
709 rm -rf autom4te.cache
710
711tags: $(TAGFILES)
712 ctags -wtd $(TAGFILES)
713
714packaging/pcap.spec: packaging/pcap.spec.in VERSION
715 RPMVERSION=`cat VERSION | sed s/-.*//g`; \
716 sed -e s/@VERSION@/$$RPMVERSION/ -e s/@NAME@/libpcap-`cat VERSION`/ $< > $@
717
718releasetar:
719 @cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
720 mkdir $$name; \
721 tar cf - $(CSRC) $(HDR) $(MAN1) $(MAN3PCAP_EXPAND) \
722 $(MAN3PCAP_NOEXPAND) $(MANFILE) $(MANMISC) $(EXTRA_DIST) | \
723 (cd $$name; tar xf -); \
724 tar -c -z -f $$name.tar.gz $$name; \
725 rm -rf $$name
726
727depend: $(GENSRC) $(GENHDR) bpf_filter.c
728 ./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
729
730Makefile: Makefile.in config.status
731 ./config.status
732 @echo your Makefile was out of date, now run $(MAKE) again
733 exit 1
294 pcap-config.in \
295 pcap-dag.c \
296 pcap-dag.h \
297 pcap-dlpi.c \
298 pcap-dos.c \
299 pcap-dos.h \
300 pcap-enet.c \
301 pcap-int.h \
302 pcap-libdlpi.c \
303 pcap-linux.c \
304 pcap-namedb.h \
305 pcap-netfilter-linux.c \
306 pcap-netfilter-linux.h \
307 pcap-nit.c \
308 pcap-null.c \
309 pcap-pf.c \
310 pcap-septel.c \
311 pcap-septel.h \
312 pcap-sita.h \
313 pcap-sita.c \
314 pcap-sita.html \
315 pcap-snf.c \
316 pcap-snf.h \
317 pcap-snit.c \
318 pcap-snoop.c \
319 pcap-usb-linux.c \
320 pcap-usb-linux.h \
321 pcap-win32.c \
322 runlex.sh \
323 scanner.l \
324 Win32/Include/Gnuc.h \
325 Win32/Include/addrinfo.h \
326 Win32/Include/bittypes.h \
327 Win32/Include/cdecl_ext.h \
328 Win32/Include/inetprivate.h \
329 Win32/Include/ip6_misc.h \
330 Win32/Include/sockstorage.h \
331 Win32/Include/arpa/nameser.h \
332 Win32/Include/net/if.h \
333 Win32/Include/net/netdb.h \
334 Win32/Include/net/paths.h \
335 Win32/Prj/libpcap.dsp \
336 Win32/Prj/libpcap.dsw \
337 Win32/Src/ffs.c \
338 Win32/Src/gai_strerror.c \
339 Win32/Src/getaddrinfo.c \
340 Win32/Src/getnetbynm.c \
341 Win32/Src/getnetent.c \
342 Win32/Src/getopt.c \
343 Win32/Src/getservent.c \
344 Win32/Src/inet_aton.c \
345 Win32/Src/inet_net.c \
346 Win32/Src/inet_pton.c
347
348all: libpcap.a shared pcap-config
349
350libpcap.a: $(OBJ)
351 @rm -f $@
352 $(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
353 $(RANLIB) $@
354
355shared: libpcap.$(DYEXT)
356
357libpcap.so: $(OBJ)
358 @rm -f $@
359 VER=`cat $(srcdir)/VERSION`; \
360 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
361 @V_SHLIB_CMD@ @V_SHLIB_OPT@ @V_SONAME_OPT@$@.$$MAJOR_VER $(LDFLAGS) \
362 -o $@.$$VER $(OBJ) $(ADDLOBJS) $(LIBS)
363
364#
365# The following rule succeeds, but the result is untested.
366#
367# In Mac OS X, the libpcap dylib has the name "libpcap.A.dylib", with
368# its full path as the install_name, and with the compatibility and
369# current version both set to 1. The compatibility version is set to
370# 1 so that programs built with a newer version of the library will run
371# against older versions; multi-platform software probably will fail if
372# it uses APIs added in the newer version, but Mac OS X-specific software
373# will use weak linking and check at run time whether those APIs are
374# available.
375#
376# We also use "A" as the major version, and 1 as the compatibility version,
377# but set the current version to the value in VERSION, with any non-numeric
378# stuff stripped off (the compatibility and current version must be of the
379# form X[.Y[.Z]], with Y and Z possibly absent, and with all components
380# numeric).
381#
382libpcap.dylib: $(OBJ)
383 rm -f libpcap*.dylib
384 VER=`cat $(srcdir)/VERSION`; \
385 MAJOR_VER=A; \
386 COMPAT_VER=1; \
387 CURRENT_VER=`sed 's/[^0-9.].*$$//' $(srcdir)/VERSION`; \
388 $(CC) -dynamiclib -undefined error $(LDFLAGS) \
389 -o libpcap.$$VER.dylib $(OBJ) $(ADDLOBJS) $(LIBS) \
390 -install_name $(libdir)/libpcap.$$MAJOR_VER.dylib \
391 -compatibility_version $$COMPAT_VER \
392 -current_version $$CURRENT_VER
393
394#
395# The HP-UX linker manual says that the convention for a versioned library
396# is libXXX.{number}, not libXXX.sl.{number}. That appears to be the case
397# on at least one HP-UX 11.00 system; libXXX.sl is a symlink to
398# libXXX.{number}.
399#
400# The manual also says "library-level versioning" (think "sonames") was
401# added in HP-UX 10.0.
402#
403# XXX - this assumes we're using the HP linker, rather than the GNU
404# linker, even with GCC.
405#
406libpcap.sl: $(OBJ)
407 @MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
408 rm -f libpcap.$$MAJOR_VER
409 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
410 ld -b $(LDFLAGS) -o libpcap.$$MAJOR_VER +h libpcap.$$MAJOR_VER \
411 $(OBJ) $(ADDLOBJS) $(LIBS)
412
413#
414# AIX is different from everybody else. A shared library is an archive
415# library with one or more shared-object components. We still build a
416# normal static archive library on AIX, for the benefit of the traditional
417# scheme of building libpcap and tcpdump in subdirectories of the
418# same directory, with tcpdump statically linked with the libpcap
419# in question, but we also build a shared library as "libpcap.shareda"
420# and install *it*, rather than the static library, as "libpcap.a".
421#
422libpcap.shareda: $(OBJ)
423 @rm -f $@ shr.o
424 $(CC) @V_SHLIB_OPT@ -o shr.o $(OBJ) $(ADDLOBJS) $(LDFLAGS) $(LIBS)
425 $(AR) rc $@ shr.o
426
427#
428# For platforms that don't support shared libraries (or on which we
429# don't support shared libraries).
430#
431libpcap.none:
432
433scanner.c: $(srcdir)/scanner.l
434 @rm -f $@
435 $(srcdir)/runlex.sh $(LEX) -o$@ $<
436
437scanner.o: scanner.c tokdefs.h
438 $(CC) $(FULL_CFLAGS) -c scanner.c
439
440pcap.o: version.h
441
442tokdefs.h: grammar.c
443grammar.c: $(srcdir)/grammar.y
444 @rm -f grammar.c tokdefs.h
445 $(YACC) -d $<
446 mv y.tab.c grammar.c
447 mv y.tab.h tokdefs.h
448
449grammar.o: grammar.c
450 @rm -f $@
451 $(CC) $(FULL_CFLAGS) -Dyylval=pcap_lval -c grammar.c
452
453version.o: version.c
454 $(CC) $(FULL_CFLAGS) -c version.c
455
456snprintf.o: $(srcdir)/missing/snprintf.c
457 $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
458
459version.c: $(srcdir)/VERSION
460 @rm -f $@
461 if grep GIT ${srcdir}/VERSION >/dev/null; then \
462 read ver <${srcdir}/VERSION; \
463 echo $$ver | tr -d '\012'; \
464 date +_%Y_%m_%d; \
465 else \
466 cat ${srcdir}/VERSION; \
467 fi | sed -e 's/.*/char pcap_version[] = "&";/' > $@
468
469#
470# NOTE: this really is supposed to be static; importing a string
471# from a shared library does not work very well on many
472# versions of UNIX (Solaris, Linux, and the BSDs, for example),
473# so we make the version string static and return it from
474# a function, which does work.
475#
476version.h: $(srcdir)/VERSION
477 @rm -f $@
478 if grep GIT ${srcdir}/VERSION >/dev/null; then \
479 read ver <${srcdir}/VERSION; \
480 echo $$ver | tr -d '\012'; \
481 date +_%Y_%m_%d; \
482 else \
483 cat ${srcdir}/VERSION; \
484 fi | sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' > $@
485
486bpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c
487 rm -f bpf_filter.c
488 ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c
489
490bpf_filter.o: bpf_filter.c
491 $(CC) $(FULL_CFLAGS) -c bpf_filter.c
492
493#
494# Generate the pcap-config script.
495#
496# Some Makes, e.g. AIX Make and Solaris Make, can't handle "--file=$@.tmp:$<";
497# for example, the Solaris 9 make man page says
498#
499# Because make assigns $< and $* as it would for implicit rules
500# (according to the suffixes list and the directory contents),
501# they may be unreliable when used within explicit target entries.
502#
503# and this is an explicit target entry.
504#
505# Therefore, instead of using $<, we explicitly put in $(srcdir)/pcap-config.in.
506#
507pcap-config: $(srcdir)/pcap-config.in ./config.status
508 @rm -f $@ $@.tmp
509 ./config.status --file=$@.tmp:$(srcdir)/pcap-config.in
510 mv $@.tmp $@
511 chmod a+x $@
512
513#
514# Test programs - not built by default, and not installed.
515#
516tests: $(TESTS)
517
518filtertest: tests/filtertest.c libpcap.a
519 $(CC) $(FULL_CFLAGS) -I. -L. -o filtertest $(srcdir)/tests/filtertest.c libpcap.a $(LIBS)
520
521findalldevstest: tests/findalldevstest.c libpcap.a
522 $(CC) $(FULL_CFLAGS) -I. -L. -o findalldevstest $(srcdir)/tests/findalldevstest.c libpcap.a $(LIBS)
523
524nonblocktest: tests/nonblocktest.c libpcap.a
525 $(CC) $(FULL_CFLAGS) -I. -L. -o nonblocktest $(srcdir)/tests/nonblocktest.c libpcap.a $(LIBS)
526
527opentest: tests/opentest.c libpcap.a
528 $(CC) $(FULL_CFLAGS) -I. -L. -o opentest $(srcdir)/tests/opentest.c libpcap.a $(LIBS)
529
530selpolltest: tests/selpolltest.c libpcap.a
531 $(CC) $(FULL_CFLAGS) -I. -L. -o selpolltest $(srcdir)/tests/selpolltest.c libpcap.a $(LIBS)
532
533install: install-shared install-archive pcap-config
534 [ -d $(DESTDIR)$(libdir) ] || \
535 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
536 [ -d $(DESTDIR)$(includedir) ] || \
537 (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
538 [ -d $(DESTDIR)$(includedir)/pcap ] || \
539 (mkdir -p $(DESTDIR)$(includedir)/pcap; chmod 755 $(DESTDIR)$(includedir)/pcap)
540 [ -d $(DESTDIR)$(mandir)/man1 ] || \
541 (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
542 [ -d $(DESTDIR)$(mandir)/man3 ] || \
543 (mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
544 [ -d $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@ ] || \
545 (mkdir -p $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@)
546 [ -d $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@ ] || \
547 (mkdir -p $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@)
548 for i in $(PUBHDR); do \
549 $(INSTALL_DATA) $(srcdir)/$$i \
550 $(DESTDIR)$(includedir)/$$i; done
551 [ -d $(DESTDIR)$(bindir) ] || \
552 (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir))
553 $(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config
554 for i in $(MAN1); do \
555 $(INSTALL_DATA) $(srcdir)/$$i \
556 $(DESTDIR)$(mandir)/man1/$$i; done
557 for i in $(MAN3PCAP_NOEXPAND); do \
558 $(INSTALL_DATA) $(srcdir)/$$i \
559 $(DESTDIR)$(mandir)/man3/$$i; done
560 for i in $(MAN3PCAP_EXPAND:.in=); do \
561 $(INSTALL_DATA) $$i \
562 $(DESTDIR)$(mandir)/man3/$$i; done
563 rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
564 ln $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_name.3pcap \
565 $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
566 rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
567 ln $(DESTDIR)$(mandir)/man3/pcap_dump_open.3pcap \
568 $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
569 rm -f $(DESTDIR)$(mandir)/man3/pcap_freealldevs.3pcap
570 ln $(DESTDIR)$(mandir)/man3/pcap_findalldevs.3pcap \
571 $(DESTDIR)$(mandir)/man3/pcap_freealldevs.3pcap
572 rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
573 ln $(DESTDIR)$(mandir)/man3/pcap_geterr.3pcap \
574 $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
575 rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
576 ln $(DESTDIR)$(mandir)/man3/pcap_inject.3pcap \
577 $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
578 rm -f $(DESTDIR)$(mandir)/man3/pcap_free_datalinks.3pcap
579 ln $(DESTDIR)$(mandir)/man3/pcap_list_datalinks.3pcap \
580 $(DESTDIR)$(mandir)/man3/pcap_free_datalinks.3pcap
581 rm -f $(DESTDIR)$(mandir)/man3/pcap_free_tstamp_types.3pcap
582 ln $(DESTDIR)$(mandir)/man3/pcap_list_tstamp_types.3pcap \
583 $(DESTDIR)$(mandir)/man3/pcap_free_tstamp_types.3pcap
584 rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
585 ln $(DESTDIR)$(mandir)/man3/pcap_loop.3pcap \
586 $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
587 rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
588 ln $(DESTDIR)$(mandir)/man3/pcap_major_version.3pcap \
589 $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
590 rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
591 ln $(DESTDIR)$(mandir)/man3/pcap_next_ex.3pcap \
592 $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
593 rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
594 ln $(DESTDIR)$(mandir)/man3/pcap_open_offline.3pcap \
595 $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
596 rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
597 ln $(DESTDIR)$(mandir)/man3/pcap_setnonblock.3pcap \
598 $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
599 for i in $(MANFILE); do \
600 $(INSTALL_DATA) `echo $$i | sed 's/.manfile.in/.manfile/'` \
601 $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
602 for i in $(MANMISC); do \
603 $(INSTALL_DATA) `echo $$i | sed 's/.manmisc.in/.manmisc/'` \
604 $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
605
606install-shared: install-shared-$(DYEXT)
607install-shared-so: libpcap.so
608 [ -d $(DESTDIR)$(libdir) ] || \
609 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
610 VER=`cat $(srcdir)/VERSION`; \
611 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
612 $(INSTALL_PROGRAM) libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
613 ln -sf libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
614 ln -sf libpcap.so.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.so
615install-shared-dylib: libpcap.dylib
616 [ -d $(DESTDIR)$(libdir) ] || \
617 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
618 VER=`cat $(srcdir)/VERSION`; \
619 MAJOR_VER=A; \
620 $(INSTALL_PROGRAM) libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
621 ln -sf libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
622 ln -sf libpcap.$$MAJOR_VER.dylib $(DESTDIR)$(libdir)/libpcap.dylib
623install-shared-sl: libpcap.sl
624 [ -d $(DESTDIR)$(libdir) ] || \
625 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
626 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
627 $(INSTALL_PROGRAM) libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)
628 ln -sf libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.sl
629install-shared-shareda: libpcap.shareda
630 #
631 # AIX shared libraries are weird. They're archive libraries
632 # with one or more shared object components.
633 #
634 [ -d $(DESTDIR)$(libdir) ] || \
635 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
636 $(INSTALL_PROGRAM) libpcap.shareda $(DESTDIR)$(libdir)/libpcap.a
637install-shared-none:
638
639install-archive: install-archive-$(DYEXT)
640install-archive-so install-archive-dylib install-archive-sl install-archive-none: libpcap.a
641 #
642 # Most platforms have separate suffixes for shared and
643 # archive libraries, so we install both.
644 #
645 [ -d $(DESTDIR)$(libdir) ] || \
646 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
647 $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
648 $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
649install-archive-shareda:
650 #
651 # AIX, however, doesn't, so we don't install the archive
652 # library on AIX.
653 #
654
655uninstall: uninstall-shared
656 rm -f $(DESTDIR)$(libdir)/libpcap.a
657 for i in $(PUBHDR); do \
658 rm -f $(DESTDIR)$(includedir)/$$i; done
659 -rmdir $(DESTDIR)$(includedir)/pcap
660 rm -f $(DESTDIR)/$(bindir)/pcap-config
661 for i in $(MAN1); do \
662 rm -f $(DESTDIR)$(mandir)/man1/$$i; done
663 for i in $(MAN3PCAP); do \
664 rm -f $(DESTDIR)$(mandir)/man3/$$i; done
665 rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
666 rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
667 rm -f $(DESTDIR)$(mandir)/man3/pcap_freealldevs.3pcap
668 rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
669 rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
670 rm -f $(DESTDIR)$(mandir)/man3/pcap_free_datalinks.3pcap
671 rm -f $(DESTDIR)$(mandir)/man3/pcap_free_tstamp_types.3pcap
672 rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
673 rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
674 rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
675 rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
676 rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
677 for i in $(MANFILE); do \
678 rm -f $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
679 for i in $(MANMISC); do \
680 rm -f $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
681
682uninstall-shared: uninstall-shared-$(DYEXT)
683uninstall-shared-so:
684 VER=`cat $(srcdir)/VERSION`; \
685 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
686 rm -f $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
687 rm -f $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
688 rm -f $(DESTDIR)$(libdir)/libpcap.so
689uninstall-shared-dylib:
690 VER=`cat $(srcdir)/VERSION`; \
691 MAJOR_VER=A; \
692 rm -f $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
693 rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
694 rm -f $(DESTDIR)$(libdir)/libpcap.dylib
695uninstall-shared-sl:
696 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
697 rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER; \
698 rm -f $(DESTDIR)$(libdir)/libpcap.sl
699uninstall-shared-shareda:
700 rm -f $(DESTDIR)$(libdir)/libpcap.a
701uninstall-shared-none:
702
703clean:
704 rm -f $(CLEANFILES)
705
706distclean: clean
707 rm -f Makefile config.cache config.log config.status \
708 config.h gnuc.h net os-proto.h bpf_filter.c pcap-config \
709 stamp-h stamp-h.in
710 rm -f $(MAN3PCAP_EXPAND:.in=) $(MANFILE:.in=) $(MANMISC:.in=)
711 rm -rf autom4te.cache
712
713tags: $(TAGFILES)
714 ctags -wtd $(TAGFILES)
715
716packaging/pcap.spec: packaging/pcap.spec.in VERSION
717 RPMVERSION=`cat VERSION | sed s/-.*//g`; \
718 sed -e s/@VERSION@/$$RPMVERSION/ -e s/@NAME@/libpcap-`cat VERSION`/ $< > $@
719
720releasetar:
721 @cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
722 mkdir $$name; \
723 tar cf - $(CSRC) $(HDR) $(MAN1) $(MAN3PCAP_EXPAND) \
724 $(MAN3PCAP_NOEXPAND) $(MANFILE) $(MANMISC) $(EXTRA_DIST) | \
725 (cd $$name; tar xf -); \
726 tar -c -z -f $$name.tar.gz $$name; \
727 rm -rf $$name
728
729depend: $(GENSRC) $(GENHDR) bpf_filter.c
730 ./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
731
732Makefile: Makefile.in config.status
733 ./config.status
734 @echo your Makefile was out of date, now run $(MAKE) again
735 exit 1