1 # Copyright (c) 1993, 1994, 1995, 1996
2 # The Regents of the University of California. All rights reserved.
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
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.
20 # @(#) $Header: /tcpdump/master/libpcap/Makefile.in,v 1.108.2.28 2008-10-23 22:13:21 guy Exp $ (LBL)
23 # Various configurable paths (remember to edit Makefile.in, not Makefile)
28 exec_prefix = @exec_prefix@
29 datarootdir = @datarootdir@
30 # Pathname of directory to install the configure program
32 # Pathname of directory to install the include files
33 includedir = @includedir@
34 # Pathname of directory to install the library
36 # Pathname of directory to install the man pages
44 # You shouldn't need to edit anything below.
50 DEFS = @DEFS@ @V_DEFS@
58 CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
61 INSTALL_PROGRAM = @INSTALL_PROGRAM@
62 INSTALL_DATA = @INSTALL_DATA@
66 # Flex and bison allow you to specify the prefixes of the global symbols
67 # used by the generated parser. This allows programs to use lex/yacc
68 # and link against libpcap. If you don't have flex or bison, get them.
73 # Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
74 # Also, gcc does not remove the .o before forking 'as', which can be a
75 # problem if you don't own the file but can write to the directory.
78 $(CC) $(CFLAGS) -c $(srcdir)/$*.c
80 PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@
81 FSRC = fad-@V_FINDALLDEVS@.c
83 CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c \
84 etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c
85 GENSRC = scanner.c grammar.c version.c
88 SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(GENSRC)
90 # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
91 # hack the extra indirection
92 OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
117 scanner.h tokdefs.h version.h
123 $(SRC) $(HDR) $(TAGHDR)
125 CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
131 pcap_compile.3pcap.in \
132 pcap_datalink.3pcap.in \
133 pcap_dump_open.3pcap.in \
134 pcap_list_datalinks.3pcap.in \
135 pcap_open_dead.3pcap.in \
136 pcap_open_offline.3pcap.in
138 MAN3PCAP_NOEXPAND = \
139 pcap_activate.3pcap \
140 pcap_breakloop.3pcap \
141 pcap_can_set_rfmon.3pcap \
144 pcap_datalink_name_to_val.3pcap \
145 pcap_datalink_val_to_name.3pcap \
147 pcap_dump_close.3pcap \
148 pcap_dump_file.3pcap \
149 pcap_dump_flush.3pcap \
150 pcap_dump_ftell.3pcap \
153 pcap_findalldevs.3pcap \
154 pcap_freealldevs.3pcap \
155 pcap_freecode.3pcap \
156 pcap_free_datalinks.3pcap \
157 pcap_get_selectable_fd.3pcap \
160 pcap_is_swapped.3pcap \
161 pcap_lib_version.3pcap \
162 pcap_lookupdev.3pcap \
163 pcap_lookupnet.3pcap \
165 pcap_major_version.3pcap \
167 pcap_offline_filter.3pcap \
168 pcap_open_live.3pcap \
169 pcap_set_buffer_size.3pcap \
170 pcap_set_datalink.3pcap \
171 pcap_set_promisc.3pcap \
172 pcap_set_rfmon.3pcap \
173 pcap_set_snaplen.3pcap \
174 pcap_set_timeout.3pcap \
175 pcap_setdirection.3pcap \
176 pcap_setfilter.3pcap \
177 pcap_setnonblock.3pcap \
178 pcap_snapshot.3pcap \
180 pcap_statustostr.3pcap \
183 MAN3PCAP = $(MAN3PCAP_NOEXPAND) $(MAN3PCAP_EXPAND:.in=)
186 pcap-savefile.manfile.in
189 pcap-filter.manmisc.in \
190 pcap-linktype.manmisc.in
195 ChmodBPF/StartupParameters.plist \
210 SUNOS4/nit_if.o.sparc \
211 SUNOS4/nit_if.o.sun3 \
212 SUNOS4/nit_if.o.sun4c.4.0.3c \
216 bpf/net/bpf_filter.c \
258 org.tcpdump.chmod_bpf.plist \
259 packaging/pcap.spec.in \
290 Win32/Include/Gnuc.h \
291 Win32/Include/addrinfo.h \
292 Win32/Include/bittypes.h \
293 Win32/Include/cdecl_ext.h \
294 Win32/Include/inetprivate.h \
295 Win32/Include/ip6_misc.h \
296 Win32/Include/sockstorage.h \
297 Win32/Include/arpa/nameser.h \
298 Win32/Include/net/if.h \
299 Win32/Include/net/netdb.h \
300 Win32/Include/net/paths.h \
301 Win32/Prj/libpcap.dsp \
302 Win32/Prj/libpcap.dsw \
304 Win32/Src/gai_strerror.c \
305 Win32/Src/getaddrinfo.c \
306 Win32/Src/getnetbynm.c \
307 Win32/Src/getnetent.c \
309 Win32/Src/getservent.c \
310 Win32/Src/inet_aton.c \
311 Win32/Src/inet_net.c \
312 Win32/Src/inet_pton.c
314 all: libpcap.a pcap-config
318 $(AR) rc $@ $(OBJ) $(LIBS)
321 shared: libpcap.$(DYEXT)
324 # XXX - this works with GNU ld, but won't necessarily work with native
325 # ld on, for example, various SVR4-flavored platforms, or Digital UNIX.
329 $(CC) -shared -Wl,-soname,$@.1 -o $@.`cat $(srcdir)/VERSION` $(OBJ) $(DAGLIBS)
332 # The following rule succeeds, but the result is untested.
334 # XXX - OS X installs the library as "libpcap.A.dylib", with that as the
335 # install_name, and sets the current version to 1 as well. VERSION
336 # might contain a not-purely-numeric version number, but
337 # -current_version requires a purely numeric version, so this won't
338 # work with top-of-tree builds.
340 libpcap.dylib: $(OBJ)
342 $(CC) -dynamiclib -undefined error -o libpcap.`cat $(srcdir)/VERSION`.dylib $(OBJ) \
343 -install_name $(libdir)/libpcap.A.dylib \
344 -compatibility_version 1 \
345 -current_version `sed 's/[^0-9.].*$$//' $(srcdir)/VERSION`
347 scanner.c: $(srcdir)/scanner.l
349 ./runlex.sh $(LEX) -o$@ $<
351 scanner.o: scanner.c tokdefs.h
352 $(CC) $(CFLAGS) -c scanner.c
357 grammar.c: $(srcdir)/grammar.y
358 @rm -f grammar.c tokdefs.h
365 $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
368 $(CC) $(CFLAGS) -c version.c
370 snprintf.o: $(srcdir)/missing/snprintf.c
371 $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
373 version.c: $(srcdir)/VERSION
375 sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
378 # NOTE: this really is supposed to be static; importing a string
379 # from a shared library does not work very well on many
380 # versions of UNIX (Solaris, Linux, and the BSDs, for example),
381 # so we make the version string static and return it from
382 # a function, which does work.
384 version.h: $(srcdir)/VERSION
386 sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' $(srcdir)/VERSION > $@
388 bpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c
390 ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c
392 bpf_filter.o: bpf_filter.c
393 $(CC) $(CFLAGS) -c bpf_filter.c
396 # Generate the pcap-config script.
398 pcap-config: pcap-config.in Makefile
400 sed -e 's|@includedir[@]|$(includedir)|g' \
401 -e 's|@libdir[@]|$(libdir)|g' \
402 -e 's|@DEPLIBS[@]|$(DEPLIBS)|g' \
403 pcap-config.in >$@.tmp
408 # Test programs - not built by default, and not installed.
410 filtertest: filtertest.c libpcap.a
411 $(CC) $(CFLAGS) -I. -L. -o filtertest filtertest.c libpcap.a
413 findalldevstest: findalldevstest.c libpcap.a
414 $(CC) $(CFLAGS) -I. -L. -o findalldevstest findalldevstest.c libpcap.a
416 install: libpcap.a pcap-config
417 [ -d $(DESTDIR)$(libdir) ] || \
418 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
419 $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
420 $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
421 [ -d $(DESTDIR)$(includedir) ] || \
422 (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
423 [ -d $(DESTDIR)$(includedir)/pcap ] || \
424 (mkdir -p $(DESTDIR)$(includedir)/pcap; chmod 755 $(DESTDIR)$(includedir)/pcap)
425 [ -d $(DESTDIR)$(mandir)/man1 ] || \
426 (mkdir -p $(DESTDIR)$(mandir)/man1; chmod 755 $(DESTDIR)$(mandir)/man1)
427 [ -d $(DESTDIR)$(mandir)/man3 ] || \
428 (mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
429 [ -d $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@ ] || \
430 (mkdir -p $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@)
431 [ -d $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@ ] || \
432 (mkdir -p $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@; chmod 755 $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@)
433 $(INSTALL_DATA) $(srcdir)/pcap/pcap.h \
434 $(DESTDIR)$(includedir)/pcap/pcap.h
435 $(INSTALL_DATA) $(srcdir)/pcap/bpf.h \
436 $(DESTDIR)$(includedir)/pcap/bpf.h
437 $(INSTALL_DATA) $(srcdir)/pcap/namedb.h \
438 $(DESTDIR)$(includedir)/pcap/namedb.h
439 $(INSTALL_DATA) $(srcdir)/pcap/sll.h \
440 $(DESTDIR)$(includedir)/pcap/sll.h
441 $(INSTALL_DATA) $(srcdir)/pcap/usb.h \
442 $(DESTDIR)$(includedir)/pcap/usb.h
443 $(INSTALL_DATA) $(srcdir)/pcap.h $(DESTDIR)$(includedir)/pcap.h
444 $(INSTALL_DATA) $(srcdir)/pcap-bpf.h \
445 $(DESTDIR)$(includedir)/pcap-bpf.h
446 $(INSTALL_DATA) $(srcdir)/pcap-namedb.h \
447 $(DESTDIR)$(includedir)/pcap-namedb.h
448 $(INSTALL_PROGRAM) pcap-config $(DESTDIR)$(bindir)/pcap-config
449 for i in $(MAN1); do \
450 $(INSTALL_DATA) $(srcdir)/$$i \
451 $(DESTDIR)$(mandir)/man1/$$i; done
452 for i in $(MAN3PCAP); do \
453 $(INSTALL_DATA) $(srcdir)/$$i \
454 $(DESTDIR)$(mandir)/man3/$$i; done
455 ln $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_name.3pcap \
456 $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
457 ln $(DESTDIR)$(mandir)/man3/pcap_dump_open.3pcap \
458 $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
459 ln $(DESTDIR)$(mandir)/man3/pcap_geterr.3pcap \
460 $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
461 ln $(DESTDIR)$(mandir)/man3/pcap_inject.3pcap \
462 $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
463 ln $(DESTDIR)$(mandir)/man3/pcap_loop.3pcap \
464 $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
465 ln $(DESTDIR)$(mandir)/man3/pcap_major_version.3pcap \
466 $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
467 ln $(DESTDIR)$(mandir)/man3/pcap_next_ex.3pcap \
468 $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
469 ln $(DESTDIR)$(mandir)/man3/pcap_open_offline.3pcap \
470 $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
471 ln $(DESTDIR)$(mandir)/man3/pcap_setnonblock.3pcap \
472 $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
473 for i in $(MANFILE); do \
474 $(INSTALL_DATA) $(srcdir)/`echo $$i | sed 's/.manfile.in/.manfile/'` \
475 $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
476 for i in $(MANMISC); do \
477 $(INSTALL_DATA) $(srcdir)/`echo $$i | sed 's/.manmisc.in/.manmisc/'` \
478 $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
480 install-shared: install-shared-$(DYEXT)
481 install-shared-so: libpcap.so
482 $(INSTALL_PROGRAM) libpcap.so.`cat VERSION` $(DESTDIR)$(libdir)/libpcap.so.`cat VERSION`
483 install-shared-dylib: libpcap.dylib
484 $(INSTALL_PROGRAM) libpcap.`cat VERSION`.dylib $(DESTDIR)$(libdir)/libpcap.`cat VERSION`.dylib
485 VER=`cat VERSION`; cd $(DESTDIR)$(libdir) && ln -sf libpcap.$$VER.dylib libpcap.A.dylib; ln -sf libpcap.A.dylib libpcap.dylib
488 rm -f $(DESTDIR)$(libdir)/libpcap.a
489 rm -f $(DESTDIR)$(includedir)/pcap/pcap.h
490 rm -f $(DESTDIR)$(includedir)/pcap/bpf.h
491 rm -f $(DESTDIR)$(includedir)/pcap/namedb.h
492 rm -f $(DESTDIR)$(includedir)/pcap/sll.h
493 rm -f $(DESTDIR)$(includedir)/pcap/usb.h
494 -rmdir $(DESTDIR)$(includedir)/pcap
495 rm -f $(DESTDIR)$(includedir)/pcap.h
496 rm -f $(DESTDIR)$(includedir)/pcap-bpf.h
497 rm -f $(DESTDIR)$(includedir)/pcap-namedb.h
498 for i in $(MAN1); do \
499 rm -f $(DESTDIR)$(mandir)/man1/$$i; done
500 for i in $(MAN3PCAP); do \
501 rm -f $(DESTDIR)$(mandir)/man3/$$i; done
502 rm -f $(DESTDIR)$(mandir)/man3/pcap_datalink_val_to_description.3pcap
503 rm -f $(DESTDIR)$(mandir)/man3/pcap_dump_fopen.3pcap
504 rm -f $(DESTDIR)$(mandir)/man3/pcap_perror.3pcap
505 rm -f $(DESTDIR)$(mandir)/man3/pcap_sendpacket.3pcap
506 rm -f $(DESTDIR)$(mandir)/man3/pcap_dispatch.3pcap
507 rm -f $(DESTDIR)$(mandir)/man3/pcap_minor_version.3pcap
508 rm -f $(DESTDIR)$(mandir)/man3/pcap_next.3pcap
509 rm -f $(DESTDIR)$(mandir)/man3/pcap_fopen_offline.3pcap
510 rm -f $(DESTDIR)$(mandir)/man3/pcap_getnonblock.3pcap
511 for i in $(MANFILE); do \
512 rm -f $(DESTDIR)$(mandir)/man@MAN_FILE_FORMATS@/`echo $$i | sed 's/.manfile.in/.@MAN_FILE_FORMATS@/'`; done
513 for i in $(MANMISC); do \
514 rm -f $(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
517 rm -f $(CLEANFILES) libpcap*.dylib libpcap.so*
520 rm -f Makefile config.cache config.log config.status \
521 config.h gnuc.h os-proto.h bpf_filter.c pcap-config \
523 rm -f $(MAN3PCAP_EXPAND:.in=) $(MANFILE:.in=) $(MANMISC:.in=)
524 rm -rf autom4te.cache
527 ctags -wtd $(TAGFILES)
529 packaging/pcap.spec: packaging/pcap.spec.in VERSION
530 RPMVERSION=`cat VERSION | sed s/-.*//g`; \
531 sed -e s/@VERSION@/$$RPMVERSION/ -e s/@NAME@/libpcap-`cat VERSION`/ $< > $@
534 @cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
536 tar cf - $(CSRC) $(HDR) $(MAN1) $(MAN3PCAP_EXPAND) \
537 $(MAN3PCAP_NOEXPAND) $(MANFILE) $(MANMISC) $(EXTRA_DIST) | \
538 (cd $$name; tar xf -); \
539 tar -c -z -f $$name.tar.gz $$name; \
542 depend: $(GENSRC) $(GENHDR) bpf_filter.c
543 ./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
545 Makefile: Makefile.in config.status
547 @echo your Makefile was out of date, now run $(MAKE) again