summaryrefslogtreecommitdiffstats
path: root/patches/libpcap-1.1.1/0002-compile-static-lib-without-fPIC.patch
blob: d417732bd2ef7d4d9dbdb55abac4776abb15127c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
From b3f3e35dbd100fb10cbd0ee5cf86baecce48a673 Mon Sep 17 00:00:00 2001
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Sun, 10 Jan 2010 00:47:38 +0100
Subject: [PATCH 2/4] compile static lib without -fPIC

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 Makefile.in |   26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

Index: b/Makefile.in
===================================================================
--- a/Makefile.in
+++ b/Makefile.in
@@ -76,9 +76,13 @@ YACC = @V_YACC@
 # Explicitly define compilation rule since SunOS 4's make doesn't like gcc.
 # Also, gcc does not remove the .o before forking 'as', which can be a
 # problem if you don't own the file but can write to the directory.
-.c.o:
+%.o: %.c
 	@rm -f $@
-	$(CC) $(CFLAGS) -c $(srcdir)/$*.c
+	$(CC) $(filter-out -fPIC,$(CFLAGS)) -c $(srcdir)/$*.c -o $@
+
+%.do: %.c
+	@rm -f $@
+	$(CC) $(CFLAGS) -c $(srcdir)/$*.c -o $@
 
 PSRC =	pcap-@V_PCAP@.c @USB_SRC@ @BT_SRC@ @CAN_SRC@
 FSRC =  fad-@V_FINDALLDEVS@.c
@@ -94,6 +98,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)
+DOBJ =	$(PSRC:.c=.do) $(FSRC:.c=.do) $(CSRC:.c=.do) $(SSRC:.c=.do) $(GENSRC:.c=.do) $(LIBOBJS:.o=.do)
 PUBHDR = \
 	pcap.h \
 	pcap-bpf.h \
@@ -129,7 +134,7 @@ GENHDR = \
 TAGFILES = \
 	$(SRC) $(HDR)
 
-CLEANFILES = $(OBJ) libpcap.* filtertest findalldevstest selpolltest \
+CLEANFILES = $(OBJ) $(DOBJ) libpcap.* filtertest findalldevstest selpolltest \
 	opentest $(PROG)-`cat $(srcdir)/VERSION`.tar.gz $(GENSRC) $(GENHDR) \
 	lex.yy.c pcap-config
 
@@ -333,12 +338,12 @@ libpcap.a: $(OBJ)
 
 shared: libpcap.$(DYEXT)
 
-libpcap.so: $(OBJ)
+libpcap.so: $(DOBJ)
 	@rm -f $@
 	VER=`cat $(srcdir)/VERSION`; \
 	MAJOR_VER=`sed 's/\([0-9][0-9]*\)\..*/\1/' $(srcdir)/VERSION`; \
 	@V_SHLIB_CMD@ @V_SHLIB_OPT@ @V_SONAME_OPT@$@.$$MAJOR_VER $(LDFLAGS) \
-	    -o $@.$$VER $(OBJ) $(ADDLOBJS) $(LIBS)
+	    -o $@.$$VER $(DOBJ) $(ADDLOBJS) $(LIBS)
 
 #
 # The following rule succeeds, but the result is untested.
@@ -414,7 +419,6 @@ scanner.c: $(srcdir)/scanner.l
 	$(srcdir)/runlex.sh $(LEX) -o$@ $<
 
 scanner.o: scanner.c tokdefs.h
-	$(CC) $(CFLAGS) -c scanner.c
 
 pcap.o: version.h
 
@@ -427,10 +431,11 @@ grammar.c: $(srcdir)/grammar.y
 
 grammar.o: grammar.c
 	@rm -f $@
-	$(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c
+	$(CC) $(filter-out -fPIC,$(CFLAGS)) -Dyylval=pcap_lval -c grammar.c -o $@
 
-version.o: version.c
-	$(CC) $(CFLAGS) -c version.c
+grammar.do: grammar.c
+	@rm -f $@
+	$(CC) $(CFLAGS) -Dyylval=pcap_lval -c grammar.c -o $@
 
 snprintf.o: $(srcdir)/missing/snprintf.c
 	$(CC) $(CFLAGS) -o $@ -c $(srcdir)/missing/snprintf.c
@@ -466,9 +471,6 @@ bpf_filter.c: $(srcdir)/bpf/net/bpf_filt
 	rm -f bpf_filter.c
 	ln -s $(srcdir)/bpf/net/bpf_filter.c bpf_filter.c
 
-bpf_filter.o: bpf_filter.c
-	$(CC) $(CFLAGS) -c bpf_filter.c
-
 #
 # Generate the pcap-config script.
 #