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