1 From a16012bf4ea63f714468d80ebe101481c917e4b8 Mon Sep 17 00:00:00 2001
2 From: Peter Seiderer <ps.report@gmx.net>
3 Date: Wed, 2 Dec 2015 00:22:26 +0100
4 Subject: [PATCH] Adjust for buildroot build.
7 - fix devLib/gpio include path for local build (without installing first)
8 - change CFLAGS from '=' to '+=' to honour buildroot given flags
9 - add linker name link for libwiringPiDev and libwiringPi for local linking
10 (without installing first)
11 - fix install linker name link (do not link with absolute path)
12 - add gpio-static linking target
14 Signed-off-by: Peter Seiderer <ps.report@gmx.net>
16 devLib/Makefile | 9 +++++----
17 gpio/Makefile | 12 ++++++++----
18 wiringPi/Makefile | 7 ++++---
19 3 files changed, 17 insertions(+), 11 deletions(-)
21 diff --git a/devLib/Makefile b/devLib/Makefile
22 index 0fb0033..3117479 100644
25 @@ -36,10 +36,10 @@ DYNAMIC=libwiringPiDev.so.$(VERSION)
32 +INCLUDE = -I../wiringPi
34 -CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
35 +CFLAGS += $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
39 @@ -67,6 +67,7 @@ $(STATIC): $(OBJ)
41 $Q echo "[Link (Dynamic)]"
42 $Q $(CC) -shared -Wl,-soname,libwiringPiDev.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPiDev.so.$(VERSION) -lpthread $(OBJ)
43 + $Q ln -sf libwiringPiDev.so.$(VERSION) libwiringPiDev.so
47 @@ -91,7 +92,7 @@ install: $(DYNAMIC)
48 $Q echo "[Install Dynamic Lib]"
49 $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
50 $Q install -m 0755 libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION)
51 - $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION) $(DESTDIR)/lib/libwiringPiDev.so
52 + $Q ln -sf libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so
55 .PHONY: install-static
56 diff --git a/gpio/Makefile b/gpio/Makefile
57 index 7dcd090..e8e43f9 100644
60 @@ -32,11 +32,11 @@ endif
65 -INCLUDE = -I$(DESTDIR)$(PREFIX)/include
66 -CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
68 +INCLUDE = -I../wiringPi -I../devLib
69 +CFLAGS += $(DEBUG) -Wall $(INCLUDE) -Winline -pipe
71 -LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
72 +LDFLAGS = -L../wiringPi -L../devLib
73 LIBS = -lwiringPi -lwiringPiDev -lpthread
75 # May not need to alter anything below this line
76 @@ -55,6 +55,10 @@ gpio: $(OBJ)
78 $Q $(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
82 + $Q $(CC) -o gpio $(OBJ) ../wiringPi/libwiringPi.a ../devLib/libwiringPiDev.a -lpthread
86 $Q $(CC) -c $(CFLAGS) $< -o $@
87 diff --git a/wiringPi/Makefile b/wiringPi/Makefile
88 index 6bbcc5d..e0ccc52 100644
89 --- a/wiringPi/Makefile
90 +++ b/wiringPi/Makefile
91 @@ -36,10 +36,10 @@ DYNAMIC=libwiringPi.so.$(VERSION)
99 -CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
100 +CFLAGS += $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC
104 @@ -90,6 +90,7 @@ $(STATIC): $(OBJ)
106 $Q echo "[Link (Dynamic)]"
107 $Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) -lpthread $(OBJ)
108 + $Q ln -sf libwiringPi.so.$(VERSION) libwiringPi.so
112 @@ -115,7 +116,7 @@ install: $(DYNAMIC)
113 $Q echo "[Install Dynamic Lib]"
114 $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
115 $Q install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
116 - $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
117 + $Q ln -sf libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so
120 .PHONY: install-static