]> The Tcpdump Group git mirrors - libpcap/blob - Makefile.in
Fixup indentation in init_linktype().
[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.snf.md \
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/FindDAG.cmake \
263 cmake/Modules/Finddpdk.cmake \
264 cmake/Modules/FindFseeko.cmake \
265 cmake/Modules/FindLFS.cmake \
266 cmake/Modules/FindPacket.cmake \
267 cmake/Modules/FindSNF.cmake \
268 cmake/have_siocglifconf.c \
269 config.guess \
270 config.sub \
271 configure.ac \
272 dlpisubs.c \
273 dlpisubs.h \
274 fad-getad.c \
275 fad-gifc.c \
276 fad-glifc.c \
277 grammar.y.in \
278 install-sh \
279 instrument-functions.c \
280 libpcap.pc.in \
281 missing/asprintf.c \
282 missing/getopt.c \
283 missing/getopt.h \
284 missing/strlcat.c \
285 missing/strlcpy.c \
286 missing/strtok_r.c \
287 missing/win_asprintf.c \
288 mkdep \
289 nomkdep \
290 org.tcpdump.chmod_bpf.plist \
291 pcap-bpf.c \
292 pcap-bt-linux.c \
293 pcap-bt-linux.h \
294 pcap-bt-monitor-linux.c \
295 pcap-bt-monitor-linux.h \
296 pcap-config.in \
297 pcap-dag.c \
298 pcap-dag.h \
299 pcap-dbus.c \
300 pcap-dbus.h \
301 pcap-dll.rc \
302 pcap-dlpi.c \
303 pcap-dpdk.c \
304 pcap-dpdk.h \
305 pcap-haiku.c \
306 pcap-hurd.c \
307 pcap-int.h \
308 pcap-libdlpi.c \
309 pcap-linux.c \
310 pcap-namedb.h \
311 pcap-netfilter-linux.c \
312 pcap-netfilter-linux.h \
313 pcap-netmap.c \
314 pcap-netmap.h \
315 pcap-npf.c \
316 pcap-null.c \
317 pcap-rdmasniff.c \
318 pcap-rdmasniff.h \
319 pcap-rpcap.c \
320 pcap-snf.c \
321 pcap-snf.h \
322 pcap-usb-linux.c \
323 pcap-usb-linux.h \
324 rpcap-protocol.c \
325 rpcapd/CMakeLists.txt \
326 rpcapd/Makefile.in \
327 rpcapd/config_params.h \
328 rpcapd/daemon.h \
329 rpcapd/daemon.c \
330 rpcapd/fileconf.c \
331 rpcapd/fileconf.h \
332 rpcapd/log.h \
333 rpcapd/log.c \
334 rpcapd/org.tcpdump.rpcapd.plist \
335 rpcapd/rpcapd.c \
336 rpcapd/rpcapd.h \
337 rpcapd/rpcapd.inetd.conf \
338 rpcapd/rpcapd.manadmin.in \
339 rpcapd/rpcapd-config.manfile.in \
340 rpcapd/rpcapd.rc \
341 rpcapd/rpcapd.socket \
342 rpcapd/rpcapd.xinetd.conf \
343 rpcapd/rpcapd@.service \
344 rpcapd/win32-svc.c \
345 rpcapd/win32-svc.h \
346 sockutils.c \
347 sockutils.h \
348 sslutils.c \
349 sslutils.h \
350 scanner.l \
351 testprogs/CMakeLists.txt \
352 testprogs/Makefile.in \
353 testprogs/activatetest.c \
354 testprogs/can_set_rfmon_test.c \
355 testprogs/capturetest.c \
356 testprogs/filtertest.c \
357 testprogs/findalldevstest.c \
358 testprogs/findalldevstest-perf.c \
359 testprogs/fuzz/CMakeLists.txt \
360 testprogs/fuzz/fuzz_both.c \
361 testprogs/fuzz/fuzz_both.options \
362 testprogs/fuzz/fuzz_filter.c \
363 testprogs/fuzz/fuzz_filter.options \
364 testprogs/fuzz/fuzz_pcap.c \
365 testprogs/fuzz/fuzz_pcap.options \
366 testprogs/fuzz/onefile.c \
367 testprogs/nonblocktest.c \
368 testprogs/opentest.c \
369 testprogs/reactivatetest.c \
370 testprogs/selpolltest.c \
371 testprogs/threadsignaltest.c \
372 testprogs/unix.h \
373 testprogs/valgrindtest.c \
374 testprogs/visopts.py \
375 testprogs/writecaptest.c
376
377 TEST_DIST = `git -C "$$DIR" ls-files tests | grep -v 'tests/\..*'`
378
379 RELEASE_FILES = $(COMMON_C_SRC) $(HDR) $(MAN1) $(MAN3PCAP_EXPAND) \
380 $(MAN3PCAP_NOEXPAND) $(MANFILE) $(MANMISC) $(EXTRA_DIST) \
381 $(TEST_DIST)
382
383 all: libpcap.a shared $(BUILD_RPCAPD) libpcap.pc pcap-config
384
385 libpcap.a: $(OBJ)
386 @rm -f $@
387 $(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
388 $(RANLIB) $@
389
390 shared: libpcap.$(DYEXT)
391
392 libpcap.so: $(OBJ)
393 @rm -f $@
394 VER=`cat $(srcdir)/VERSION`; \
395 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
396 @V_SHLIB_CMD@ $(LDFLAGS) @V_SHLIB_OPT@ @V_SONAME_OPT@$@.$$MAJOR_VER \
397 -o $@.$$VER $(OBJ) $(ADDLOBJS) $(LIBS)
398
399 #
400 # The following rule succeeds, but the result is untested.
401 #
402 # In macOS, the libpcap dylib has the name "libpcap.A.dylib", with its
403 # full path as the install_name, and with the compatibility and current
404 # version both set to 1. The compatibility version is set to 1 so that
405 # programs built with a newer version of the library will run against
406 # older versions if they don't use APIs available in the newer version
407 # but not in the older version.
408 #
409 # We also use "A" as the major version, and 1 as the compatibility version,
410 # but set the current version to the value in VERSION, with any non-numeric
411 # stuff stripped off (the compatibility and current version must be of the
412 # form X[.Y[.Z]], with Y and Z possibly absent, and with all components
413 # numeric).
414 #
415 libpcap.dylib: $(OBJ)
416 rm -f libpcap*.dylib
417 VER=`cat $(srcdir)/VERSION`; \
418 MAJOR_VER=A; \
419 COMPAT_VER=1; \
420 CURRENT_VER=`sed 's/[^0-9.].*$$//' $(srcdir)/VERSION`; \
421 $(CC) -dynamiclib -undefined error $(LDFLAGS) @V_LIB_LDFLAGS_FAT@ \
422 -o libpcap.$$VER.dylib $(OBJ) $(ADDLOBJS) $(LIBS) \
423 -install_name $(libdir)/libpcap.$$MAJOR_VER.dylib \
424 -compatibility_version $$COMPAT_VER \
425 -current_version $$CURRENT_VER
426
427 #
428 # The HP-UX linker manual says that the convention for a versioned library
429 # is libXXX.{number}, not libXXX.sl.{number}. That appears to be the case
430 # on at least one HP-UX 11.00 system; libXXX.sl is a symlink to
431 # libXXX.{number}.
432 #
433 # The manual also says "library-level versioning" (think "sonames") was
434 # added in HP-UX 10.0.
435 #
436 # XXX - this assumes we're using the HP linker, rather than the GNU
437 # linker, even with GCC.
438 #
439 libpcap.sl: $(OBJ)
440 @MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
441 rm -f libpcap.$$MAJOR_VER
442 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
443 ld -b $(LDFLAGS) -o libpcap.$$MAJOR_VER +h libpcap.$$MAJOR_VER \
444 $(OBJ) $(ADDLOBJS) $(LIBS)
445
446 #
447 # AIX is different from everybody else. A shared library is an archive
448 # library with one or more shared-object components. We still build a
449 # normal static archive library on AIX, for the benefit of the traditional
450 # scheme of building libpcap and tcpdump in subdirectories of the
451 # same directory, with tcpdump statically linked with the libpcap
452 # in question, but we also build a shared library as "libpcap.shareda"
453 # and install *it*, rather than the static library, as "libpcap.a".
454 #
455 libpcap.shareda: $(OBJ)
456 @rm -f $@ shr.o
457 $(CC) $(LDFLAGS) @V_SHLIB_OPT@ -o shr.o $(OBJ) $(ADDLOBJS) $(LIBS)
458 $(AR) rc $@ shr.o
459
460 #
461 # For platforms that don't support shared libraries (or on which we
462 # don't support shared libraries).
463 #
464 libpcap.none:
465
466 scanner.c: $(srcdir)/scanner.l
467 $(LEX) -P pcap_ --header-file=scanner.h --nounput -o scanner.c $<
468 scanner.h: scanner.c
469 ## Recover from the removal of $@
470 @if test -f $@; then :; else \
471 rm -f scanner.c; \
472 $(MAKE) $(MAKEFLAGS) scanner.c; \
473 fi
474
475 scanner.o: scanner.c grammar.h
476 $(CC) $(FULL_CFLAGS) -c scanner.c
477
478 #
479 # Generate the grammar.y file.
480 #
481 # Some Makes, e.g. AIX Make and Solaris Make, can't handle "--file=$@.tmp:$<";
482 # for example, the Solaris 9 make man page says
483 #
484 # Because make assigns $< and $* as it would for implicit rules
485 # (according to the suffixes list and the directory contents),
486 # they may be unreliable when used within explicit target entries.
487 #
488 # and this is an explicit target entry.
489 #
490 # Therefore, instead of using $<, we explicitly put in $(srcdir)/grammar.y.in.
491 #
492 grammar.y: $(srcdir)/grammar.y.in ./config.status
493 @rm -f $@ $@.tmp
494 ./config.status --file=$@.tmp:$(srcdir)/grammar.y.in
495 mv $@.tmp $@
496
497 grammar.c: grammar.y
498 $(BISON_BYACC) -p pcap_ -o grammar.c -d $<
499 grammar.h: grammar.c
500 ## Recover from the removal of $@
501 @if test -f $@; then :; else \
502 rm -f grammar.c; \
503 $(MAKE) $(MAKEFLAGS) grammar.c; \
504 fi
505
506 grammar.o: grammar.c scanner.h
507 $(CC) $(FULL_CFLAGS) -c grammar.c
508
509 gencode.o: $(srcdir)/gencode.c grammar.h scanner.h
510 $(CC) $(FULL_CFLAGS) -c $(srcdir)/gencode.c
511
512 asprintf.o: $(srcdir)/missing/asprintf.c
513 $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/asprintf.c
514
515 strlcat.o: $(srcdir)/missing/strlcat.c
516 $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcat.c
517
518 strlcpy.o: $(srcdir)/missing/strlcpy.c
519 $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strlcpy.c
520
521 strtok_r.o: $(srcdir)/missing/strtok_r.c
522 $(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/strtok_r.c
523
524 #
525 # Generate the libpcap.pc file.
526 #
527 # Some Makes, e.g. AIX Make and Solaris Make, can't handle "--file=$@.tmp:$<";
528 # for example, the Solaris 9 make man page says
529 #
530 # Because make assigns $< and $* as it would for implicit rules
531 # (according to the suffixes list and the directory contents),
532 # they may be unreliable when used within explicit target entries.
533 #
534 # and this is an explicit target entry.
535 #
536 # Therefore, instead of using $<, we explicitly put in $(srcdir)/libpcap.pc.in.
537 #
538 libpcap.pc: $(srcdir)/libpcap.pc.in ./config.status
539 @rm -f $@ $@.tmp
540 ./config.status --file=$@.tmp:$(srcdir)/libpcap.pc.in
541 mv $@.tmp $@
542
543 #
544 # Generate the pcap-config script. See above.
545 #
546 pcap-config: $(srcdir)/pcap-config.in ./config.status
547 @rm -f $@ $@.tmp
548 ./config.status --file=$@.tmp:$(srcdir)/pcap-config.in
549 mv $@.tmp $@
550 chmod a+x $@
551
552 #
553 # Remote pcap daemon.
554 #
555 build-rpcapd: libpcap.a
556 (cd rpcapd; $(MAKE))
557
558 #
559 # Test programs - not built by default, and not installed.
560 #
561 testprogs: FORCE libpcap.a
562 (cd testprogs; $(MAKE) CFLAGS="$(CFLAGS)")
563
564 FORCE:
565
566 install: install-shared install-archive libpcap.pc pcap-config @INSTALL_RPCAPD@
567 [ -d $(DESTDIR)$(libdir) ] || \
568 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
569 [ -d $(DESTDIR)$(includedir) ] || \
570 (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
571 [ -d $(DESTDIR)$(includedir)/pcap ] || \
572 (mkdir -p $(DESTDIR)$(includedir)/pcap; chmod 755 $(DESTDIR)$(includedir)/pcap)
573 [ -d $(DESTDIR)$(mandir)/man1 ] || \
574 (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
575 [ -d $(DESTDIR)$(mandir)/man3 ] || \
576 (mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
577 [ -d $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@ ] || \
578 (mkdir -p $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@)
579 [ -d $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@ ] || \
580 (mkdir -p $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@)
581 for i in $(PUBHDR); do \
582 $(INSTALL_DATA) $(srcdir)/$$i \
583 $(DESTDIR)$(includedir)/$$i; done
584 [ -d $(DESTDIR)$(bindir) ] || \
585 (mkdir -p $(DESTDIR)$(bindir); chmod 755 $(DESTDIR)$(bindir))
586 $(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config
587 [ -d $(DESTDIR)$(libdir)/pkgconfig ] || \
588 (mkdir -p $(DESTDIR)$(libdir)/pkgconfig; chmod 755 $(DESTDIR)$(libdir)/pkgconfig)
589 $(INSTALL_DATA) libpcap.pc $(DESTDIR)$(libdir)/pkgconfig/libpcap.pc
590 for i in $(MAN1); do \
591 $(INSTALL_DATA) $(srcdir)/$$i \
592 $(DESTDIR)$(mandir)/man1/$$i; done
593 for i in $(MAN3PCAP_NOEXPAND); do \
594 $(INSTALL_DATA) $(srcdir)/$$i \
595 $(DESTDIR)$(mandir)/man3/$$i; done
596 for i in $(MAN3PCAP_EXPAND:.in=); do \
597 $(INSTALL_DATA) $$i \
598 $(DESTDIR)$(mandir)/man3/$$i; done
599 (cd $(DESTDIR)$(mandir)/man3 && \
600 rm -f pcap_datalink_val_to_description.3pcap && \
601 $(LN_S) pcap_datalink_val_to_name.3pcap \
602 pcap_datalink_val_to_description.3pcap && \
603 rm -f pcap_datalink_val_to_description_or_dlt.3pcap && \
604 $(LN_S) pcap_datalink_val_to_name.3pcap \
605 pcap_datalink_val_to_description_or_dlt.3pcap && \
606 rm -f pcap_dump_fopen.3pcap && \
607 $(LN_S) pcap_dump_open.3pcap pcap_dump_fopen.3pcap && \
608 rm -f pcap_freealldevs.3pcap && \
609 $(LN_S) pcap_findalldevs.3pcap pcap_freealldevs.3pcap && \
610 rm -f pcap_perror.3pcap && \
611 $(LN_S) pcap_geterr.3pcap pcap_perror.3pcap && \
612 rm -f pcap_sendpacket.3pcap && \
613 $(LN_S) pcap_inject.3pcap pcap_sendpacket.3pcap && \
614 rm -f pcap_free_datalinks.3pcap && \
615 $(LN_S) pcap_list_datalinks.3pcap pcap_free_datalinks.3pcap && \
616 rm -f pcap_free_tstamp_types.3pcap && \
617 $(LN_S) pcap_list_tstamp_types.3pcap pcap_free_tstamp_types.3pcap && \
618 rm -f pcap_dispatch.3pcap && \
619 $(LN_S) pcap_loop.3pcap pcap_dispatch.3pcap && \
620 rm -f pcap_minor_version.3pcap && \
621 $(LN_S) pcap_major_version.3pcap pcap_minor_version.3pcap && \
622 rm -f pcap_next.3pcap && \
623 $(LN_S) pcap_next_ex.3pcap pcap_next.3pcap && \
624 rm -f pcap_open_dead_with_tstamp_precision.3pcap && \
625 $(LN_S) pcap_open_dead.3pcap \
626 pcap_open_dead_with_tstamp_precision.3pcap && \
627 rm -f pcap_open_offline_with_tstamp_precision.3pcap && \
628 $(LN_S) pcap_open_offline.3pcap pcap_open_offline_with_tstamp_precision.3pcap && \
629 rm -f pcap_fopen_offline.3pcap && \
630 $(LN_S) pcap_open_offline.3pcap pcap_fopen_offline.3pcap && \
631 rm -f pcap_fopen_offline_with_tstamp_precision.3pcap && \
632 $(LN_S) pcap_open_offline.3pcap pcap_fopen_offline_with_tstamp_precision.3pcap && \
633 rm -f pcap_tstamp_type_val_to_description.3pcap && \
634 $(LN_S) pcap_tstamp_type_val_to_name.3pcap pcap_tstamp_type_val_to_description.3pcap && \
635 rm -f pcap_getnonblock.3pcap && \
636 $(LN_S) pcap_setnonblock.3pcap pcap_getnonblock.3pcap)
637 for i in $(MANFILE); do \
638 $(INSTALL_DATA) `echo $$i | sed 's/.manfile.in/.manfile/'` \
639 $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
640 for i in $(MANMISC); do \
641 $(INSTALL_DATA) `echo $$i | sed 's/.manmisc.in/.manmisc/'` \
642 $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
643
644 install-shared: install-shared-$(DYEXT)
645 install-shared-so: libpcap.so
646 [ -d $(DESTDIR)$(libdir) ] || \
647 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
648 VER=`cat $(srcdir)/VERSION`; \
649 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
650 $(INSTALL_PROGRAM) libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
651 ln -sf libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
652 ln -sf libpcap.so.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.so
653 install-shared-dylib: libpcap.dylib
654 [ -d $(DESTDIR)$(libdir) ] || \
655 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
656 VER=`cat $(srcdir)/VERSION`; \
657 MAJOR_VER=A; \
658 $(INSTALL_PROGRAM) libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
659 ln -sf libpcap.$$VER.dylib $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
660 ln -sf libpcap.$$MAJOR_VER.dylib $(DESTDIR)$(libdir)/libpcap.dylib
661 install-shared-sl: libpcap.sl
662 [ -d $(DESTDIR)$(libdir) ] || \
663 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
664 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
665 $(INSTALL_PROGRAM) libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)
666 ln -sf libpcap.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.sl
667 #
668 # AIX shared libraries are weird. They're archive libraries
669 # with one or more shared object components.
670 #
671 install-shared-shareda: libpcap.shareda
672 [ -d $(DESTDIR)$(libdir) ] || \
673 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
674 $(INSTALL_PROGRAM) libpcap.shareda $(DESTDIR)$(libdir)/libpcap.a
675 install-shared-none:
676
677 install-archive: install-archive-$(DYEXT)
678 #
679 # Most platforms have separate suffixes for shared and
680 # archive libraries, so we install both.
681 #
682 install-archive-so install-archive-dylib install-archive-sl install-archive-none: libpcap.a
683 [ -d $(DESTDIR)$(libdir) ] || \
684 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
685 $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
686 $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
687 #
688 # AIX, however, doesn't, so we don't install the archive
689 # library on AIX.
690 #
691 install-archive-shareda:
692
693 install-rpcapd:
694 (cd rpcapd; $(MAKE) DESTDIR=$(DESTDIR) install)
695
696 uninstall: uninstall-shared uninstall-rpcapd
697 rm -f $(DESTDIR)$(libdir)/libpcap.a
698 for i in $(PUBHDR); do \
699 rm -f $(DESTDIR)$(includedir)/$$i; done
700 -rmdir $(DESTDIR)$(includedir)/pcap
701 rm -f $(DESTDIR)/$(libdir)/pkgconfig/libpcap.pc
702 rm -f $(DESTDIR)/$(bindir)/pcap-config
703 for i in $(MAN1); do \
704 rm -f $(DESTDIR)$(mandir)/man1/$$i; done
705 for i in $(MAN3PCAP); do \
706 rm -f $(DESTDIR)$(mandir)/man3/$$i; done
707 rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
708 rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description_or_dlt.3pcap
709 rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
710 rm -f $(DESTDIR)$(mandir)/man3/pcap_freealldevs.3pcap
711 rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
712 rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
713 rm -f $(DESTDIR)$(mandir)/man3/pcap_free_datalinks.3pcap
714 rm -f $(DESTDIR)$(mandir)/man3/pcap_free_tstamp_types.3pcap
715 rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
716 rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
717 rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
718 rm -f $(DESTDIR)$(mandir)/man3/pcap_open_dead_with_tstamp_precision.3pcap
719 rm -f $(DESTDIR)$(mandir)/man3/pcap_open_offline_with_tstamp_precision.3pcap
720 rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
721 rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline_with_tstamp_precision.3pcap
722 rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
723 rm -f $(DESTDIR)$(mandir)/man3/pcap_tstamp_type_val_to_description.3pcap
724 for i in $(MANFILE); do \
725 rm -f $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
726 for i in $(MANMISC); do \
727 rm -f $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
728
729 uninstall-shared: uninstall-shared-$(DYEXT)
730 uninstall-shared-so:
731 VER=`cat $(srcdir)/VERSION`; \
732 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
733 rm -f $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
734 rm -f $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
735 rm -f $(DESTDIR)$(libdir)/libpcap.so
736 uninstall-shared-dylib:
737 VER=`cat $(srcdir)/VERSION`; \
738 MAJOR_VER=A; \
739 rm -f $(DESTDIR)$(libdir)/libpcap.$$VER.dylib; \
740 rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER.dylib; \
741 rm -f $(DESTDIR)$(libdir)/libpcap.dylib
742 uninstall-shared-sl:
743 MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
744 rm -f $(DESTDIR)$(libdir)/libpcap.$$MAJOR_VER; \
745 rm -f $(DESTDIR)$(libdir)/libpcap.sl
746 uninstall-shared-shareda:
747 rm -f $(DESTDIR)$(libdir)/libpcap.a
748 uninstall-shared-none:
749
750 uninstall-rpcapd:
751 (cd rpcapd; $(MAKE) DESTDIR=$(DESTDIR) uninstall)
752
753 clean:
754 rm -f $(CLEANFILES) config.h.in~ configure~ configure.ac~
755 (cd rpcapd; $(MAKE) clean)
756 (cd testprogs; $(MAKE) clean)
757
758 distclean: clean
759 rm -f Makefile grammar.y config.cache config.log config.status \
760 config.h os-proto.h libpcap.pc pcap-config stamp-h stamp-h.in
761 rm -f $(MAN3PCAP_EXPAND:.in=) $(MANFILE:.in=) $(MANMISC:.in=)
762 rm -rf autom4te.cache
763 (cd rpcapd; $(MAKE) distclean)
764 (cd testprogs; $(MAKE) distclean)
765
766 check: testprogs
767 $(srcdir)/testprogs/TESTrun
768
769 extags: $(TAGFILES)
770 ctags $(TAGFILES)
771
772 tags: $(TAGFILES)
773 ctags -wtd $(TAGFILES)
774
775 #
776 # Use git archive piped to tar to construct a subdirectory whose name
777 # is libpcap-{release}, containing all the checked-in source files,
778 # and then run autoreconf in that directory to generate the configure
779 # script and other files from that source. Then remove autom4te.cache,
780 # construct the release tarball from that subdirectory, and remove
781 # the subdirectory.
782 #
783 # The --format=tar is to force git archive to write a non-compressed
784 # archive, in case the platform's tar command doesn't have built-in
785 # decompression.
786 #
787 # The ^{tree} is there to force git archive not to write out the
788 # "helpful" global extended pax header with a commit ID, as not all
789 # versions of tar can handle that (Solaris tar can't, for example).
790 # (It turns HEAD, or a tag, both of which are apparently "tree-ish"es,
791 # into a tree; apparently, unlike HEAD, or a tag, which have a commit
792 # ID associated with them, the tree associated with them doesn't have
793 # a commit ID, so no commit ID is available to write, and thus
794 # git archive doesn't write one.)
795 #
796 releasetar:
797 @TAG=$(PROG)-`cat VERSION` && \
798 if [ ! -d .git ]; then echo 'Not in a git clone, stop.'; exit 1; fi && \
799 TMPTESTFILE=`mktemp -t tmptestfile_XXXXXXXX` && \
800 rm -f "$$TMPTESTFILE" && \
801 AUTORECONF_DIR=`dirname "$$TMPTESTFILE"`/"$(PROG)"_build_autoreconf_$$$$ && \
802 DIR=`pwd` && \
803 rm -rf "$$AUTORECONF_DIR" && \
804 mkdir "$$AUTORECONF_DIR" && \
805 cd "$$AUTORECONF_DIR" && \
806 if git -C "$$DIR" show-ref --tags --quiet --verify -- "refs/tags/$$TAG"; then \
807 (git -C "$$DIR" archive --format=tar --prefix="$$TAG"/ "$$TAG^{tree}" $(RELEASE_FILES) | \
808 tar xf -) && \
809 echo "Archive build from tag $$TAG."; \
810 else \
811 (git -C "$$DIR" archive --format=tar --prefix="$$TAG"/ "HEAD^{tree}" $(RELEASE_FILES) | \
812 tar xf -) && \
813 echo "No $$TAG tag. Archive build from HEAD."; \
814 fi && \
815 (cd "$$TAG" && ./autogen.sh && rm -rf autom4te.cache) && \
816 tar cf "$$DIR/$$TAG".tar "$$TAG" && \
817 rm -f "$$DIR/$$TAG".tar.gz && \
818 gzip --best "$$DIR/$$TAG".tar && \
819 cd "$$DIR" && \
820 rm -rf "$$AUTORECONF_DIR"
821
822 releasecheck: releasetar
823 @TAG=$(PROG)-`cat VERSION` && \
824 INSTALL_DIR=/tmp/install_"$$TAG"_$$$$ && \
825 DIR=`pwd` && \
826 cd /tmp && \
827 rm -rf "$$TAG" && \
828 rm -rf "$$INSTALL_DIR" && \
829 tar xf "$$DIR"/"$$TAG".tar.gz && \
830 cd "$$TAG" && \
831 echo "[$@] $$ touch .devel" && \
832 touch .devel && \
833 echo "[$@] $$ ./configure --enable-remote --quiet --prefix=$$INSTALL_DIR" && \
834 ./configure --enable-remote --quiet --prefix="$$INSTALL_DIR" && \
835 echo '[$@] $$ $(MAKE) -s all testprogs' && \
836 $(MAKE) -s all testprogs && \
837 echo '[$@] $$ $(MAKE) -s install' && \
838 $(MAKE) -s install && \
839 cd .. && \
840 rm -rf "$$TAG" && \
841 rm -rf "$$INSTALL_DIR" && \
842 tar xf "$$DIR"/"$$TAG".tar.gz && \
843 cd "$$TAG" && \
844 echo "[$@] $$ touch .devel" && \
845 touch .devel && \
846 mkdir build && \
847 cd build && \
848 echo '[$@] $$ cmake -DENABLE_REMOTE=yes [...] ..' && \
849 cmake -DENABLE_REMOTE=yes \
850 -DCMAKE_INSTALL_PREFIX="$$INSTALL_DIR" \
851 -DCMAKE_MESSAGE_LOG_LEVEL=NOTICE \
852 -DCMAKE_RULE_MESSAGES=OFF \
853 -DCMAKE_INSTALL_MESSAGE=NEVER \
854 .. && \
855 echo '[$@] $$ $(MAKE) -s all testprogs' && \
856 $(MAKE) -s all testprogs && \
857 echo '[$@] $$ $(MAKE) -s install' && \
858 $(MAKE) -s install && \
859 cd ../.. && \
860 rm -rf "$$TAG" && \
861 rm -rf "$$INSTALL_DIR" && \
862 echo '[$@] Done.'
863
864 whitespacecheck:
865 @# trailing space(s)?
866 @if git grep -I -n ' $$' $$(git ls-files|grep -v '^tests/'); then \
867 echo 'Error: Trailing space(s).'; \
868 exit 1; \
869 fi
870 @# trailing tab(s)?
871 @if git grep -I -n ' $$' $$(git ls-files|grep -v '^tests/'); then \
872 echo 'Error: Trailing tabs(s).'; \
873 exit 1; \
874 fi
875 @# space(s) before tab(s)?
876 @if git grep -I -n '[ ][ ]' $$(git ls-files|grep -v '^tests/'); then \
877 echo 'Error: space(s) before tab(s).'; \
878 exit 1; \
879 fi
880
881 depend: $(GENERATED_C_SRC) $(GENHDR)
882 $(MKDEP) -c $(CC) -m "$(DEPENDENCY_CFLAG)" -s "$(srcdir)" $(CFLAGS) $(DEFS) $(INCLS) $(SRC)
883 (cd rpcapd; $(MAKE) depend)
884 (cd testprogs; $(MAKE) depend)
885
886 shellcheck:
887 shellcheck -f gcc -e SC2006 autogen.sh build.sh build_matrix.sh build_common.sh mkdep .ci-coverity-scan-build.sh