1 Debian-specific modifications to the upstream Makefile.in to
2 build a shared library.
4 Makefile.in | 45 ++++++++++++++++++++++++++++++++++++++++++---
7 3 files changed, 44 insertions(+), 5 deletions(-)
11 @@ -40,6 +40,14 @@ mandir = @mandir@
15 +# some defines for shared library compilation
19 +LIBRARY=lib$(LIBNAME).a
20 +SOLIBRARY=lib$(LIBNAME).so
21 +SHAREDLIB=$(SOLIBRARY).$(LIBVERSION)
24 # You shouldn't need to edit anything below.
26 @@ -59,6 +67,7 @@ PROG=libpcap
29 CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
30 +CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ)
33 INSTALL_PROGRAM = @INSTALL_PROGRAM@
34 @@ -78,7 +87,11 @@ YACC = @V_YACC@
35 # problem if you don't own the file but can write to the directory.
38 - $(CC) $(CFLAGS) -c $(srcdir)/$*.c
39 + $(CC) $(CFLAGS) -c -o $@ $(srcdir)/$*.c
43 + $(CC) -fPIC $(CFLAGS) -c -o $@ $(srcdir)/$*.c
45 PSRC = pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@
46 FSRC = fad-@V_FINDALLDEVS@.c
47 @@ -94,6 +107,7 @@ SRC = $(PSRC) $(FSRC) $(CSRC) $(SSRC) $(
48 # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
49 # hack the extra indirection
50 OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
51 +OBJ_PIC = $(PSRC:.c=_pic.o) $(FSRC:.c=_pic.o) $(CSRC:.c=_pic.o) $(SSRC:.c=_pic.o) $(GENSRC:.c=_pic.o)
55 @@ -131,7 +145,7 @@ TAGFILES = \
57 CLEANFILES = $(OBJ) libpcap.* filtertest findalldevstest selpolltest \
58 opentest $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
59 - lex.yy.c pcap-config
60 + lex.yy.c pcap-config $(OBJ_PIC)
64 @@ -324,7 +338,7 @@ EXTRA_DIST = \
65 Win32/Src/inet_net.c \
68 -all: libpcap.a shared pcap-config
69 +all: libpcap.a shared pcap-config $(SHAREDLIB)
73 @@ -409,6 +423,13 @@ libpcap.shareda: $(OBJ)
77 +$(SHAREDLIB): $(OBJ_PIC)
79 + -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ)
80 + $(CC) $(CFLAGS_SHARED) -o $(SHAREDLIB) $(OBJ_PIC) -lc
81 + ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ)
82 + ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY)
84 scanner.c: $(srcdir)/scanner.l
86 $(srcdir)/runlex.sh $(LEX) -o$@ $<
87 @@ -416,6 +437,9 @@ scanner.c: $(srcdir)/scanner.l
88 scanner.o: scanner.c tokdefs.h
89 $(CC) $(CFLAGS) -c scanner.c
91 +scanner_pic.o: scanner.c tokdefs.h
92 + $(CC) -fPIC $(CFLAGS) -o $@ -c scanner.c
97 @@ -429,9 +453,17 @@ grammar.o: grammar.c
99 $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
101 +grammar_pic.o: grammar.c
103 + $(CC) -fPIC $(CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c
106 $(CC) $(CFLAGS) -c version.c
108 +version_pic.o: version.c
109 + $(CC) -fPIC $(CFLAGS) -c version.c -o $@
112 snprintf.o: $(srcdir)/missing/snprintf.c
113 $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
115 @@ -469,6 +501,9 @@ bpf_filter.c: $(srcdir)/bpf/net/bpf_filt
116 bpf_filter.o: bpf_filter.c
117 $(CC) $(CFLAGS) -c bpf_filter.c
119 +bpf_filter_pic.o: bpf_filter.c
120 + $(CC) -fPIC $(CFLAGS) -c bpf_filter.c -o $@
123 # Generate the pcap-config script.
125 @@ -604,6 +639,9 @@ install-archive-so install-archive-dylib
126 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
127 $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
128 $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
129 + $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/
130 + ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ)
131 + ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY)
132 install-archive-shareda:
134 # AIX, however, doesn't, so we don't install the archive
137 @@ -3229,7 +3229,7 @@ _ACEOF
138 # or accepts command-line arguments like
139 # those the GNU linker accepts.
141 - V_CCOPT="$V_CCOPT -fpic"
143 V_SONAME_OPT="-Wl,-soname,"
144 V_RPATH_OPT="-Wl,-rpath,"
146 @@ -3292,7 +3292,7 @@ _ACEOF
150 - V_CCOPT="$V_CCOPT -fpic"
153 V_SHLIB_OPT="-shared"
154 V_SONAME_OPT="-Wl,-soname,"