1 From 17ffb0cb301d4bf6ef900c8698d716f68cb77360 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 | 14 +++++++++-----
18 wiringPi/Makefile | 7 ++++---
19 3 files changed, 18 insertions(+), 12 deletions(-)
21 diff --git a/devLib/Makefile b/devLib/Makefile
22 index cf665d6..3fb41e8 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 @@ -69,6 +69,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 @@ -93,7 +94,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 f41a005..7095fa5 100644
60 @@ -32,11 +32,11 @@ endif
65 -INCLUDE = -I$(DESTDIR)$(PREFIX)/include
66 -CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe
68 +INCLUDE = -I../wiringPi -I../devLib
69 +CFLAGS += $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe
71 -LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
72 +LDFLAGS = -L../wiringPi -L../devLib
73 LIBS = -lwiringPi -lwiringPiDev -lpthread -lrt -lm -lcrypt
75 # May not need to alter anything below this line
76 @@ -52,9 +52,13 @@ version.h: ../VERSION
77 $Q echo Need to run newVersion above.
81 + $Q echo "[Link (Dynamic)]"
82 $Q $(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
85 + $Q echo "[Link (Static)]"
86 + $Q $(CC) -static -o gpio $(OBJ) ../wiringPi/libwiringPi.a ../devLib/libwiringPiDev.a -lpthread
90 $Q $(CC) -c $(CFLAGS) $< -o $@
91 diff --git a/wiringPi/Makefile b/wiringPi/Makefile
92 index e1868b9..68c950e 100644
93 --- a/wiringPi/Makefile
94 +++ b/wiringPi/Makefile
95 @@ -36,10 +36,10 @@ DYNAMIC=libwiringPi.so.$(VERSION)
103 -CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC
104 +CFLAGS += $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC
106 LIBS = -lm -lpthread -lrt -lcrypt
108 @@ -79,6 +79,7 @@ $(STATIC): $(OBJ)
110 $Q echo "[Link (Dynamic)]"
111 $Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(LIBS) $(OBJ)
112 + $Q ln -sf libwiringPi.so.$(VERSION) libwiringPi.so
116 @@ -104,7 +105,7 @@ install: $(DYNAMIC)
117 $Q echo "[Install Dynamic Lib]"
118 $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib
119 $Q install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION)
120 - $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so
121 + $Q ln -sf libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so
124 .PHONY: install-static