]> The Tcpdump Group git mirrors - libpcap/blob - Makefile.in
Remove some apparently-unneeded includes.
[libpcap] / Makefile.in
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 #
21 # Various configurable paths (remember to edit Makefile.in, not Makefile)
22 #
23
24 # Top level hierarchy
25 prefix = @prefix@
26 exec_prefix = @exec_prefix@
27 datarootdir = @datarootdir@
28 # Pathname of directory to install the configure program
29 bindir = @bindir@
30 # Pathname of directory to install the rpcapd daemon
31 sbindir = @sbindir@
32 # Pathname of directory to install the include files
33 includedir = @includedir@
34 # Pathname of directory to install the library
35 libdir = @libdir@
36 # Pathname of directory to install the man pages
37 mandir = @mandir@
38
39 # VPATH
40 srcdir = @srcdir@
41 top_srcdir = @top_srcdir@
42 VPATH = @srcdir@
43
44 #
45 # You shouldn't need to edit anything below.
46 #
47
48 LD = /usr/bin/ld
49 CC = @CC@
50 AR = @AR@
51 LN_S = @LN_S@
52 MKDEP = @MKDEP@
53 CCOPT = @V_CCOPT@
54 SHLIB_CCOPT = @V_SHLIB_CCOPT@
55 INCLS = -I. @V_INCLS@
56 DEFS = -DBUILDING_PCAP -Dpcap_EXPORTS @DEFS@ @V_DEFS@
57 ADDLOBJS = @ADDLOBJS@
58 ADDLARCHIVEOBJS = @ADDLARCHIVEOBJS@
59 LIBS = @LIBS@
60 CROSSFLAGS=
61 CFLAGS = @CFLAGS@ ${CROSSFLAGS}
62 LDFLAGS = @LDFLAGS@ ${CROSSFLAGS}
63 DYEXT = @DYEXT@
64 RPATH = @RPATH@
65 DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@
66 PROG=libpcap
67 PTHREAD_LIBS=@PTHREAD_LIBS@
68 BUILD_RPCAPD=@BUILD_RPCAPD@
69 INSTALL_RPCAPD=@INSTALL_RPCAPD@
70
71 # Standard CFLAGS for building members of a shared library
72 FULL_CFLAGS = $(CCOPT) @V_LIB_CCOPT_FAT@ $(SHLIB_CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
73
74 INSTALL = @INSTALL@
75 INSTALL_PROGRAM = @INSTALL_PROGRAM@
76 INSTALL_DATA = @INSTALL_DATA@
77 RANLIB = @RANLIB@
78
79 LEX = @LEX@
80 BISON_BYACC = @BISON_BYACC@
81
82 .c.o:
83 $(CC) $(FULL_CFLAGS) -c -o $@ $<
84
85 PLATFORM_C_SRC = @PLATFORM_C_SRC@
86 MODULE_C_SRC = @MODULE_C_SRC@
87 REMOTE_C_SRC = @REMOTE_C_SRC@
88 COMMON_C_SRC = pcap.c gencode.c optimize.c nametoaddr.c etherent.c \
89 fmtutils.c pcap-util.c \
90 savefile.c sf-pcap.c sf-pcapng.c pcap-common.c \
91 bpf_image.c bpf_filter.c bpf_dump.c
92 GENERATED_C_SRC = scanner.c grammar.c
93 LIBOBJS = @LIBOBJS@
94
95 SRC = $(PLATFORM_C_SRC) \
96 $(MODULE_C_SRC) $(REMOTE_C_SRC) $(COMMON_C_SRC) \
97 $(GENERATED_C_SRC)
98
99 OBJ = $(SRC:.c=.o) $(LIBOBJS)
100
101 PUBHDR = \
102 pcap.h \
103 pcap-bpf.h \
104 pcap-namedb.h \
105 pcap/bluetooth.h \
106 pcap/bpf.h \
107 pcap/can_socketcan.h \
108 pcap/compiler-tests.h \
109 pcap/dlt.h \
110 pcap/funcattrs.h \
111 pcap/ipnet.h \
112 pcap/namedb.h \
113 pcap/nflog.h \
114 pcap/pcap-inttypes.h \
115 pcap/pcap.h \
116 pcap/sll.h \
117 pcap/socket.h \
118 pcap/usb.h \
119 pcap/vlan.h
120
121 HDR = $(PUBHDR) \
122 diag-control.h \
123 ethertype.h \
124 extract.h \
125 fmtutils.h \
126 ftmacros.h \
127 gencode.h \
128 ieee80211.h \
129 llc.h \
130 nametoaddr.h \
131 optimize.h \
132 pcap-common.h \
133 pcap-int.h \
134 pcap-rpcap.h \
135 pcap-types.h \
136 pcap-usb-linux-common.h \
137 pcap-util.h \
138 pflog.h \
139 portability.h \
140 ppp.h \
141 rpcap-protocol.h \
142 sf-pcap.h \
143 sf-pcapng.h \
144 thread-local.h \
145 varattrs.h
146
147 GENHDR = \
148 scanner.h grammar.h
149
150 TAGFILES = \
151 $(SRC) $(HDR)
152
153 CLEANFILES = $(OBJ) libpcap.a libpcap.so.`cat $(srcdir)/VERSION` \
154 $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENERATED_C_SRC) $(GENHDR) \
155 lex.yy.c pcap-config libpcap.pc libpcap.$(DYEXT)
156
157 MAN1 = pcap-config.1
158
159 MAN3PCAP_EXPAND = \
160 pcap.3pcap.in \
161 pcap_compile.3pcap.in \
162 pcap_datalink.3pcap.in \
163 pcap_dump_open.3pcap.in \
164 pcap_get_tstamp_precision.3pcap.in \
165 pcap_list_datalinks.3pcap.in \
166 pcap_list_tstamp_types.3pcap.in \
167 pcap_open_dead.3pcap.in \
168 pcap_open_offline.3pcap.in \
169 pcap_set_immediate_mode.3pcap.in \
170 pcap_set_tstamp_precision.3pcap.in \
171 pcap_set_tstamp_type.3pcap.in
172
173 MAN3PCAP_NOEXPAND = \
174 pcap_activate.3pcap \
175 pcap_breakloop.3pcap \
176 pcap_can_set_rfmon.3pcap \
177 pcap_close.3pcap \
178 pcap_create.3pcap \
179 pcap_datalink_name_to_val.3pcap \
180 pcap_datalink_val_to_name.3pcap \
181 pcap_dump.3pcap \
182 pcap_dump_close.3pcap \
183 pcap_dump_file.3pcap \
184 pcap_dump_flush.3pcap \
185 pcap_dump_ftell.3pcap \
186 pcap_file.3pcap \
187 pcap_fileno.3pcap \
188 pcap_findalldevs.3pcap \
189 pcap_freecode.3pcap \
190 pcap_get_required_select_timeout.3pcap \
191 pcap_get_selectable_fd.3pcap \
192 pcap_geterr.3pcap \
193 pcap_init.3pcap \
194 pcap_inject.3pcap \
195 pcap_is_swapped.3pcap \
196 pcap_lib_version.3pcap \
197 pcap_lookupdev.3pcap \
198 pcap_lookupnet.3pcap \
199 pcap_loop.3pcap \
200 pcap_major_version.3pcap \
201 pcap_next_ex.3pcap \
202 pcap_offline_filter.3pcap \
203 pcap_open_live.3pcap \
204 pcap_set_buffer_size.3pcap \
205 pcap_set_datalink.3pcap \
206 pcap_set_promisc.3pcap \
207 pcap_set_protocol_linux.3pcap \
208 pcap_set_rfmon.3pcap \
209 pcap_set_snaplen.3pcap \
210 pcap_set_timeout.3pcap \
211 pcap_setdirection.3pcap \
212 pcap_setfilter.3pcap \
213 pcap_setnonblock.3pcap \
214 pcap_snapshot.3pcap \
215 pcap_stats.3pcap \
216 pcap_statustostr.3pcap \
217 pcap_strerror.3pcap \
218 pcap_tstamp_type_name_to_val.3pcap \
219 pcap_tstamp_type_val_to_name.3pcap
220
221 MAN3PCAP = $(MAN3PCAP_NOEXPAND) $(MAN3PCAP_EXPAND:.in=)
222
223 MANFILE = \
224 cbpf-savefile.manfile.in \
225 pcap-savefile.manfile.in
226
227 MANMISC = \
228 pcap-filter.manmisc.in \
229 pcap-linktype.manmisc.in \
230 pcap-tstamp.manmisc.in
231
232 EXTRA_DIST = \
233 CHANGES \
234 ChmodBPF/ChmodBPF \
235 ChmodBPF/StartupParameters.plist \
236 CREDITS \
237 CMakeLists.txt \
238 INSTALL.md \
239 LICENSE \
240 Makefile.in \
241 Makefile-devel-adds \
242 README.md \
243 doc/README.aix \
244 doc/README.dag.md \
245 doc/README.haiku.md \
246 doc/README.hpux \
247 doc/README.hurd.md \
248 doc/README.linux \
249 doc/README.macos \
250 doc/README.septel \
251 doc/README.solaris.md \
252 doc/README.windows.md \
253 CONTRIBUTING.md \
254 VERSION \
255 aclocal.m4 \
256 autogen.sh \
257 charconv.c \
258 charconv.h \
259 chmod_bpf \
260 cmake_uninstall.cmake.in \
261 cmakeconfig.h.in \
262 cmake/Modules/FindAirPcap.cmake \
263 cmake/Modules/FindDAG.cmake \
264 cmake/Modules/Finddpdk.cmake \
265 cmake/Modules/FindFseeko.cmake \
266 cmake/Modules/FindLFS.cmake \
267 cmake/Modules/FindPacket.cmake \
268 cmake/Modules/FindSNF.cmake \
269 cmake/Modules/FindTC.cmake \
270 cmake/have_siocglifconf.c \
271 config.guess \
272 config.sub \
273 configure.ac \
274 dlpisubs.c \
275 dlpisubs.h \
276 fad-getad.c \
277 fad-gifc.c \
278 fad-glifc.c \
279 grammar.y.in \
280 install-sh \
281 instrument-functions.c \
282 libpcap.pc.in \
283 missing/asprintf.c \
284 missing/getopt.c \
285 missing/getopt.h \
286 missing/strlcat.c \
287 missing/strlcpy.c \
288 missing/strtok_r.c \
289 missing/win_asprintf.c \
290 mkdep \
291 nomkdep \
292 org.tcpdump.chmod_bpf.plist \
293 pcap-airpcap.c \
294 pcap-airpcap.h \
295 pcap-bpf.c \
296 pcap-bt-linux.c \
297 pcap-bt-linux.h \
298 pcap-bt-monitor-linux.c \
299 pcap-bt-monitor-linux.h \
300 pcap-config.in \
301 pcap-dag.c \
302 pcap-dag.h \
303 pcap-dbus.c \
304 pcap-dbus.h \
305 pcap-dll.rc \
306 pcap-dlpi.c \
307 pcap-dpdk.c \
308 pcap-dpdk.h \
309 pcap-haiku.c \
310 pcap-hurd.c \
311 pcap-int.h \
312 pcap-libdlpi.c \
313 pcap-linux.c \
314 pcap-namedb.h \
315 pcap-netfilter-linux.c \
316 pcap-netfilter-linux.h \
317 pcap-netmap.c \
318 pcap-netmap.h \
319 pcap-npf.c \
320 pcap-null.c \
321 pcap-rdmasniff.c \
322 pcap-rdmasniff.h \
323 pcap-rpcap.c \
324 pcap-septel.c \
325 pcap-septel.h \
326 pcap-snf.c \
327 pcap-snf.h \
328 pcap-tc.c \
329 pcap-tc.h \
330 pcap-usb-linux.c \
331 pcap-usb-linux.h \
332 rpcap-protocol.c \
333 rpcapd/CMakeLists.txt \
334 rpcapd/Makefile.in \
335 rpcapd/config_params.h \
336 rpcapd/daemon.h \
337 rpcapd/daemon.c \
338 rpcapd/fileconf.c \
339 rpcapd/fileconf.h \
340 rpcapd/log.h \
341 rpcapd/log.c \
342 rpcapd/org.tcpdump.rpcapd.plist \
343 rpcapd/rpcapd.c \
344 rpcapd/rpcapd.h \
345 rpcapd/rpcapd.inetd.conf \
346 rpcapd/rpcapd.manadmin.in \
347 rpcapd/rpcapd-config.manfile.in \
348 rpcapd/rpcapd.rc \
349 rpcapd/rpcapd.socket \
350 rpcapd/rpcapd.xinetd.conf \
351 rpcapd/rpcapd@.service \
352 rpcapd/win32-svc.c \
353 rpcapd/win32-svc.h \
354 sockutils.c \
355 sockutils.h \
356 sslutils.c \
357 sslutils.h \
358 scanner.l \
359 testprogs/CMakeLists.txt \
360 testprogs/Makefile.in \
361 testprogs/activatetest.c \
362 testprogs/can_set_rfmon_test.c \
363 testprogs/capturetest.c \
364 testprogs/filtertest.c \
365 testprogs/findalldevstest.c \
366 testprogs/findalldevstest-perf.c \
367 testprogs/fuzz/CMakeLists.txt \
368 testprogs/fuzz/fuzz_both.c \
369 testprogs/fuzz/fuzz_both.options \
370 testprogs/fuzz/fuzz_filter.c \
371 testprogs/fuzz/fuzz_filter.options \
372 testprogs/fuzz/fuzz_pcap.c \
373 testprogs/fuzz/fuzz_pcap.options \
374 testprogs/fuzz/onefile.c \
375 testprogs/nonblocktest.c \
376 testprogs/opentest.c \
377 testprogs/reactivatetest.c \
378 testprogs/selpolltest.c \
379 testprogs/threadsignaltest.c \
380 testprogs/unix.h \
381 testprogs/valgrindtest.c \
382 testprogs/visopts.py \
383 testprogs/writecaptest.c
384
385 TEST_DIST = `git -C "$$DIR" ls-files tests | grep -v 'tests/\..*'`
386
387 RELEASE_FILES = $(COMMON_C_SRC) $(HDR) $(MAN1) $(MAN3PCAP_EXPAND) \
388 $(MAN3PCAP_NOEXPAND) $(MANFILE) $(MANMISC) $(EXTRA_DIST) \
389 $(TEST_DIST)
390
391 all: libpcap.a shared $(BUILD_RPCAPD) libpcap.pc pcap-config
392
393 libpcap.a: $(OBJ)
394 @rm -f $@
395 $(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
396 $(RANLIB) $@
397
398 shared: libpcap.$(DYEXT)
399
400 libpcap.so: $(OBJ)
401 @rm -f $@
402 VER=`cat $(srcdir)/VERSION`; \
403 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
404 @V_SHLIB_CMD@ $(LDFLAGS) @V_SHLIB_OPT@ @V_SONAME_OPT@$@.$$MAJOR_VER \
405 -o $@.$$VER $(OBJ) $(ADDLOBJS) $(LIBS)
406
407 #
408 # The following rule succeeds, but the result is untested.
409 #
410 # In macOS, the libpcap dylib has the name "libpcap.A.dylib", with its
411 # full path as the install_name, and with the compatibility and current
412 # version both set to 1. The compatibility version is set to 1 so that
413 # programs built with a newer version of the library will run against
414 # older versions if they don't use APIs available in the newer version
415 # but not in the older version.
416 #
417 # We also use "A" as the major version, and 1 as the compatibility version,
418 # but set the current version to the value in VERSION, with any non-numeric
419 # stuff stripped off (the compatibility and current version must be of the
420 # form X[.Y[.Z]], with Y and Z possibly absent, and with all components
421 # numeric).
422 #
423 libpcap.dylib: $(OBJ)
424 rm -f libpcap*.dylib
425 VER=`cat $(srcdir)/VERSION`; \
426 MAJOR_VER=A; \
427 COMPAT_VER=1; \
428 CURRENT_VER=`sed 's/[^0-9.].*$$//' $(srcdir)/VERSION`; \
429 $(CC) -dynamiclib -undefined error $(LDFLAGS) @V_LIB_LDFLAGS_FAT@ \
430 -o libpcap.$$VER.dylib $(OBJ) $(ADDLOBJS) $(LIBS) \
431 -install_name $(libdir)/libpcap.$$MAJOR_VER.dylib \
432 -compatibility_version $$COMPAT_VER \
433 -current_version $$CURRENT_VER
434
435 #
436 # The HP-UX linker manual says that the convention for a versioned library
437 # is libXXX.{number}, not libXXX.sl.{number}. That appears to be the case
438 # on at least one HP-UX 11.00 system; libXXX.sl is a symlink to
439 # libXXX.{number}.
440 #
441 # The manual also says "library-level versioning" (think "sonames") was
442 # added in HP-UX 10.0.
443 #
444 # XXX - this assumes we're using the HP linker, rather than the GNU
445 # linker, even with GCC.
446 #
447 libpcap.sl: $(OBJ)
448 @MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
449 rm -f libpcap.$$MAJOR_VER
450 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
451 ld -b $(LDFLAGS) -o libpcap.$$MAJOR_VER +h libpcap.$$MAJOR_VER \
452 $(OBJ) $(ADDLOBJS) $(LIBS)
453
454 #
455 # AIX is different from everybody else. A shared library is an archive
456 # library with one or more shared-object components. We still build a
457 # normal static archive library on AIX, for the benefit of the traditional
458 # scheme of building libpcap and tcpdump in subdirectories of the
459 # same directory, with tcpdump statically linked with the libpcap
460 # in question, but we also build a shared library as "libpcap.shareda"
461 # and install *it*, rather than the static library, as "libpcap.a".
462 #
463 libpcap.shareda: $(OBJ)
464 @rm -f $@ shr.o
465 $(CC) $(LDFLAGS) @V_SHLIB_OPT@ -o shr.o $(OBJ) $(ADDLOBJS) $(LIBS)
466 $(AR) rc $@ shr.o
467
468 #
469 # For platforms that don't support shared libraries (or on which we
470 # don't support shared libraries).
471 #
472 libpcap.none:
473
474 scanner.c: $(srcdir)/scanner.l
475 $(LEX) -P pcap_ --header-file=scanner.h --nounput -o scanner.c $<
476 scanner.h: scanner.c
477 ## Recover from the removal of $@
478 @if test -f $@; then :; else \
479 rm -f scanner.c; \
480 $(MAKE) $(MAKEFLAGS) scanner.c; \
481 fi
482
483 scanner.o: scanner.c grammar.h
484 $(CC) $(FULL_CFLAGS) -c scanner.c
485
486 #
487 # Generate the grammar.y file.
488 #
489 # Some Makes, e.g. AIX Make and Solaris Make, can't handle "--file=$@.tmp:$<";
490 # for example, the Solaris 9 make man page says
491 #
492 # Because make assigns $< and $* as it would for implicit rules
493 # (according to the suffixes list and the directory contents),
494 # they may be unreliable when used within explicit target entries.
495 #
496 # and this is an explicit target entry.
497 #
498 # Therefore, instead of using $<, we explicitly put in $(srcdir)/grammar.y.in.
499 #
500 grammar.y: $(srcdir)/grammar.y.in ./config.status
501 @rm -f $@ $@.tmp
502 ./config.status --file=$@.tmp:$(srcdir)/grammar.y.in
503 mv $@.tmp $@
504
505 grammar.c: grammar.y
506 $(BISON_BYACC) -p pcap_ -o grammar.c -d $<
507 grammar.h: grammar.c
508 ## Recover from the removal of $@
509 @if test -f $@; then :; else \
510 rm -f grammar.c; \
511 $(MAKE) $(MAKEFLAGS) grammar.c; \
512 fi
513
514 grammar.o: grammar.c scanner.h
515 $(CC) $(FULL_CFLAGS) -c grammar.c
516
517 gencode.o: $(srcdir)/gencode.c grammar.h scanner.h
518 $(CC) $(FULL_CFLAGS) -c $(srcdir)/gencode.c
519
520 asprintf.o: $(srcdir)/missing/asprintf.c
521 $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/asprintf.c
522
523 strlcat.o: $(srcdir)/missing/strlcat.c
524 $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcat.c
525
526 strlcpy.o: $(srcdir)/missing/strlcpy.c
527 $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c
528
529 strtok_r.o: $(srcdir)/missing/strtok_r.c
530 $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strtok_r.c
531
532 #
533 # Generate the libpcap.pc file.
534 #
535 # Some Makes, e.g. AIX Make and Solaris Make, can't handle "--file=$@.tmp:$<";
536 # for example, the Solaris 9 make man page says
537 #
538 # Because make assigns $< and $* as it would for implicit rules
539 # (according to the suffixes list and the directory contents),
540 # they may be unreliable when used within explicit target entries.
541 #
542 # and this is an explicit target entry.
543 #
544 # Therefore, instead of using $<, we explicitly put in $(srcdir)/libpcap.pc.in.
545 #
546 libpcap.pc: $(srcdir)/libpcap.pc.in ./config.status
547 @rm -f $@ $@.tmp
548 ./config.status --file=$@.tmp:$(srcdir)/libpcap.pc.in
549 mv $@.tmp $@
550
551 #
552 # Generate the pcap-config script. See above.
553 #
554 pcap-config: $(srcdir)/pcap-config.in ./config.status
555 @rm -f $@ $@.tmp
556 ./config.status --file=$@.tmp:$(srcdir)/pcap-config.in
557 mv $@.tmp $@
558 chmod a+x $@
559
560 #
561 # Remote pcap daemon.
562 #
563 build-rpcapd: libpcap.a
564 (cd rpcapd; $(MAKE))
565
566 #
567 # Test programs - not built by default, and not installed.
568 #
569 testprogs: FORCE libpcap.a
570 (cd testprogs; $(MAKE) CFLAGS="$(CFLAGS)")
571
572 FORCE:
573
574 install: install-shared install-archive libpcap.pc pcap-config @INSTALL_RPCAPD@
575 [ -d $(DESTDIR)$(libdir) ] || \
576 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
577 [ -d $(DESTDIR)$(includedir) ] || \
578 (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
579 [ -d $(DESTDIR)$(includedir)/pcap ] || \
580 (mkdir -p $(DESTDIR)$(includedir)/pcap; chmod 755 $(DESTDIR)$(includedir)/pcap)
581 [ -d $(DESTDIR)$(mandir)/man1 ] || \
582 (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
583 [ -d $(DESTDIR)$(mandir)/man3 ] || \
584 (mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
585 [ -d $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@ ] || \
586 (mkdir -p $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@)
587 [ -d $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@ ] || \
588 (mkdir -p $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@)
589 for i in $(PUBHDR); do \
590 $(INSTALL_DATA) $(srcdir)/$$i \
591 $(DESTDIR)$(includedir)/$$i; done
592 [ -d $(DESTDIR)$(bindir) ] || \
593 (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir))
594 $(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config
595 [ -d $(DESTDIR)$(libdir)/pkgconfig ] || \
596 (mkdir -p $(DESTDIR)$(libdir)/pkgconfig; chmod 755 $(DESTDIR)$(libdir)/pkgconfig)
597 $(INSTALL_DATA) libpcap.pc $(DESTDIR)$(libdir)/pkgconfig/libpcap.pc
598 for i in $(MAN1); do \
599 $(INSTALL_DATA) $(srcdir)/$$i \
600 $(DESTDIR)$(mandir)/man1/$$i; done
601 for i in $(MAN3PCAP_NOEXPAND); do \
602 $(INSTALL_DATA) $(srcdir)/$$i \
603 $(DESTDIR)$(mandir)/man3/$$i; done
604 for i in $(MAN3PCAP_EXPAND:.in=); do \
605 $(INSTALL_DATA) $$i \
606 $(DESTDIR)$(mandir)/man3/$$i; done
607 (cd $(DESTDIR)$(mandir)/man3 && \
608 rm -f pcap_datalink_val_to_description.3pcap && \
609 $(LN_S) pcap_datalink_val_to_name.3pcap \
610 pcap_datalink_val_to_description.3pcap && \
611 rm -f pcap_datalink_val_to_description_or_dlt.3pcap && \
612 $(LN_S) pcap_datalink_val_to_name.3pcap \
613 pcap_datalink_val_to_description_or_dlt.3pcap && \
614 rm -f pcap_dump_fopen.3pcap && \
615 $(LN_S) pcap_dump_open.3pcap pcap_dump_fopen.3pcap && \
616 rm -f pcap_freealldevs.3pcap && \
617 $(LN_S) pcap_findalldevs.3pcap pcap_freealldevs.3pcap && \
618 rm -f pcap_perror.3pcap && \
619 $(LN_S) pcap_geterr.3pcap pcap_perror.3pcap && \
620 rm -f pcap_sendpacket.3pcap && \
621 $(LN_S) pcap_inject.3pcap pcap_sendpacket.3pcap && \
622 rm -f pcap_free_datalinks.3pcap && \
623 $(LN_S) pcap_list_datalinks.3pcap pcap_free_datalinks.3pcap && \
624 rm -f pcap_free_tstamp_types.3pcap && \
625 $(LN_S) pcap_list_tstamp_types.3pcap pcap_free_tstamp_types.3pcap && \
626 rm -f pcap_dispatch.3pcap && \
627 $(LN_S) pcap_loop.3pcap pcap_dispatch.3pcap && \
628 rm -f pcap_minor_version.3pcap && \
629 $(LN_S) pcap_major_version.3pcap pcap_minor_version.3pcap && \
630 rm -f pcap_next.3pcap && \
631 $(LN_S) pcap_next_ex.3pcap pcap_next.3pcap && \
632 rm -f pcap_open_dead_with_tstamp_precision.3pcap && \
633 $(LN_S) pcap_open_dead.3pcap \
634 pcap_open_dead_with_tstamp_precision.3pcap && \
635 rm -f pcap_open_offline_with_tstamp_precision.3pcap && \
636 $(LN_S) pcap_open_offline.3pcap pcap_open_offline_with_tstamp_precision.3pcap && \
637 rm -f pcap_fopen_offline.3pcap && \
638 $(LN_S) pcap_open_offline.3pcap pcap_fopen_offline.3pcap && \
639 rm -f pcap_fopen_offline_with_tstamp_precision.3pcap && \
640 $(LN_S) pcap_open_offline.3pcap pcap_fopen_offline_with_tstamp_precision.3pcap && \
641 rm -f pcap_tstamp_type_val_to_description.3pcap && \
642 $(LN_S) pcap_tstamp_type_val_to_name.3pcap pcap_tstamp_type_val_to_description.3pcap && \
643 rm -f pcap_getnonblock.3pcap && \
644 $(LN_S) pcap_setnonblock.3pcap pcap_getnonblock.3pcap)
645 for i in $(MANFILE); do \
646 $(INSTALL_DATA) `echo $$i | sed 's/.manfile.in/.manfile/'` \
647 $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
648 for i in $(MANMISC); do \
649 $(INSTALL_DATA) `echo $$i | sed 's/.manmisc.in/.manmisc/'` \
650 $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
651
652 install-shared: install-shared-$(DYEXT)
653 install-shared-so: libpcap.so
654 [ -d $(DESTDIR)$(libdir) ] || \
655 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
656 VER=`cat $(srcdir)/VERSION`; \
657 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
658 $(INSTALL_PROGRAM) libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
659 ln -sf libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
660 ln -sf libpcap.so.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.so
661 install-shared-dylib: libpcap.dylib
662 [ -d $(DESTDIR)$(libdir) ] || \
663 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
664 VER=`cat $(srcdir)/VERSION`; \
665 MAJOR_VER=A; \
666 $(INSTALL_PROGRAM) libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
667 ln -sf libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
668 ln -sf libpcap.$$MAJOR_VER.dylib $(DESTDIR)$(libdir)/libpcap.dylib
669 install-shared-sl: libpcap.sl
670 [ -d $(DESTDIR)$(libdir) ] || \
671 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
672 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
673 $(INSTALL_PROGRAM) libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)
674 ln -sf libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.sl
675 #
676 # AIX shared libraries are weird. They're archive libraries
677 # with one or more shared object components.
678 #
679 install-shared-shareda: libpcap.shareda
680 [ -d $(DESTDIR)$(libdir) ] || \
681 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
682 $(INSTALL_PROGRAM) libpcap.shareda $(DESTDIR)$(libdir)/libpcap.a
683 install-shared-none:
684
685 install-archive: install-archive-$(DYEXT)
686 #
687 # Most platforms have separate suffixes for shared and
688 # archive libraries, so we install both.
689 #
690 install-archive-so install-archive-dylib install-archive-sl install-archive-none: libpcap.a
691 [ -d $(DESTDIR)$(libdir) ] || \
692 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
693 $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
694 $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
695 #
696 # AIX, however, doesn't, so we don't install the archive
697 # library on AIX.
698 #
699 install-archive-shareda:
700
701 install-rpcapd:
702 (cd rpcapd; $(MAKE) DESTDIR=$(DESTDIR) install)
703
704 uninstall: uninstall-shared uninstall-rpcapd
705 rm -f $(DESTDIR)$(libdir)/libpcap.a
706 for i in $(PUBHDR); do \
707 rm -f $(DESTDIR)$(includedir)/$$i; done
708 -rmdir $(DESTDIR)$(includedir)/pcap
709 rm -f $(DESTDIR)/$(libdir)/pkgconfig/libpcap.pc
710 rm -f $(DESTDIR)/$(bindir)/pcap-config
711 for i in $(MAN1); do \
712 rm -f $(DESTDIR)$(mandir)/man1/$$i; done
713 for i in $(MAN3PCAP); do \
714 rm -f $(DESTDIR)$(mandir)/man3/$$i; done
715 rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
716 rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description_or_dlt.3pcap
717 rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
718 rm -f $(DESTDIR)$(mandir)/man3/pcap_freealldevs.3pcap
719 rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
720 rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
721 rm -f $(DESTDIR)$(mandir)/man3/pcap_free_datalinks.3pcap
722 rm -f $(DESTDIR)$(mandir)/man3/pcap_free_tstamp_types.3pcap
723 rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
724 rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
725 rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
726 rm -f $(DESTDIR)$(mandir)/man3/pcap_open_dead_with_tstamp_precision.3pcap
727 rm -f $(DESTDIR)$(mandir)/man3/pcap_open_offline_with_tstamp_precision.3pcap
728 rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
729 rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline_with_tstamp_precision.3pcap
730 rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
731 rm -f $(DESTDIR)$(mandir)/man3/pcap_tstamp_type_val_to_description.3pcap
732 for i in $(MANFILE); do \
733 rm -f $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
734 for i in $(MANMISC); do \
735 rm -f $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
736
737 uninstall-shared: uninstall-shared-$(DYEXT)
738 uninstall-shared-so:
739 VER=`cat $(srcdir)/VERSION`; \
740 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
741 rm -f $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
742 rm -f $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
743 rm -f $(DESTDIR)$(libdir)/libpcap.so
744 uninstall-shared-dylib:
745 VER=`cat $(srcdir)/VERSION`; \
746 MAJOR_VER=A; \
747 rm -f $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
748 rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
749 rm -f $(DESTDIR)$(libdir)/libpcap.dylib
750 uninstall-shared-sl:
751 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
752 rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER; \
753 rm -f $(DESTDIR)$(libdir)/libpcap.sl
754 uninstall-shared-shareda:
755 rm -f $(DESTDIR)$(libdir)/libpcap.a
756 uninstall-shared-none:
757
758 uninstall-rpcapd:
759 (cd rpcapd; $(MAKE) DESTDIR=$(DESTDIR) uninstall)
760
761 clean:
762 rm -f $(CLEANFILES) config.h.in~ configure~ configure.ac~
763 (cd rpcapd; $(MAKE) clean)
764 (cd testprogs; $(MAKE) clean)
765
766 distclean: clean
767 rm -f Makefile grammar.y config.cache config.log config.status \
768 config.h os-proto.h libpcap.pc pcap-config stamp-h stamp-h.in
769 rm -f $(MAN3PCAP_EXPAND:.in=) $(MANFILE:.in=) $(MANMISC:.in=)
770 rm -rf autom4te.cache
771 (cd rpcapd; $(MAKE) distclean)
772 (cd testprogs; $(MAKE) distclean)
773
774 extags: $(TAGFILES)
775 ctags $(TAGFILES)
776
777 tags: $(TAGFILES)
778 ctags -wtd $(TAGFILES)
779
780 #
781 # Use git archive piped to tar to construct a subdirectory whose name
782 # is libpcap-{release}, containing all the checked-in source files,
783 # and then run autoreconf in that directory to generate the configure
784 # script and other files from that source. Then remove autom4te.cache,
785 # construct the release tarball from that subdirectory, and remove
786 # the subdirectory.
787 #
788 # The --format=tar is to force git archive to write a non-compressed
789 # archive, in case the platform's tar command doesn't have built-in
790 # decompression.
791 #
792 # The ^{tree} is there to force git archive not to write out the
793 # "helpful" global extended pax header with a commit ID, as not all
794 # versions of tar can handle that (Solaris tar can't, for example).
795 # (It turns HEAD, or a tag, both of which are apparently "tree-ish"es,
796 # into a tree; apparently, unlike HEAD, or a tag, which have a commit
797 # ID associated with them, the tree associated with them doesn't have
798 # a commit ID, so no commit ID is available to write, and thus
799 # git archive doesn't write one.)
800 #
801 releasetar:
802 @TAG=$(PROG)-`cat VERSION` && \
803 if [ ! -d .git ]; then echo 'Not in a git clone, stop.'; exit 1; fi && \
804 TMPTESTFILE=`mktemp -t tmptestfile_XXXXXXXX` && \
805 rm -f "$$TMPTESTFILE" && \
806 AUTORECONF_DIR=`dirname "$$TMPTESTFILE"`/"$(PROG)"_build_autoreconf_$$$$ && \
807 DIR=`pwd` && \
808 rm -rf "$$AUTORECONF_DIR" && \
809 mkdir "$$AUTORECONF_DIR" && \
810 cd "$$AUTORECONF_DIR" && \
811 if git -C "$$DIR" show-ref --tags --quiet --verify -- "refs/tags/$$TAG"; then \
812 (git -C "$$DIR" archive --format=tar --prefix="$$TAG"/ "$$TAG^{tree}" $(RELEASE_FILES) | \
813 tar xf -) && \
814 echo "Archive build from tag $$TAG."; \
815 else \
816 (git -C "$$DIR" archive --format=tar --prefix="$$TAG"/ "HEAD^{tree}" $(RELEASE_FILES) | \
817 tar xf -) && \
818 echo "No $$TAG tag. Archive build from HEAD."; \
819 fi && \
820 (cd "$$TAG" && ./autogen.sh && rm -rf autom4te.cache) && \
821 tar cf "$$DIR/$$TAG".tar "$$TAG" && \
822 rm -f "$$DIR/$$TAG".tar.gz && \
823 gzip --best "$$DIR/$$TAG".tar && \
824 cd "$$DIR" && \
825 rm -rf "$$AUTORECONF_DIR"
826
827 releasecheck: releasetar
828 @TAG=$(PROG)-`cat VERSION` && \
829 INSTALL_DIR=/tmp/install_"$$TAG"_$$$$ && \
830 DIR=`pwd` && \
831 cd /tmp && \
832 rm -rf "$$TAG" && \
833 rm -rf "$$INSTALL_DIR" && \
834 tar xf "$$DIR"/"$$TAG".tar.gz && \
835 cd "$$TAG" && \
836 echo "[$@] $$ touch .devel" && \
837 touch .devel && \
838 echo "[$@] $$ ./configure --enable-remote --quiet --prefix=$$INSTALL_DIR" && \
839 ./configure --enable-remote --quiet --prefix="$$INSTALL_DIR" && \
840 echo '[$@] $$ $(MAKE) -s all testprogs' && \
841 $(MAKE) -s all testprogs && \
842 echo '[$@] $$ $(MAKE) -s install' && \
843 $(MAKE) -s install && \
844 cd .. && \
845 rm -rf "$$TAG" && \
846 rm -rf "$$INSTALL_DIR" && \
847 tar xf "$$DIR"/"$$TAG".tar.gz && \
848 cd "$$TAG" && \
849 echo "[$@] $$ touch .devel" && \
850 touch .devel && \
851 mkdir build && \
852 cd build && \
853 echo '[$@] $$ cmake -DENABLE_REMOTE=yes [...] ..' && \
854 cmake -DENABLE_REMOTE=yes \
855 -DCMAKE_INSTALL_PREFIX="$$INSTALL_DIR" \
856 -DCMAKE_MESSAGE_LOG_LEVEL=NOTICE \
857 -DCMAKE_RULE_MESSAGES=OFF \
858 -DCMAKE_INSTALL_MESSAGE=NEVER \
859 .. && \
860 echo '[$@] $$ $(MAKE) -s all testprogs' && \
861 $(MAKE) -s all testprogs && \
862 echo '[$@] $$ $(MAKE) -s install' && \
863 $(MAKE) -s install && \
864 cd ../.. && \
865 rm -rf "$$TAG" && \
866 rm -rf "$$INSTALL_DIR" && \
867 echo '[$@] Done.'
868
869 whitespacecheck:
870 @# trailing space(s)?
871 @if git grep -I -n ' $$' $$(git ls-files|grep -v '^tests/'); then \
872 echo 'Error: Trailing space(s).'; \
873 exit 1; \
874 fi
875 @# trailing tab(s)?
876 @if git grep -I -n ' $$' $$(git ls-files|grep -v '^tests/'); then \
877 echo 'Error: Trailing tabs(s).'; \
878 exit 1; \
879 fi
880 @# space(s) before tab(s)?
881 @if git grep -I -n '[ ][ ]' $$(git ls-files|grep -v '^tests/'); then \
882 echo 'Error: space(s) before tab(s).'; \
883 exit 1; \
884 fi
885
886 depend: $(GENERATED_C_SRC) $(GENHDR)
887 $(MKDEP) -c $(CC) -m "$(DEPENDENCY_CFLAG)" -s "$(srcdir)" $(CFLAGS) $(DEFS) $(INCLS) $(SRC)
888 (cd rpcapd; $(MAKE) depend)
889 (cd testprogs; $(MAKE) depend)
890
891 shellcheck:
892 shellcheck -f gcc -e SC2006 autogen.sh build.sh build_matrix.sh build_common.sh mkdep .ci-coverity-scan-build.sh