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 @@ -56,6 +64,7 @@ PROG=libpcap
29 CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
30 +CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ)
33 INSTALL_PROGRAM = @INSTALL_PROGRAM@
34 @@ -75,7 +84,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@
46 FSRC = fad-@V_FINDALLDEVS@.c
47 @@ -90,6 +103,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 @@ -122,7 +136,8 @@ TAGHDR = \
57 $(SRC) $(HDR) $(TAGHDR)
59 -CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
60 +CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c \
61 + $(OBJ_PIC) libpcap.so*
65 @@ -311,7 +326,7 @@ EXTRA_DIST = \
66 Win32/Src/inet_net.c \
69 -all: libpcap.a pcap-config
70 +all: libpcap.a pcap-config $(SHAREDLIB)
74 @@ -344,6 +359,13 @@ libpcap.dylib: $(OBJ)
75 -compatibility_version 1 \
76 -current_version `sed 's/[^0-9.].*$$//' $(srcdir)/VERSION`
78 +$(SHAREDLIB): $(OBJ_PIC)
80 + -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ)
81 + $(CC) $(CFLAGS_SHARED) -o $(SHAREDLIB) $(OBJ_PIC) -lc
82 + ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ)
83 + ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY)
85 scanner.c: $(srcdir)/scanner.l
87 ./runlex.sh $(LEX) -o$@ $<
88 @@ -351,6 +373,9 @@ scanner.c: $(srcdir)/scanner.l
89 scanner.o: scanner.c tokdefs.h
90 $(CC) $(CFLAGS) -c scanner.c
92 +scanner_pic.o: scanner.c tokdefs.h
93 + $(CC) -fPIC $(CFLAGS) -o $@ -c scanner.c
98 @@ -364,9 +389,17 @@ grammar.o: grammar.c
100 $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
102 +grammar_pic.o: grammar.c
104 + $(CC) -fPIC $(CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c
107 $(CC) $(CFLAGS) -c version.c
109 +version_pic.o: version.c
110 + $(CC) -fPIC $(CFLAGS) -c version.c -o $@
113 snprintf.o: $(srcdir)/missing/snprintf.c
114 $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
116 @@ -392,6 +425,9 @@ bpf_filter.c: $(srcdir)/bpf/net/bpf_filt
117 bpf_filter.o: bpf_filter.c
118 $(CC) $(CFLAGS) -c bpf_filter.c
120 +bpf_filter_pic.o: bpf_filter.c
121 + $(CC) -fPIC $(CFLAGS) -c bpf_filter.c -o $@
124 # Generate the pcap-config script.
126 @@ -418,6 +454,9 @@ install: libpcap.a pcap-config
127 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
128 $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
129 $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
130 + $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/
131 + ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ)
132 + ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY)
133 [ -d $(DESTDIR)$(includedir) ] || \
134 (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
135 [ -d $(DESTDIR)$(includedir)/pcap ] || \
138 @@ -8658,7 +8658,7 @@ irix*)
142 - V_CCOPT="$V_CCOPT -fPIC"
149 @@ -943,7 +943,7 @@ irix*)
153 - V_CCOPT="$V_CCOPT -fPIC"