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