2009-04-25 03:30:10 +00:00
|
|
|
Debian-specific modifications to the upstream Makefile.in to
|
|
|
|
build a shared library.
|
|
|
|
|
2008-07-07 14:41:48 +00:00
|
|
|
--- a/Makefile.in
|
|
|
|
+++ b/Makefile.in
|
2018-07-26 14:46:38 +00:00
|
|
|
@@ -40,6 +40,13 @@ mandir = @mandir@
|
2006-05-24 07:18:36 +00:00
|
|
|
srcdir = @srcdir@
|
|
|
|
VPATH = @srcdir@
|
|
|
|
|
|
|
|
+# some defines for shared library compilation
|
2016-12-10 09:56:22 +00:00
|
|
|
+LIBVERSION=1
|
2006-05-24 07:18:36 +00:00
|
|
|
+LIBNAME=pcap
|
|
|
|
+LIBRARY=lib$(LIBNAME).a
|
|
|
|
+SOLIBRARY=lib$(LIBNAME).so
|
2009-04-25 03:30:10 +00:00
|
|
|
+SHAREDLIB=$(SOLIBRARY).$(LIBVERSION)
|
2006-05-24 07:18:36 +00:00
|
|
|
+
|
|
|
|
#
|
|
|
|
# You shouldn't need to edit anything below.
|
|
|
|
#
|
2018-07-26 14:46:38 +00:00
|
|
|
@@ -69,7 +76,8 @@ INSTALL_RPCAPD=@INSTALL_RPCAPD@
|
|
|
|
EXTRA_NETWORK_LIBS=@EXTRA_NETWORK_LIBS@
|
2006-05-24 07:18:36 +00:00
|
|
|
|
2018-07-26 14:46:38 +00:00
|
|
|
# Standard CFLAGS for building members of a shared library
|
|
|
|
-FULL_CFLAGS = $(CCOPT) $(SHLIB_CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
|
|
|
|
+FULL_CFLAGS = $(CCOPT) $(SHLIB_CCOPT) $(INCLS) $(DEFS) $(CFLAGS) $(CPPFLAGS)
|
2016-12-10 09:56:22 +00:00
|
|
|
+CFLAGS_SHARED = -shared -Wl,-soname,$(SHAREDLIB)
|
2006-05-24 07:18:36 +00:00
|
|
|
|
|
|
|
INSTALL = @INSTALL@
|
|
|
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
2018-07-26 14:46:38 +00:00
|
|
|
@@ -84,7 +92,11 @@ YACC = @YACC@
|
2009-04-25 03:30:10 +00:00
|
|
|
# problem if you don't own the file but can write to the directory.
|
2006-05-24 07:18:36 +00:00
|
|
|
.c.o:
|
|
|
|
@rm -f $@
|
2013-04-01 21:07:34 +00:00
|
|
|
- $(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
|
|
|
|
+ $(CC) $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c
|
2009-04-25 03:30:10 +00:00
|
|
|
+
|
2016-12-10 09:56:22 +00:00
|
|
|
+%_pic.o: %.c %.o
|
2006-05-24 07:18:36 +00:00
|
|
|
+ @rm -f $@
|
2013-04-01 21:07:34 +00:00
|
|
|
+ $(CC) -fPIC $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c
|
2009-04-25 03:30:10 +00:00
|
|
|
|
2018-07-26 14:46:38 +00:00
|
|
|
PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @BT_MONITOR_SRC@ @NETFILTER_SRC@ @DBUS_SRC@ @NETMAP_SRC@ @RDMA_SRC@
|
2016-12-10 09:56:22 +00:00
|
|
|
FSRC = @V_FINDALLDEVS@
|
2018-07-26 14:46:38 +00:00
|
|
|
@@ -101,6 +113,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(
|
2006-05-24 07:18:36 +00:00
|
|
|
# We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
|
|
|
|
# hack the extra indirection
|
|
|
|
OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
|
|
|
|
+OBJ_PIC = $(PSRC:.c=_pic.o) $(FSRC:.c=_pic.o) $(CSRC:.c=_pic.o) $(SSRC:.c=_pic.o) $(GENSRC:.c=_pic.o)
|
2011-05-24 09:51:08 +00:00
|
|
|
PUBHDR = \
|
|
|
|
pcap.h \
|
|
|
|
pcap-bpf.h \
|
2018-07-26 14:46:38 +00:00
|
|
|
@@ -154,7 +167,7 @@ TAGFILES = \
|
2006-05-24 07:18:36 +00:00
|
|
|
|
2018-07-26 14:46:38 +00:00
|
|
|
CLEANFILES = $(OBJ) libpcap.a libpcap.so.`cat $(srcdir)/VERSION` \
|
2013-04-01 21:07:34 +00:00
|
|
|
$(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
|
2018-07-26 14:46:38 +00:00
|
|
|
- lex.yy.c pcap-config libpcap.pc
|
|
|
|
+ lex.yy.c pcap-config libpcap.pc $(OBJ_PIC)
|
2009-04-25 03:30:10 +00:00
|
|
|
|
|
|
|
MAN1 = pcap-config.1
|
|
|
|
|
2018-07-26 14:46:38 +00:00
|
|
|
@@ -386,7 +399,7 @@ libpcap.a: $(OBJ)
|
2013-04-01 21:07:34 +00:00
|
|
|
$(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
|
2011-05-24 10:42:49 +00:00
|
|
|
$(RANLIB) $@
|
|
|
|
|
|
|
|
-shared: libpcap.$(DYEXT)
|
|
|
|
+shared: $(SHAREDLIB)
|
|
|
|
|
2013-04-01 21:07:34 +00:00
|
|
|
libpcap.so: $(OBJ)
|
|
|
|
@rm -f $@
|
2018-07-26 14:46:38 +00:00
|
|
|
@@ -462,6 +475,12 @@ libpcap.shareda: $(OBJ)
|
2011-05-24 09:51:08 +00:00
|
|
|
#
|
|
|
|
libpcap.none:
|
2006-05-24 07:18:36 +00:00
|
|
|
|
|
|
|
+$(SHAREDLIB): $(OBJ_PIC)
|
|
|
|
+ -@rm -f $@
|
2016-12-10 09:56:22 +00:00
|
|
|
+ -@rm -f $(SOLIBRARY)
|
2013-04-01 21:07:34 +00:00
|
|
|
+ $(CC) $(CFLAGS_SHARED) $(LDFLAGS) -o $(SHAREDLIB) $(OBJ_PIC) -lc $(LIBS)
|
2016-12-10 09:56:22 +00:00
|
|
|
+ ln -s $(SHAREDLIB) $(SOLIBRARY)
|
2006-05-24 07:18:36 +00:00
|
|
|
+
|
2009-04-25 03:30:10 +00:00
|
|
|
scanner.c: $(srcdir)/scanner.l
|
2016-12-10 09:56:22 +00:00
|
|
|
$(LEX) -P pcap_ --header-file=scanner.h --nounput -o scanner.c $<
|
|
|
|
scanner.h: scanner.c
|
2018-07-26 14:46:38 +00:00
|
|
|
@@ -474,6 +493,9 @@ scanner.h: scanner.c
|
2016-12-10 09:56:22 +00:00
|
|
|
scanner.o: scanner.c grammar.h
|
2013-04-01 21:07:34 +00:00
|
|
|
$(CC) $(FULL_CFLAGS) -c scanner.c
|
2006-05-24 07:18:36 +00:00
|
|
|
|
2016-12-10 09:56:22 +00:00
|
|
|
+scanner_pic.o: scanner.c grammar.h
|
2013-04-01 21:07:34 +00:00
|
|
|
+ $(CC) -fPIC $(FULL_CFLAGS) -o $@ -c scanner.c
|
2006-05-24 07:18:36 +00:00
|
|
|
+
|
2016-12-10 09:56:22 +00:00
|
|
|
grammar.c: $(srcdir)/grammar.y
|
2018-07-26 14:46:38 +00:00
|
|
|
$(YACC) -p pcap_ -o grammar.c -d $<
|
|
|
|
grammar.h: grammar.c
|
|
|
|
@@ -486,6 +508,9 @@ grammar.h: grammar.c
|
|
|
|
grammar.o: grammar.c scanner.h
|
|
|
|
$(CC) $(FULL_CFLAGS) -c grammar.c
|
|
|
|
|
|
|
|
+grammar_pic.o: grammar.c scanner.h
|
|
|
|
+ $(CC) -fPIC $(FULL_CFLAGS) -o $@ -c grammar.c
|
|
|
|
+
|
2016-12-10 09:56:22 +00:00
|
|
|
gencode.o: $(srcdir)/gencode.c grammar.h scanner.h
|
|
|
|
$(CC) $(FULL_CFLAGS) -c $(srcdir)/gencode.c
|
2006-05-24 07:18:36 +00:00
|
|
|
|
2018-07-26 14:46:38 +00:00
|
|
|
@@ -524,6 +549,9 @@ pcap-config: $(srcdir)/pcap-config.in ./
|
|
|
|
mv $@.tmp $@
|
|
|
|
chmod a+x $@
|
2006-05-24 07:18:36 +00:00
|
|
|
|
|
|
|
+bpf_filter_pic.o: bpf_filter.c
|
2013-04-01 21:07:34 +00:00
|
|
|
+ $(CC) -fPIC $(FULL_CFLAGS) -c bpf_filter.c -o $@
|
2006-05-24 07:18:36 +00:00
|
|
|
+
|
2009-04-25 03:30:10 +00:00
|
|
|
#
|
2018-07-26 14:46:38 +00:00
|
|
|
# Remote pcap daemon.
|
2009-04-25 03:30:10 +00:00
|
|
|
#
|
2018-07-26 14:46:38 +00:00
|
|
|
@@ -614,14 +642,11 @@ install: install-shared install-archive
|
2016-07-21 15:45:26 +00:00
|
|
|
$(DESTDIR)$(mandir)/man@MAN_MISC_INFO@/`echo $$i | sed 's/.manmisc.in/.@MAN_MISC_INFO@/'`; done
|
|
|
|
|
|
|
|
install-shared: install-shared-$(DYEXT)
|
|
|
|
-install-shared-so: libpcap.so
|
|
|
|
+install-shared-so: $(SHAREDLIB)
|
2011-05-24 10:42:49 +00:00
|
|
|
[ -d $(DESTDIR)$(libdir) ] || \
|
2006-05-24 07:18:36 +00:00
|
|
|
(mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
|
2011-05-24 10:42:49 +00:00
|
|
|
- VER=`cat $(srcdir)/VERSION`; \
|
|
|
|
- MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
|
|
|
|
- $(INSTALL_PROGRAM) libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$VER; \
|
|
|
|
- ln -sf libpcap.so.$$VER $(DESTDIR)$(libdir)/libpcap.so.$$MAJOR_VER; \
|
|
|
|
- ln -sf libpcap.so.$$MAJOR_VER $(DESTDIR)$(libdir)/libpcap.so
|
2006-05-24 07:18:36 +00:00
|
|
|
+ $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/
|
2016-12-10 09:56:22 +00:00
|
|
|
+ ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY)
|
2011-05-24 10:42:49 +00:00
|
|
|
install-shared-dylib: libpcap.dylib
|
|
|
|
[ -d $(DESTDIR)$(libdir) ] || \
|
|
|
|
(mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
|
2013-04-01 21:07:34 +00:00
|
|
|
--- a/aclocal.m4
|
|
|
|
+++ b/aclocal.m4
|
2018-07-26 14:46:38 +00:00
|
|
|
@@ -507,7 +507,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT,
|
2013-04-01 21:07:34 +00:00
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
2018-07-26 14:46:38 +00:00
|
|
|
- V_SHLIB_CCOPT="$V_SHLIB_CCOPT $PIC_OPT"
|
|
|
|
+ V_SHLIB_CCOPT="$V_SHLIB_CCOPT"
|
2011-05-24 09:51:08 +00:00
|
|
|
V_SONAME_OPT="-Wl,-soname,"
|
|
|
|
V_RPATH_OPT="-Wl,-rpath,"
|
|
|
|
;;
|
2018-07-26 14:46:38 +00:00
|
|
|
@@ -570,7 +570,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT,
|
2011-05-24 09:51:08 +00:00
|
|
|
#
|
|
|
|
# "cc" is GCC.
|
|
|
|
#
|
2018-07-26 14:46:38 +00:00
|
|
|
- V_SHLIB_CCOPT="$V_SHLIB_CCOPT -fpic"
|
|
|
|
+ V_SHLIB_CCOPT="$V_SHLIB_CCOPT"
|
2011-05-24 09:51:08 +00:00
|
|
|
V_SHLIB_CMD="\$(CC)"
|
|
|
|
V_SHLIB_OPT="-shared"
|
|
|
|
V_SONAME_OPT="-Wl,-soname,"
|
2013-04-01 21:07:34 +00:00
|
|
|
--- a/pcap-config.in
|
|
|
|
+++ b/pcap-config.in
|
2018-07-26 14:46:38 +00:00
|
|
|
@@ -41,16 +41,6 @@ do
|
2013-04-01 21:07:34 +00:00
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
-if [ "$V_RPATH_OPT" != "" ]
|
|
|
|
-then
|
|
|
|
- #
|
|
|
|
- # If libdir isn't /usr/lib, add it to the run-time linker path.
|
|
|
|
- #
|
|
|
|
- if [ "$libdir" != "/usr/lib" ]
|
|
|
|
- then
|
|
|
|
- RPATH=$V_RPATH_OPT$libdir
|
|
|
|
- fi
|
|
|
|
-fi
|
|
|
|
if [ "$static" = 1 ]
|
|
|
|
then
|
|
|
|
#
|