2009-04-25 06:30:10 +03:00
|
|
|
Debian-specific modifications to the upstream Makefile.in to
|
|
|
|
build a shared library.
|
|
|
|
---
|
|
|
|
Makefile.in | 45 ++++++++++++++++++++++++++++++++++++++++++---
|
|
|
|
configure | 2 +-
|
|
|
|
configure.in | 2 +-
|
|
|
|
3 files changed, 44 insertions(+), 5 deletions(-)
|
|
|
|
|
2008-07-07 17:41:48 +03:00
|
|
|
--- a/Makefile.in
|
|
|
|
+++ b/Makefile.in
|
2009-04-25 06:30:10 +03:00
|
|
|
@@ -40,6 +40,14 @@ mandir = @mandir@
|
2006-05-24 10:18:36 +03:00
|
|
|
srcdir = @srcdir@
|
|
|
|
VPATH = @srcdir@
|
|
|
|
|
|
|
|
+# some defines for shared library compilation
|
2011-05-24 12:51:08 +03:00
|
|
|
+MAJ=1.1
|
|
|
|
+LIBVERSION=$(MAJ).1
|
2006-05-24 10:18:36 +03:00
|
|
|
+LIBNAME=pcap
|
|
|
|
+LIBRARY=lib$(LIBNAME).a
|
|
|
|
+SOLIBRARY=lib$(LIBNAME).so
|
2009-04-25 06:30:10 +03:00
|
|
|
+SHAREDLIB=$(SOLIBRARY).$(LIBVERSION)
|
2006-05-24 10:18:36 +03:00
|
|
|
+
|
|
|
|
#
|
|
|
|
# You shouldn't need to edit anything below.
|
|
|
|
#
|
2011-05-24 12:51:08 +03:00
|
|
|
@@ -59,6 +67,7 @@ PROG=libpcap
|
2006-05-24 10:18:36 +03:00
|
|
|
|
|
|
|
# Standard CFLAGS
|
|
|
|
CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
|
|
|
|
+CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ)
|
|
|
|
|
|
|
|
INSTALL = @INSTALL@
|
|
|
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
2011-05-24 12:51:08 +03:00
|
|
|
@@ -78,7 +87,11 @@ YACC = @V_YACC@
|
2009-04-25 06:30:10 +03:00
|
|
|
# problem if you don't own the file but can write to the directory.
|
2006-05-24 10:18:36 +03:00
|
|
|
.c.o:
|
|
|
|
@rm -f $@
|
2009-04-25 06:30:10 +03:00
|
|
|
- $(CC) $(CFLAGS) -c $(srcdir)/$*.c
|
2006-05-24 10:18:36 +03:00
|
|
|
+ $(CC) $(CFLAGS) -c -o $@ $(srcdir)/$*.c
|
2009-04-25 06:30:10 +03:00
|
|
|
+
|
2006-05-24 10:18:36 +03:00
|
|
|
+%_pic.o: %.c
|
|
|
|
+ @rm -f $@
|
|
|
|
+ $(CC) -fPIC $(CFLAGS) -c -o $@ $(srcdir)/$*.c
|
2009-04-25 06:30:10 +03:00
|
|
|
|
2011-05-24 12:51:08 +03:00
|
|
|
PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@
|
2006-05-24 10:18:36 +03:00
|
|
|
FSRC = fad-@V_FINDALLDEVS@.c
|
2011-05-24 12:51:08 +03:00
|
|
|
@@ -94,6 +107,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(
|
2006-05-24 10:18:36 +03: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 12:51:08 +03:00
|
|
|
PUBHDR = \
|
|
|
|
pcap.h \
|
|
|
|
pcap-bpf.h \
|
|
|
|
@@ -131,7 +145,7 @@ TAGFILES = \
|
2006-05-24 10:18:36 +03:00
|
|
|
|
2011-05-24 12:51:08 +03:00
|
|
|
CLEANFILES = $(OBJ) libpcap.* filtertest findalldevstest selpolltest \
|
|
|
|
opentest $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
|
|
|
|
- lex.yy.c pcap-config
|
|
|
|
+ lex.yy.c pcap-config $(OBJ_PIC)
|
2009-04-25 06:30:10 +03:00
|
|
|
|
|
|
|
MAN1 = pcap-config.1
|
|
|
|
|
2011-05-24 12:51:08 +03:00
|
|
|
@@ -324,7 +338,7 @@ EXTRA_DIST = \
|
2009-04-25 06:30:10 +03:00
|
|
|
Win32/Src/inet_net.c \
|
|
|
|
Win32/Src/inet_pton.c
|
2006-05-24 10:18:36 +03:00
|
|
|
|
2011-05-24 12:51:08 +03:00
|
|
|
-all: libpcap.a shared pcap-config
|
|
|
|
+all: libpcap.a shared pcap-config $(SHAREDLIB)
|
2006-05-24 10:18:36 +03:00
|
|
|
|
|
|
|
libpcap.a: $(OBJ)
|
|
|
|
@rm -f $@
|
2011-05-24 12:51:08 +03:00
|
|
|
@@ -409,6 +423,13 @@ libpcap.shareda: $(OBJ)
|
|
|
|
#
|
|
|
|
libpcap.none:
|
2006-05-24 10:18:36 +03:00
|
|
|
|
|
|
|
+$(SHAREDLIB): $(OBJ_PIC)
|
|
|
|
+ -@rm -f $@
|
|
|
|
+ -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ)
|
|
|
|
+ $(CC) $(CFLAGS_SHARED) -o $(SHAREDLIB) $(OBJ_PIC) -lc
|
|
|
|
+ ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ)
|
|
|
|
+ ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY)
|
|
|
|
+
|
2009-04-25 06:30:10 +03:00
|
|
|
scanner.c: $(srcdir)/scanner.l
|
|
|
|
@rm -f $@
|
2011-05-24 12:51:08 +03:00
|
|
|
$(srcdir)/runlex.sh $(LEX) -o$@ $<
|
|
|
|
@@ -416,6 +437,9 @@ scanner.c: $(srcdir)/scanner.l
|
2006-05-24 10:18:36 +03:00
|
|
|
scanner.o: scanner.c tokdefs.h
|
|
|
|
$(CC) $(CFLAGS) -c scanner.c
|
|
|
|
|
|
|
|
+scanner_pic.o: scanner.c tokdefs.h
|
|
|
|
+ $(CC) -fPIC $(CFLAGS) -o $@ -c scanner.c
|
|
|
|
+
|
|
|
|
pcap.o: version.h
|
|
|
|
|
|
|
|
tokdefs.h: grammar.c
|
2011-05-24 12:51:08 +03:00
|
|
|
@@ -429,9 +453,17 @@ grammar.o: grammar.c
|
2006-05-24 10:18:36 +03:00
|
|
|
@rm -f $@
|
|
|
|
$(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
|
|
|
|
|
|
|
|
+grammar_pic.o: grammar.c
|
|
|
|
+ @rm -f $@
|
2009-04-25 06:30:10 +03:00
|
|
|
+ $(CC) -fPIC $(CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c
|
2006-05-24 10:18:36 +03:00
|
|
|
+
|
|
|
|
version.o: version.c
|
|
|
|
$(CC) $(CFLAGS) -c version.c
|
|
|
|
|
|
|
|
+version_pic.o: version.c
|
|
|
|
+ $(CC) -fPIC $(CFLAGS) -c version.c -o $@
|
2009-04-25 06:30:10 +03:00
|
|
|
+
|
2006-05-24 10:18:36 +03:00
|
|
|
+
|
|
|
|
snprintf.o: $(srcdir)/missing/snprintf.c
|
|
|
|
$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
|
|
|
|
|
2011-05-24 12:51:08 +03:00
|
|
|
@@ -469,6 +501,9 @@ bpf_filter.c: $(srcdir)/bpf/net/bpf_filt
|
2006-05-24 10:18:36 +03:00
|
|
|
bpf_filter.o: bpf_filter.c
|
|
|
|
$(CC) $(CFLAGS) -c bpf_filter.c
|
|
|
|
|
|
|
|
+bpf_filter_pic.o: bpf_filter.c
|
|
|
|
+ $(CC) -fPIC $(CFLAGS) -c bpf_filter.c -o $@
|
|
|
|
+
|
2009-04-25 06:30:10 +03:00
|
|
|
#
|
|
|
|
# Generate the pcap-config script.
|
|
|
|
#
|
2011-05-24 12:51:08 +03:00
|
|
|
@@ -604,6 +639,9 @@ install-archive-so install-archive-dylib
|
2006-05-24 10:18:36 +03:00
|
|
|
(mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
|
|
|
|
$(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
|
2009-04-25 06:30:10 +03:00
|
|
|
$(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
|
2006-05-24 10:18:36 +03:00
|
|
|
+ $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/
|
|
|
|
+ ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ)
|
|
|
|
+ ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY)
|
2011-05-24 12:51:08 +03:00
|
|
|
install-archive-shareda:
|
|
|
|
#
|
|
|
|
# AIX, however, doesn't, so we don't install the archive
|
2009-04-25 06:30:10 +03:00
|
|
|
--- a/configure
|
|
|
|
+++ b/configure
|
2011-05-24 12:51:08 +03:00
|
|
|
@@ -3229,7 +3229,7 @@ _ACEOF
|
|
|
|
# or accepts command-line arguments like
|
|
|
|
# those the GNU linker accepts.
|
|
|
|
#
|
|
|
|
- V_CCOPT="$V_CCOPT -fpic"
|
|
|
|
+ V_CCOPT="$V_CCOPT"
|
|
|
|
V_SONAME_OPT="-Wl,-soname,"
|
|
|
|
V_RPATH_OPT="-Wl,-rpath,"
|
|
|
|
;;
|
|
|
|
@@ -3292,7 +3292,7 @@ _ACEOF
|
|
|
|
#
|
|
|
|
# "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,"
|