[package] correct kernel modules dependencies against kmod-i2c-core, they already...
[openwrt.git] / package / libpcap / patches / 100-shared-lib.patch
1 --- a/Makefile.in
2 +++ b/Makefile.in
3 @@ -37,6 +37,15 @@
4 srcdir = @srcdir@
5 VPATH = @srcdir@
6
7 +# some defines for shared library compilation
8 +MAJ=0.9
9 +MIN=8
10 +VERSION=$(MAJ).$(MIN)
11 +LIBNAME=pcap
12 +LIBRARY=lib$(LIBNAME).a
13 +SOLIBRARY=lib$(LIBNAME).so
14 +SHAREDLIB=$(SOLIBRARY).$(VERSION)
15 +
16 #
17 # You shouldn't need to edit anything below.
18 #
19 @@ -52,6 +61,7 @@
20
21 # Standard CFLAGS
22 CFLAGS = $(CCOPT) $(INCLS) $(DEFS)
23 +CFLAGS_SHARED = -shared -Wl,-soname,$(SOLIBRARY).$(MAJ)
24
25 INSTALL = @INSTALL@
26 INSTALL_PROGRAM = @INSTALL_PROGRAM@
27 @@ -72,7 +82,12 @@
28 .c.o:
29 @rm -f $@
30 $(CC) $(CFLAGS) -c $(srcdir)/$*.c
31 + $(CC) $(CFLAGS) -c -o $@ $(srcdir)/$*.c
32
33 +%_pic.o: %.c
34 + @rm -f $@
35 + $(CC) -fPIC $(CFLAGS) -c -o $@ $(srcdir)/$*.c
36 +
37 PSRC = pcap-@V_PCAP@.c
38 FSRC = fad-@V_FINDALLDEVS@.c
39 SSRC = @SSRC@
40 @@ -86,6 +101,7 @@
41 # We would like to say "OBJ = $(SRC:.c=.o)" but Ultrix's make cannot
42 # hack the extra indirection
43 OBJ = $(PSRC:.c=.o) $(FSRC:.c=.o) $(CSRC:.c=.o) $(SSRC:.c=.o) $(GENSRC:.c=.o) $(LIBOBJS)
44 +OBJ_PIC = $(PSRC:.c=_pic.o) $(FSRC:.c=_pic.o) $(CSRC:.c=_pic.o) $(SSRC:.c=_pic.o) $(GENSRC:.c=_pic.o)
45 HDR = pcap.h pcap-int.h pcap-namedb.h pcap-nit.h pcap-pf.h \
46 ethertype.h gencode.h gnuc.h
47 GENHDR = \
48 @@ -97,15 +113,23 @@
49 TAGFILES = \
50 $(SRC) $(HDR) $(TAGHDR)
51
52 -CLEANFILES = $(OBJ) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c
53 +CLEANFILES = $(OBJ) $(OBJ_PIC) libpcap.a $(GENSRC) $(GENHDR) lex.yy.c libpcap.so*
54
55 -all: libpcap.a
56 +all: libpcap.a $(SHAREDLIB)
57
58 libpcap.a: $(OBJ)
59 @rm -f $@
60 ar rc $@ $(OBJ) $(LIBS)
61 $(RANLIB) $@
62
63 +$(SHAREDLIB): $(OBJ_PIC)
64 + -@rm -f $@
65 + -@rm -f $(SOLIBRARY) $(SOLIBRARY).$(MAJ)
66 + $(CC) $(CFLAGS_SHARED) -o $(SHAREDLIB) $(OBJ_PIC) -lc
67 + ln -s $(SHAREDLIB) $(SOLIBRARY).$(MAJ)
68 + ln -s $(SOLIBRARY).$(MAJ) $(SOLIBRARY)
69 +
70 +
71 shared: libpcap.$(DYEXT)
72
73 #
74 @@ -131,6 +155,10 @@
75 scanner.o: scanner.c tokdefs.h
76 $(CC) $(CFLAGS) -c scanner.c
77
78 +scanner_pic.o: scanner.c tokdefs.h
79 + $(CC) -fPIC $(CFLAGS) -o $@ -c scanner.c
80 +
81 +
82 pcap.o: version.h
83
84 tokdefs.h: grammar.c
85 @@ -144,9 +172,16 @@
86 @rm -f $@
87 $(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
88
89 +grammar_pic.o: grammar.c
90 + @rm -f $@
91 + $(CC) -fPIC $(CFLAGS) -Dyylval=pcap_lval -o $@ -c grammar.c
92 +
93 version.o: version.c
94 $(CC) $(CFLAGS) -c version.c
95
96 +version_pic.o: version.c
97 + $(CC) -fPIC $(CFLAGS) -c version.c -o $@
98 +
99 snprintf.o: $(srcdir)/missing/snprintf.c
100 $(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
101
102 @@ -172,10 +207,17 @@
103 bpf_filter.o: bpf_filter.c
104 $(CC) $(CFLAGS) -c bpf_filter.c
105
106 +bpf_filter_pic.o: bpf_filter.c
107 + $(CC) -fPIC $(CFLAGS) -c bpf_filter.c -o $@
108 +
109 +
110 install: libpcap.a
111 [ -d $(DESTDIR)$(libdir) ] || \
112 (mkdir -p $(DESTDIR)$(libdir); chmod 755 $(DESTDIR)$(libdir))
113 $(INSTALL_DATA) libpcap.a $(DESTDIR)$(libdir)/libpcap.a
114 + $(INSTALL_DATA) $(SHAREDLIB) $(DESTDIR)$(libdir)/
115 + ln -sf $(SHAREDLIB) $(DESTDIR)$(libdir)/$(SOLIBRARY).$(MAJ)
116 + ln -sf $(SOLIBRARY).$(MAJ) $(DESTDIR)$(libdir)/$(SOLIBRARY)
117 $(RANLIB) $(DESTDIR)$(libdir)/libpcap.a
118 [ -d $(DESTDIR)$(includedir) ] || \
119 (mkdir -p $(DESTDIR)$(includedir); chmod 755 $(DESTDIR)$(includedir))
This page took 0.056535 seconds and 5 git commands to generate.