1999-10-07 23:46:40 +00:00
|
|
|
# Copyright (c) 1993, 1994, 1995, 1996
|
|
|
|
# The Regents of the University of California. All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that: (1) source code distributions
|
|
|
|
# retain the above copyright notice and this paragraph in its entirety, (2)
|
|
|
|
# distributions including binary code include the above copyright notice and
|
|
|
|
# this paragraph in its entirety in the documentation or other materials
|
|
|
|
# provided with the distribution, and (3) all advertising materials mentioning
|
|
|
|
# features or use of this software display the following acknowledgement:
|
|
|
|
# ``This product includes software developed by the University of California,
|
|
|
|
# Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
|
|
|
|
# the University nor the names of its contributors may be used to endorse
|
|
|
|
# or promote products derived from this software without specific prior
|
|
|
|
# written permission.
|
|
|
|
# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
|
|
|
|
# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
|
|
|
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
#
|
2007-07-24 02:36:34 +00:00
|
|
|
# @(#) $Header: /tcpdump/master/libpcap/Makefile.in,v 1.108 2007-07-24 02:36:34 mcr Exp $ (LBL)
|
1999-10-07 23:46:40 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Various configurable paths (remember to edit Makefile.in, not Makefile)
|
|
|
|
#
|
|
|
|
|
|
|
|
# Top level hierarchy
|
|
|
|
prefix = @prefix@
|
|
|
|
exec_prefix = @exec_prefix@
|
2006-12-20 08:19:37 +00:00
|
|
|
datarootdir = @datarootdir@
|
1999-10-07 23:46:40 +00:00
|
|
|
# Pathname of directory to install the include files
|
2000-07-30 05:56:49 +00:00
|
|
|
includedir = @includedir@
|
1999-10-07 23:46:40 +00:00
|
|
|
# Pathname of directory to install the library
|
2000-07-30 05:56:49 +00:00
|
|
|
libdir = @libdir@
|
1999-10-07 23:46:40 +00:00
|
|
|
# Pathname of directory to install the man page
|
2000-07-30 05:56:49 +00:00
|
|
|
mandir = @mandir@
|
1999-10-07 23:46:40 +00:00
|
|
|
|
|
|
|
# VPATH
|
|
|
|
srcdir = @srcdir@
|
|
|
|
VPATH = @srcdir@
|
|
|
|
|
|
|
|
#
|
|
|
|
# You shouldn't need to edit anything below.
|
|
|
|
#
|
|
|
|
|
|
|
|
CC = @CC@
|
|
|
|
CCOPT = @V_CCOPT@
|
|
|
|
INCLS = -I. @V_INCLS@
|
2003-07-23 05:29:19 +00:00
|
|
|
DEFS = @DEFS@ @V_DEFS@
|
|
|
|
LIBS = @V_LIBS@
|
2006-09-25 18:04:40 +00:00
|
|
|
DAGLIBS = @DAGLIBS@
|
2003-11-30 04:45:02 +00:00
|
|
|
DYEXT = @DYEXT@
|
2007-07-24 02:36:34 +00:00
|
|
|
PROG=libpcap
|
1999-10-07 23:46:40 +00:00
|
|
|
|
|
|
|
# Standard CFLAGS
|
|
|
|
CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
|
|
|
|
|
|
|
|
INSTALL = @INSTALL@
|
2000-07-30 05:56:49 +00:00
|
|
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
|
|
|
INSTALL_DATA = @INSTALL_DATA@
|
2000-06-10 14:20:24 +00:00
|
|
|
RANLIB = @RANLIB@
|
1999-10-07 23:46:40 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Flex and bison allow you to specify the prefixes of the global symbols
|
|
|
|
# used by the generated parser. This allows programs to use lex/yacc
|
|
|
|
# and link against libpcap. If you don't have flex or bison, get them.
|
|
|
|
#
|
|
|
|
LEX = @V_LEX@
|
|
|
|
YACC = @V_YACC@
|
|
|
|
|
|
|
|
# Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
|
|
|
|
# Also, gcc does not remove the .o before forking 'as', which can be a
|
|
|
|
# problem if you don't own the file but can write to the directory.
|
|
|
|
.c.o:
|
|
|
|
@rm -f $@
|
1999-10-19 15:18:28 +00:00
|
|
|
$(CC) $(CFLAGS) -c $(srcdir)/$*.c
|
1999-10-07 23:46:40 +00:00
|
|
|
|
2006-10-13 17:34:53 +00:00
|
|
|
PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@
|
2002-07-27 18:45:34 +00:00
|
|
|
FSRC = fad-@V_FINDALLDEVS@.c
|
2003-07-23 05:29:19 +00:00
|
|
|
SSRC = @SSRC@
|
1999-10-07 23:46:40 +00:00
|
|
|
CSRC = pcap.c inet.c gencode.c optimize.c nametoaddr.c \
|
2000-06-26 04:16:04 +00:00
|
|
|
etherent.c savefile.c bpf_filter.c bpf_image.c bpf_dump.c
|
1999-10-07 23:46:40 +00:00
|
|
|
GENSRC = scanner.c grammar.c version.c
|
2000-07-29 07:05:20 +00:00
|
|
|
LIBOBJS = @LIBOBJS@
|
1999-10-07 23:46:40 +00:00
|
|
|
|
2003-07-23 05:29:19 +00:00
|
|
|
SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(GENSRC)
|
1999-10-07 23:46:40 +00:00
|
|
|
|
|
|
|
# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
|
|
|
|
# hack the extra indirection
|
2003-12-15 01:35:03 +00:00
|
|
|
OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
|
1999-10-07 23:46:40 +00:00
|
|
|
HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
|
|
|
|
ethertype.h gencode.h gnuc.h
|
|
|
|
GENHDR = \
|
2003-02-11 07:40:09 +00:00
|
|
|
tokdefs.h version.h
|
1999-10-07 23:46:40 +00:00
|
|
|
|
|
|
|
TAGHDR = \
|
2003-02-11 01:46:05 +00:00
|
|
|
pcap-bpf.h
|
1999-10-07 23:46:40 +00:00
|
|
|
|
|
|
|
TAGFILES = \
|
|
|
|
$(SRC) $(HDR) $(TAGHDR)
|
|
|
|
|
|
|
|
CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
|
|
|
|
|
|
|
|
all: libpcap.a
|
|
|
|
|
|
|
|
libpcap.a: $(OBJ)
|
|
|
|
@rm -f $@
|
2003-07-23 05:29:19 +00:00
|
|
|
ar rc $@ $(OBJ) $(LIBS)
|
1999-10-07 23:46:40 +00:00
|
|
|
$(RANLIB) $@
|
|
|
|
|
2003-11-30 04:45:02 +00:00
|
|
|
shared: libpcap.$(DYEXT)
|
2003-11-30 22:46:13 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# XXX - this works with GNU ld, but won't necessarily work with native
|
|
|
|
# ld on, for example, various SVR4-flavored platforms, or Digital UNIX.
|
|
|
|
#
|
2003-11-30 04:45:02 +00:00
|
|
|
libpcap.so: $(OBJ)
|
|
|
|
@rm -f $@
|
2006-09-25 18:04:40 +00:00
|
|
|
$(CC) -shared -o $@.`cat VERSION` $(OBJ) $(DAGLIBS)
|
2003-11-30 04:45:02 +00:00
|
|
|
|
|
|
|
# the following rule succeeds, but the result is untested.
|
|
|
|
libpcap.dylib: $(OBJ)
|
|
|
|
rm -f libpcap*.dylib
|
|
|
|
$(CC) -dynamiclib -undefined error -o libpcap.`cat VERSION`.dylib $(OBJ) \
|
|
|
|
-install_name $(libdir)/libpcap.0.dylib -compatibility_version `cat VERSION` \
|
|
|
|
-current_version `cat VERSION`
|
|
|
|
|
1999-10-07 23:46:40 +00:00
|
|
|
scanner.c: $(srcdir)/scanner.l
|
|
|
|
@rm -f $@
|
|
|
|
$(LEX) -t $< > $$$$.$@; mv $$$$.$@ $@
|
|
|
|
|
|
|
|
scanner.o: scanner.c tokdefs.h
|
1999-10-30 05:33:45 +00:00
|
|
|
$(CC) $(CFLAGS) -c scanner.c
|
|
|
|
|
2003-02-21 03:19:19 +00:00
|
|
|
pcap.o: version.h
|
|
|
|
|
1999-10-07 23:46:40 +00:00
|
|
|
tokdefs.h: grammar.c
|
|
|
|
grammar.c: $(srcdir)/grammar.y
|
|
|
|
@rm -f grammar.c tokdefs.h
|
|
|
|
$(YACC) -d $<
|
|
|
|
mv y.tab.c grammar.c
|
|
|
|
mv y.tab.h tokdefs.h
|
|
|
|
|
|
|
|
grammar.o: grammar.c
|
|
|
|
@rm -f $@
|
|
|
|
$(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
|
|
|
|
|
|
|
|
version.o: version.c
|
1999-10-30 05:33:45 +00:00
|
|
|
$(CC) $(CFLAGS) -c version.c
|
|
|
|
|
2003-12-15 01:35:03 +00:00
|
|
|
snprintf.o: $(srcdir)/missing/snprintf.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
|
2000-07-29 07:05:20 +00:00
|
|
|
|
1999-10-07 23:46:40 +00:00
|
|
|
version.c: $(srcdir)/VERSION
|
|
|
|
@rm -f $@
|
|
|
|
sed -e 's/.*/char pcap_version[] = "&";/' $(srcdir)/VERSION > $@
|
|
|
|
|
2003-02-13 07:56:38 +00:00
|
|
|
#
|
|
|
|
# NOTE: this really is supposed to be static; importing a string
|
|
|
|
# from a shared library does not work very well on many
|
|
|
|
# versions of UNIX (Solaris, Linux, and the BSDs, for example),
|
|
|
|
# so we make the version string static and return it from
|
|
|
|
# a function, which does work.
|
|
|
|
#
|
2003-02-11 07:40:09 +00:00
|
|
|
version.h: $(srcdir)/VERSION
|
|
|
|
@rm -f $@
|
At least on SunOS 5.x, Digital UNIX 4.0, AIX 4.3, FreeBSD 3.4, some
version of Red Hat Linux, HP-UX 11.00, and MacOS X 10.1, if a string in
a shared library is static, and returned by a function in that library,
the return value of that function, when called from a program, will
reflect the contents of the string in the version of the shared library
with which the program is running, not the version with which it's
linked.
Therefore we can just generate a definition of the version string and
put it into "version.h", which means that VERSION can contain any string
(as long as " and \ are escaped with \) rather than having to be N.M or
N.M.MM.
2003-02-13 07:54:59 +00:00
|
|
|
sed -e 's/.*/static const char pcap_version_string[] = "libpcap version &";/' $(srcdir)/VERSION > $@
|
2003-02-11 07:40:09 +00:00
|
|
|
|
2000-03-31 16:59:43 +00:00
|
|
|
bpf_filter.c: $(srcdir)/bpf/net/bpf_filter.c
|
|
|
|
rm -f bpf_filter.c
|
|
|
|
ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c
|
|
|
|
|
|
|
|
bpf_filter.o: bpf_filter.c
|
|
|
|
$(CC) $(CFLAGS) -c bpf_filter.c
|
1999-10-30 05:33:45 +00:00
|
|
|
|
2005-08-10 06:19:05 +00:00
|
|
|
#
|
|
|
|
# Test programs - not built by default, and not installed.
|
|
|
|
#
|
2005-08-08 17:44:25 +00:00
|
|
|
filtertest: filtertest.c libpcap.a
|
|
|
|
$(CC) $(CFLAGS) -I. -L. -o filtertest filtertest.c libpcap.a
|
|
|
|
|
2005-08-10 06:19:05 +00:00
|
|
|
findalldevstest: findalldevstest.c libpcap.a
|
|
|
|
$(CC) $(CFLAGS) -I. -L. -o findalldevstest findalldevstest.c libpcap.a
|
|
|
|
|
2003-11-30 04:45:02 +00:00
|
|
|
install: libpcap.a
|
2000-09-19 14:52:41 +00:00
|
|
|
[ -d $(DESTDIR)$(libdir) ] || \
|
|
|
|
(mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
|
2000-07-30 05:56:49 +00:00
|
|
|
$(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
|
|
|
|
$(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
|
2000-09-19 14:52:41 +00:00
|
|
|
[ -d $(DESTDIR)$(includedir) ] || \
|
|
|
|
(mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
|
2006-10-04 18:09:21 +00:00
|
|
|
[ -d $(DESTDIR)$(includedir)/pcap ] || \
|
|
|
|
(mkdir -p $(DESTDIR)$(includedir)/pcap; chmod 755 $(DESTDIR)$(includedir)/pcap)
|
|
|
|
$(INSTALL_DATA) $(srcdir)/pcap/pcap.h \
|
|
|
|
$(DESTDIR)$(includedir)/pcap/pcap.h
|
|
|
|
$(INSTALL_DATA) $(srcdir)/pcap/bpf.h \
|
|
|
|
$(DESTDIR)$(includedir)/pcap/bpf.h
|
|
|
|
$(INSTALL_DATA) $(srcdir)/pcap/namedb.h \
|
|
|
|
$(DESTDIR)$(includedir)/pcap/namedb.h
|
|
|
|
$(INSTALL_DATA) $(srcdir)/pcap/sll.h \
|
|
|
|
$(DESTDIR)$(includedir)/pcap/sll.h
|
|
|
|
$(INSTALL_DATA) $(srcdir)/pcap/usb.h \
|
|
|
|
$(DESTDIR)$(includedir)/pcap/usb.h
|
2000-07-30 05:56:49 +00:00
|
|
|
$(INSTALL_DATA) $(srcdir)/pcap.h $(DESTDIR)$(includedir)/pcap.h
|
2003-02-11 01:46:05 +00:00
|
|
|
$(INSTALL_DATA) $(srcdir)/pcap-bpf.h \
|
|
|
|
$(DESTDIR)$(includedir)/pcap-bpf.h
|
2000-07-30 05:56:49 +00:00
|
|
|
$(INSTALL_DATA) $(srcdir)/pcap-namedb.h \
|
|
|
|
$(DESTDIR)$(includedir)/pcap-namedb.h
|
2001-01-18 04:05:12 +00:00
|
|
|
[ -d $(DESTDIR)$(mandir)/man3 ] || \
|
|
|
|
(mkdir -p $(DESTDIR)$(mandir)/man3; chmod 755 $(DESTDIR)$(mandir)/man3)
|
2000-07-30 05:56:49 +00:00
|
|
|
$(INSTALL_DATA) $(srcdir)/pcap.3 \
|
|
|
|
$(DESTDIR)$(mandir)/man3/pcap.3
|
1999-10-07 23:46:40 +00:00
|
|
|
|
2003-11-30 04:45:02 +00:00
|
|
|
install-shared: install-shared-$(DYEXT)
|
|
|
|
install-shared-so: libpcap.so
|
|
|
|
$(INSTALL_PROGRAM) libpcap.so.`cat VERSION` $(DESTDIR)$(libdir)/libpcap.so.`cat VERSION`
|
|
|
|
install-shared-dylib: libpcap.dylib
|
|
|
|
$(INSTALL_PROGRAM) libpcap.`cat VERSION`.dylib $(DESTDIR)$(libdir)/libpcap.`cat VERSION`.dylib
|
|
|
|
VER=`cat VERSION`; cd $(DESTDIR)$(libdir) && ln -sf libpcap.$$VER.dylib libpcap.0.dylib; ln -sf libpcap.0.dylib libpcap.dylib
|
|
|
|
|
2000-07-29 07:05:20 +00:00
|
|
|
uninstall:
|
2000-07-30 05:56:49 +00:00
|
|
|
rm -f $(DESTDIR)$(libdir)/libpcap.a
|
2006-10-04 18:09:21 +00:00
|
|
|
rm -f $(DESTDIR)$(includedir)/pcap/pcap.h
|
|
|
|
rm -f $(DESTDIR)$(includedir)/pcap/bpf.h
|
|
|
|
rm -f $(DESTDIR)$(includedir)/pcap/namedb.h
|
|
|
|
rm -f $(DESTDIR)$(includedir)/pcap/sll.h
|
|
|
|
rm -f $(DESTDIR)$(includedir)/pcap/usb.h
|
|
|
|
-rmdir $(DESTDIR)$(includedir)/pcap
|
2000-07-30 05:56:49 +00:00
|
|
|
rm -f $(DESTDIR)$(includedir)/pcap.h
|
2003-02-11 01:46:05 +00:00
|
|
|
rm -f $(DESTDIR)$(includedir)/pcap-bpf.h
|
2000-07-30 05:56:49 +00:00
|
|
|
rm -f $(DESTDIR)$(includedir)/pcap-namedb.h
|
|
|
|
rm -f $(DESTDIR)$(mandir)/man3/pcap.3
|
2000-07-29 07:05:20 +00:00
|
|
|
|
1999-10-07 23:46:40 +00:00
|
|
|
clean:
|
2003-11-30 04:45:02 +00:00
|
|
|
rm -f $(CLEANFILES) libpcap*.dylib libpcap.so*
|
1999-10-07 23:46:40 +00:00
|
|
|
|
2003-11-30 04:45:02 +00:00
|
|
|
distclean: clean
|
|
|
|
rm -f Makefile config.cache config.log config.status \
|
2003-02-11 01:46:05 +00:00
|
|
|
config.h gnuc.h os-proto.h bpf_filter.c stamp-h stamp-h.in
|
2003-11-30 04:45:02 +00:00
|
|
|
rm -rf autom4te.cache
|
1999-10-07 23:46:40 +00:00
|
|
|
|
|
|
|
tags: $(TAGFILES)
|
|
|
|
ctags -wtd $(TAGFILES)
|
|
|
|
|
2003-11-30 04:45:02 +00:00
|
|
|
packaging/pcap.spec: packaging/pcap.spec.in VERSION
|
|
|
|
RPMVERSION=`cat VERSION | sed s/-.*//g`; \
|
|
|
|
sed -e s/@VERSION@/$$RPMVERSION/ -e s/@NAME@/libpcap-`cat VERSION`/ $< > $@
|
|
|
|
|
2007-07-24 02:25:19 +00:00
|
|
|
releasetar:
|
|
|
|
@cwd=`pwd` ; dir=`basename $$cwd` ; name=$(PROG)-`cat VERSION` ; \
|
2007-07-24 02:36:34 +00:00
|
|
|
list="" ; make distclean; cd ..; mkdir -p n; cd n; ln -s ../$$dir $$name; \
|
|
|
|
tar -c -z -f $$name.tar.gz $$name/. ;
|
1999-10-07 23:46:40 +00:00
|
|
|
|
2003-02-11 08:01:40 +00:00
|
|
|
depend: $(GENSRC) $(GENHDR) bpf_filter.c
|
1999-10-07 23:46:40 +00:00
|
|
|
./mkdep -c $(CC) $(DEFS) $(INCLS) $(SRC)
|
2003-11-30 04:45:02 +00:00
|
|
|
|
|
|
|
Makefile: Makefile.in config.status
|
|
|
|
./config.status
|
|
|
|
@echo your Makefile was out of date, now run $(MAKE) again
|
|
|
|
exit 1
|