0001-Adjust-for-buildroot-build.patch
3.91 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
From a16012bf4ea63f714468d80ebe101481c917e4b8 Mon Sep 17 00:00:00 2001
From: Peter Seiderer <ps.report@gmx.net>
Date: Wed, 2 Dec 2015 00:22:26 +0100
Subject: [PATCH] Adjust for buildroot build.
- enable CC override
- fix devLib/gpio include path for local build (without installing first)
- change CFLAGS from '=' to '+=' to honour buildroot given flags
- add linker name link for libwiringPiDev and libwiringPi for local linking
(without installing first)
- fix install linker name link (do not link with absolute path)
- add gpio-static linking target
Signed-off-by: Peter Seiderer <ps.report@gmx.net>
---
devLib/Makefile | 9 +++++----
gpio/Makefile | 12 ++++++++----
wiringPi/Makefile | 7 ++++---
3 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/devLib/Makefile b/devLib/Makefile
index 0fb0033..3117479 100644
--- a/devLib/Makefile
+++ b/devLib/Makefile
@@ -36,10 +36,10 @@ DYNAMIC=libwiringPiDev.so.$(VERSION)
#DEBUG = -g -O0
DEBUG = -O2
-CC = gcc
-INCLUDE = -I.
+CC ?= gcc
+INCLUDE = -I../wiringPi
DEFS = -D_GNU_SOURCE
-CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
+CFLAGS += $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
LIBS =
@@ -67,6 +67,7 @@ $(STATIC): $(OBJ)
$(DYNAMIC): $(OBJ)
$Q echo "[Link (Dynamic)]"
$Q $(CC) -shared -Wl,-soname,libwiringPiDev.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPiDev.so.$(VERSION) -lpthread $(OBJ)
+ $Q ln -sf libwiringPiDev.so.$(VERSION) libwiringPiDev.so
.c.o:
$Q echo [Compile] $<
@@ -91,7 +92,7 @@ install: $(DYNAMIC)
$Q echo "[Install Dynamic Lib]"
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
$Q install -m 0755 libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION)
- $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION) $(DESTDIR)/lib/libwiringPiDev.so
+ $Q ln -sf libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so
$Q $(LDCONFIG)
.PHONY: install-static
diff --git a/gpio/Makefile b/gpio/Makefile
index 7dcd090..e8e43f9 100644
--- a/gpio/Makefile
+++ b/gpio/Makefile
@@ -32,11 +32,11 @@ endif
#DEBUG = -g -O0
DEBUG = -O2
-CC = gcc
-INCLUDE = -I$(DESTDIR)$(PREFIX)/include
-CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
+CC ?= gcc
+INCLUDE = -I../wiringPi -I../devLib
+CFLAGS += $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
-LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
+LDFLAGS = -L../wiringPi -L../devLib
LIBS = -lwiringPi -lwiringPiDev -lpthread
# May not need to alter anything below this line
@@ -55,6 +55,10 @@ gpio: $(OBJ)
$Q echo [Link]
$Q $(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
+gpio-static: $(OBJ)
+ $Q echo [Link]
+ $Q $(CC) -o gpio $(OBJ) ../wiringPi/libwiringPi.a ../devLib/libwiringPiDev.a -lpthread
+
.c.o:
$Q echo [Compile] $<
$Q $(CC) -c $(CFLAGS) $< -o $@
diff --git a/wiringPi/Makefile b/wiringPi/Makefile
index 6bbcc5d..e0ccc52 100644
--- a/wiringPi/Makefile
+++ b/wiringPi/Makefile
@@ -36,10 +36,10 @@ DYNAMIC=libwiringPi.so.$(VERSION)
#DEBUG = -g -O0
DEBUG = -O2
-CC = gcc
+CC ?= gcc
INCLUDE = -I.
DEFS = -D_GNU_SOURCE
-CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
+CFLAGS += $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
LIBS =
@@ -90,6 +90,7 @@ $(STATIC): $(OBJ)
$(DYNAMIC): $(OBJ)
$Q echo "[Link (Dynamic)]"
$Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) -lpthread $(OBJ)
+ $Q ln -sf libwiringPi.so.$(VERSION) libwiringPi.so
.c.o:
$Q echo [Compile] $<
@@ -115,7 +116,7 @@ install: $(DYNAMIC)
$Q echo "[Install Dynamic Lib]"
$Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
$Q install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
- $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
+ $Q ln -sf libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so
$Q $(LDCONFIG)
.PHONY: install-static
--
2.1.4