You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
174 lines
4.8 KiB
174 lines
4.8 KiB
Debian-specific modifications to the upstream Makefile.in to
|
|
build a shared library.
|
|
|
|
--- a/Makefile.in
|
|
+++ b/Makefile.in
|
|
@@ -40,6 +40,14 @@ mandir = @mandir@
|
|
srcdir = @srcdir@
|
|
VPATH = @srcdir@
|
|
|
|
+# some defines for shared library compilation
|
|
+MAJ=1.3
|
|
+LIBVERSION=$(MAJ).0
|
|
+LIBNAME=pcap
|
|
+LIBRARY=lib$(LIBNAME).a
|
|
+SOLIBRARY=lib$(LIBNAME).so
|
|
+SHAREDLIB=$(SOLIBRARY).$(LIBVERSION)
|
|
+
|
|
#
|
|
# You shouldn't need to edit anything below.
|
|
#
|
|
@@ -63,7 +71,8 @@ DEPENDENCY_CFLAG = @DEPENDENCY_CFLAG@
|
|
PROG=libpcap
|
|
|
|
# Standard CFLAGS
|
|
-FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS)
|
|
+FULL_CFLAGS = $(CCOPT) $(INCLS) $(DEFS) $(CFLAGS) $(CPPFLAGS)
|
|
+CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ)
|
|
|
|
INSTALL = @INSTALL@
|
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
|
@@ -83,7 +92,11 @@ YACC = @V_YACC@
|
|
# problem if you don't own the file but can write to the directory.
|
|
.c.o:
|
|
@rm -f $@
|
|
- $(CC) $(FULL_CFLAGS) -c $(srcdir)/$*.c
|
|
+ $(CC) $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c
|
|
+
|
|
+%_pic.o: %.c
|
|
+ @rm -f $@
|
|
+ $(CC) -fPIC $(FULL_CFLAGS) -c -o $@ $(srcdir)/$*.c
|
|
|
|
PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@ @NETFILTER_SRC@ @CANUSB_SRC@ @DBUS_SRC@
|
|
FSRC = fad-@V_FINDALLDEVS@.c
|
|
@@ -99,6 +112,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(
|
|
# 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)
|
|
PUBHDR = \
|
|
pcap.h \
|
|
pcap-bpf.h \
|
|
@@ -153,7 +167,7 @@ TAGFILES = \
|
|
|
|
CLEANFILES = $(OBJ) libpcap.* $(TESTS) \
|
|
$(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
|
|
- lex.yy.c pcap-config
|
|
+ lex.yy.c pcap-config $(OBJ_PIC)
|
|
|
|
MAN1 = pcap-config.1
|
|
|
|
@@ -363,7 +377,7 @@ libpcap.a: $(OBJ)
|
|
$(AR) rc $@ $(OBJ) $(ADDLARCHIVEOBJS)
|
|
$(RANLIB) $@
|
|
|
|
-shared: libpcap.$(DYEXT)
|
|
+shared: $(SHAREDLIB)
|
|
|
|
libpcap.so: $(OBJ)
|
|
@rm -f $@
|
|
@@ -441,6 +455,13 @@ libpcap.shareda: $(OBJ)
|
|
#
|
|
libpcap.none:
|
|
|
|
+$(SHAREDLIB): $(OBJ_PIC)
|
|
+ -@rm -f $@
|
|
+ -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ)
|
|
+ $(CC) $(CFLAGS_SHARED) $(LDFLAGS) -o $(SHAREDLIB) $(OBJ_PIC) -lc $(LIBS)
|
|
+ ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ)
|
|
+ ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY)
|
|
+
|
|
scanner.c: $(srcdir)/scanner.l
|
|
@rm -f $@
|
|
$(srcdir)/runlex.sh $(LEX) -o$@ $<
|
|
@@ -448,6 +469,9 @@ scanner.c: $(srcdir)/scanner.l
|
|
scanner.o: scanner.c tokdefs.h
|
|
$(CC) $(FULL_CFLAGS) -c scanner.c
|
|
|
|
+scanner_pic.o: scanner.c tokdefs.h
|
|
+ $(CC) -fPIC $(FULL_CFLAGS) -o $@ -c scanner.c
|
|
+
|
|
pcap.o: version.h
|
|
|
|
tokdefs.h: grammar.c
|
|
@@ -461,9 +485,16 @@ grammar.o: grammar.c
|
|
@rm -f $@
|
|
$(CC) $(FULL_CFLAGS) -Dyylval=pcap_lval -c grammar.c
|
|
|
|
+grammar_pic.o: grammar.c
|
|
+ @rm -f $@
|
|
+ $(CC) -fPIC $(FULL_CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c
|
|
+
|
|
version.o: version.c
|
|
$(CC) $(FULL_CFLAGS) -c version.c
|
|
|
|
+version_pic.o: version.c
|
|
+ $(CC) -fPIC $(FULL_CFLAGS) -c version.c -o $@
|
|
+
|
|
snprintf.o: $(srcdir)/missing/snprintf.c
|
|
$(CC) $(FULL_CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
|
|
|
|
@@ -501,6 +532,9 @@ bpf_filter.c: $(srcdir)/bpf/net/bpf_filt
|
|
bpf_filter.o: bpf_filter.c
|
|
$(CC) $(FULL_CFLAGS) -c bpf_filter.c
|
|
|
|
+bpf_filter_pic.o: bpf_filter.c
|
|
+ $(CC) -fPIC $(FULL_CFLAGS) -c bpf_filter.c -o $@
|
|
+
|
|
#
|
|
# Generate the pcap-config script.
|
|
#
|
|
@@ -618,11 +652,9 @@ install-shared: install-shared-$(DYEXT)
|
|
install-shared-so: libpcap.so
|
|
[ -d $(DESTDIR)$(libdir) ] || \
|
|
(mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
|
|
- 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
|
|
+ $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/
|
|
+ ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ)
|
|
+ ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY)
|
|
install-shared-dylib: libpcap.dylib
|
|
[ -d $(DESTDIR)$(libdir) ] || \
|
|
(mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
|
|
--- a/aclocal.m4
|
|
+++ b/aclocal.m4
|
|
@@ -440,7 +440,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT,
|
|
esac
|
|
;;
|
|
esac
|
|
- V_CCOPT="$V_CCOPT $PIC_OPT"
|
|
+ V_CCOPT="$V_CCOPT"
|
|
V_SONAME_OPT="-Wl,-soname,"
|
|
V_RPATH_OPT="-Wl,-rpath,"
|
|
;;
|
|
@@ -503,7 +503,7 @@ AC_DEFUN(AC_LBL_SHLIBS_INIT,
|
|
#
|
|
# "cc" is GCC.
|
|
#
|
|
- V_CCOPT="$V_CCOPT -fpic"
|
|
+ V_CCOPT="$V_CCOPT"
|
|
V_SHLIB_CMD="\$(CC)"
|
|
V_SHLIB_OPT="-shared"
|
|
V_SONAME_OPT="-Wl,-soname,"
|
|
--- a/pcap-config.in
|
|
+++ b/pcap-config.in
|
|
@@ -36,16 +36,6 @@ do
|
|
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
|
|
#
|
|
|