2017-03-15 22:08:28 +01:00
|
|
|
From 17ffb0cb301d4bf6ef900c8698d716f68cb77360 Mon Sep 17 00:00:00 2001
|
2016-06-03 20:10:33 +02:00
|
|
|
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 +++++----
|
2017-02-11 23:04:08 +01:00
|
|
|
gpio/Makefile | 14 +++++++++-----
|
2016-06-03 20:10:33 +02:00
|
|
|
wiringPi/Makefile | 7 ++++---
|
2017-02-11 23:04:08 +01:00
|
|
|
3 files changed, 18 insertions(+), 12 deletions(-)
|
2016-06-03 20:10:33 +02:00
|
|
|
|
|
|
|
diff --git a/devLib/Makefile b/devLib/Makefile
|
2017-03-15 22:08:28 +01:00
|
|
|
index cf665d6..3fb41e8 100644
|
2016-06-03 20:10:33 +02:00
|
|
|
--- 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 =
|
|
|
|
|
2017-02-11 23:04:08 +01:00
|
|
|
@@ -69,6 +69,7 @@ $(STATIC): $(OBJ)
|
2016-06-03 20:10:33 +02:00
|
|
|
$(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] $<
|
2017-02-11 23:04:08 +01:00
|
|
|
@@ -93,7 +94,7 @@ install: $(DYNAMIC)
|
2016-06-03 20:10:33 +02:00
|
|
|
$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
|
2017-03-15 22:08:28 +01:00
|
|
|
index f41a005..7095fa5 100644
|
2016-06-03 20:10:33 +02:00
|
|
|
--- a/gpio/Makefile
|
|
|
|
+++ b/gpio/Makefile
|
|
|
|
@@ -32,11 +32,11 @@ endif
|
|
|
|
|
|
|
|
#DEBUG = -g -O0
|
|
|
|
DEBUG = -O2
|
|
|
|
-CC = gcc
|
|
|
|
-INCLUDE = -I$(DESTDIR)$(PREFIX)/include
|
2017-03-15 22:08:28 +01:00
|
|
|
-CFLAGS = $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe
|
2016-06-03 20:10:33 +02:00
|
|
|
+CC ?= gcc
|
|
|
|
+INCLUDE = -I../wiringPi -I../devLib
|
2017-03-15 22:08:28 +01:00
|
|
|
+CFLAGS += $(DEBUG) -Wall -Wextra $(INCLUDE) -Winline -pipe
|
2016-06-03 20:10:33 +02:00
|
|
|
|
|
|
|
-LDFLAGS = -L$(DESTDIR)$(PREFIX)/lib
|
|
|
|
+LDFLAGS = -L../wiringPi -L../devLib
|
2017-03-15 22:08:28 +01:00
|
|
|
LIBS = -lwiringPi -lwiringPiDev -lpthread -lrt -lm -lcrypt
|
2016-06-03 20:10:33 +02:00
|
|
|
|
|
|
|
# May not need to alter anything below this line
|
2017-02-11 23:04:08 +01:00
|
|
|
@@ -52,9 +52,13 @@ version.h: ../VERSION
|
|
|
|
$Q echo Need to run newVersion above.
|
|
|
|
|
|
|
|
gpio: $(OBJ)
|
|
|
|
- $Q echo [Link]
|
|
|
|
+ $Q echo "[Link (Dynamic)]"
|
2016-06-03 20:10:33 +02:00
|
|
|
$Q $(CC) -o $@ $(OBJ) $(LDFLAGS) $(LIBS)
|
|
|
|
|
|
|
|
+gpio-static: $(OBJ)
|
2017-02-11 23:04:08 +01:00
|
|
|
+ $Q echo "[Link (Static)]"
|
|
|
|
+ $Q $(CC) -static -o gpio $(OBJ) ../wiringPi/libwiringPi.a ../devLib/libwiringPiDev.a -lpthread
|
2016-06-03 20:10:33 +02:00
|
|
|
+
|
|
|
|
.c.o:
|
|
|
|
$Q echo [Compile] $<
|
|
|
|
$Q $(CC) -c $(CFLAGS) $< -o $@
|
|
|
|
diff --git a/wiringPi/Makefile b/wiringPi/Makefile
|
2017-03-15 22:08:28 +01:00
|
|
|
index e1868b9..68c950e 100644
|
2016-06-03 20:10:33 +02:00
|
|
|
--- 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
|
2017-03-15 22:08:28 +01:00
|
|
|
-CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC
|
|
|
|
+CFLAGS += $(DEBUG) $(DEFS) -Wformat=2 -Wall -Wextra -Winline $(INCLUDE) -pipe -fPIC
|
2016-06-03 20:10:33 +02:00
|
|
|
|
2017-03-15 22:08:28 +01:00
|
|
|
LIBS = -lm -lpthread -lrt -lcrypt
|
2016-06-03 20:10:33 +02:00
|
|
|
|
2017-03-15 22:08:28 +01:00
|
|
|
@@ -79,6 +79,7 @@ $(STATIC): $(OBJ)
|
2016-06-03 20:10:33 +02:00
|
|
|
$(DYNAMIC): $(OBJ)
|
|
|
|
$Q echo "[Link (Dynamic)]"
|
2017-03-15 22:08:28 +01:00
|
|
|
$Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) $(LIBS) $(OBJ)
|
2016-06-03 20:10:33 +02:00
|
|
|
+ $Q ln -sf libwiringPi.so.$(VERSION) libwiringPi.so
|
|
|
|
|
|
|
|
.c.o:
|
|
|
|
$Q echo [Compile] $<
|
2017-03-15 22:08:28 +01:00
|
|
|
@@ -104,7 +105,7 @@ install: $(DYNAMIC)
|
2016-06-03 20:10:33 +02:00
|
|
|
$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
|
|
|
|
--
|
2017-02-11 23:04:08 +01:00
|
|
|
2.11.0
|
2016-06-03 20:10:33 +02:00
|
|
|
|