diff options
Diffstat (limited to 'recipes-devtools/wiringPi/files/0001-Add-initial-cross-compile-support.patch')
| -rw-r--r-- | recipes-devtools/wiringPi/files/0001-Add-initial-cross-compile-support.patch | 355 |
1 files changed, 168 insertions, 187 deletions
diff --git a/recipes-devtools/wiringPi/files/0001-Add-initial-cross-compile-support.patch b/recipes-devtools/wiringPi/files/0001-Add-initial-cross-compile-support.patch index c5ba270..ed47fab 100644 --- a/recipes-devtools/wiringPi/files/0001-Add-initial-cross-compile-support.patch +++ b/recipes-devtools/wiringPi/files/0001-Add-initial-cross-compile-support.patch | |||
| @@ -1,37 +1,26 @@ | |||
| 1 | From b0d82bc7cc90db41aa4f7012bbe3009f0b8ab11d Mon Sep 17 00:00:00 2001 | 1 | From 6d85e6cc3ab97c3f060e5e0a8e3f1945a14c86ba Mon Sep 17 00:00:00 2001 |
| 2 | From: =?UTF-8?q?Petter=20Mab=C3=A4cker?= <petter@technux.se> | 2 | From: Gianfranco Costamagna <gianfranco.costamagna@abinsula.com> |
| 3 | Date: Sat, 18 Jul 2015 23:20:05 +0200 | 3 | Date: Mon, 12 Oct 2015 12:15:51 +0200 |
| 4 | Subject: [PATCH] Add initial cross compile support | 4 | Subject: [PATCH] Add initial cross compile support (rebase from Petter Mabäcker <petter@technux.se> version) |
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | 5 | ||
| 9 | Upstream-Status: Pending | ||
| 10 | |||
| 11 | Signed-off-by: Petter Mabäcker <petter@technux.se> | ||
| 12 | --- | 6 | --- |
| 13 | devLib/Makefile | 58 +++++++++++++++++++++++++-------------------- | 7 | devLib/Makefile | 54 ++++++++++++++++++++++++------------------- |
| 14 | examples/Gertboard/Makefile | 22 ++++++++++------- | 8 | examples/Gertboard/Makefile | 22 +++++++++++------- |
| 15 | examples/Makefile | 19 +++++++++------ | 9 | examples/Makefile | 22 +++++++++++------- |
| 16 | examples/PiFace/Makefile | 22 ++++++++++------- | 10 | examples/PiFace/Makefile | 22 +++++++++++------- |
| 17 | examples/PiGlow/Makefile | 4 ++-- | 11 | examples/PiGlow/Makefile | 4 ++-- |
| 18 | examples/q2w/Makefile | 5 ++-- | 12 | examples/q2w/Makefile | 4 ++-- |
| 19 | gpio/Makefile | 31 +++++++++++++----------- | 13 | gpio/Makefile | 29 ++++++++++++----------- |
| 20 | wiringPi/Makefile | 56 ++++++++++++++++++++++++------------------- | 14 | wiringPi/Makefile | 50 +++++++++++++++++++++------------------ |
| 21 | 8 files changed, 124 insertions(+), 93 deletions(-) | 15 | 8 files changed, 119 insertions(+), 88 deletions(-) |
| 22 | 16 | ||
| 23 | diff --git a/devLib/Makefile b/devLib/Makefile | 17 | diff --git a/devLib/Makefile b/devLib/Makefile |
| 24 | index d62b532..c7c7884 100644 | 18 | index 0fb0033..cbea759 100644 |
| 25 | --- a/devLib/Makefile | 19 | --- a/devLib/Makefile |
| 26 | +++ b/devLib/Makefile | 20 | +++ b/devLib/Makefile |
| 27 | @@ -22,18 +22,22 @@ | 21 | @@ -31,15 +31,19 @@ ifneq ($V,1) |
| 28 | ################################################################################# | 22 | Q ?= @ |
| 29 | 23 | endif | |
| 30 | VERSION=$(shell cat ../VERSION) | ||
| 31 | -DESTDIR=/usr | ||
| 32 | -PREFIX=/local | ||
| 33 | +DESTDIR?=/usr | ||
| 34 | +PREFIX?=/local | ||
| 35 | 24 | ||
| 36 | -STATIC=libwiringPiDev.a | 25 | -STATIC=libwiringPiDev.a |
| 37 | -DYNAMIC=libwiringPiDev.so.$(VERSION) | 26 | -DYNAMIC=libwiringPiDev.so.$(VERSION) |
| @@ -48,7 +37,7 @@ index d62b532..c7c7884 100644 | |||
| 48 | +STATIC=$(BASE_NAME).a | 37 | +STATIC=$(BASE_NAME).a |
| 49 | +DYNAMIC=$(BASE_NAME).so.$(VERSION) | 38 | +DYNAMIC=$(BASE_NAME).so.$(VERSION) |
| 50 | + | 39 | + |
| 51 | +#DEBUG ?= -g -O0 | 40 | +#DEBUG ?= -g -O0 |
| 52 | +DEBUG ?= -O2 | 41 | +DEBUG ?= -O2 |
| 53 | +CC ?= gcc | 42 | +CC ?= gcc |
| 54 | +INCLUDE ?= -I. | 43 | +INCLUDE ?= -I. |
| @@ -57,81 +46,81 @@ index d62b532..c7c7884 100644 | |||
| 57 | 46 | ||
| 58 | LIBS = | 47 | LIBS = |
| 59 | 48 | ||
| 60 | @@ -60,16 +64,16 @@ $(STATIC): $(OBJ) | 49 | @@ -66,16 +70,16 @@ $(STATIC): $(OBJ) |
| 61 | 50 | ||
| 62 | $(DYNAMIC): $(OBJ) | 51 | $(DYNAMIC): $(OBJ) |
| 63 | @echo "[Link (Dynamic)]" | 52 | $Q echo "[Link (Dynamic)]" |
| 64 | - @$(CC) -shared -Wl,-soname,libwiringPiDev.so -o libwiringPiDev.so.$(VERSION) -lpthread $(OBJ) | 53 | - $Q $(CC) -shared -Wl,-soname,libwiringPiDev.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPiDev.so.$(VERSION) -lpthread $(OBJ) |
| 65 | + @$(CC) -shared -Wl,-soname,$(BASE_NAME).so.$(DYN_VERS_MAJ) -o $(BASE_NAME).so -lpthread $(OBJ) | 54 | + $Q $(CC) -shared -Wl,-soname,$(BASE_NAME).so.$(DYN_VERS_MAJ) -o $(BASE_NAME).so -lpthread $(OBJ) |
| 66 | 55 | ||
| 67 | .c.o: | 56 | .c.o: |
| 68 | @echo [Compile] $< | 57 | $Q echo [Compile] $< |
| 69 | - @$(CC) -c $(CFLAGS) $< -o $@ | 58 | - $Q $(CC) -c $(CFLAGS) $< -o $@ |
| 70 | + @$(CC) -c $(CFLAGS) -fPIC $< -o $@ | 59 | + $Q $(CC) -c $(CFLAGS) -fPIC $< -o $@ |
| 71 | 60 | ||
| 72 | .PHONY: clean | 61 | .PHONY: clean |
| 73 | clean: | 62 | clean: |
| 74 | @echo "[Clean]" | 63 | $Q echo "[Clean]" |
| 75 | - @rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPiDev.* | 64 | - $Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPiDev.* |
| 76 | + @rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak $(BASE_NAME).so* $(BASE_NAME).a | 65 | + $Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak $(BASE_NAME).so* $(BASE_NAME).a |
| 77 | 66 | ||
| 78 | .PHONY: tags | 67 | .PHONY: tags |
| 79 | tags: $(SRC) | 68 | tags: $(SRC) |
| 80 | @@ -80,22 +84,22 @@ tags: $(SRC) | 69 | @@ -86,22 +90,22 @@ tags: $(SRC) |
| 81 | .PHONY: install | 70 | .PHONY: install |
| 82 | install: $(DYNAMIC) | 71 | install: $(DYNAMIC) |
| 83 | @echo "[Install Headers]" | 72 | $Q echo "[Install Headers]" |
| 84 | - @install -m 0755 -d $(DESTDIR)$(PREFIX)/include | 73 | - $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include |
| 85 | - @install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include | 74 | - $Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include |
| 86 | + @install -m 0755 -d $(INCLUDE_DIR) | 75 | + $Q install -m 0755 -d $(INCLUDE_DIR) |
| 87 | + @install -m 0644 $(HEADERS) $(INCLUDE_DIR) | 76 | + $Q install -m 0644 $(HEADERS) $(INCLUDE_DIR) |
| 88 | @echo "[Install Dynamic Lib]" | 77 | $Q echo "[Install Dynamic Lib]" |
| 89 | - @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib | 78 | - $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib |
| 90 | - @install -m 0755 libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION) | 79 | - $Q install -m 0755 libwiringPiDev.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION) |
| 91 | - @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION) $(DESTDIR)/lib/libwiringPiDev.so | 80 | - $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPiDev.so.$(VERSION) $(DESTDIR)/lib/libwiringPiDev.so |
| 92 | - @ldconfig | 81 | - $Q $(LDCONFIG) |
| 93 | + @install -m 0755 -d $(LIB_DIR) | 82 | + $Q install -m 0755 -d $(LIB_DIR) |
| 94 | + @install -m 0755 $(BASE_NAME).so $(LIB_DIR)/$(DYNAMIC) | 83 | + $Q install -m 0755 $(BASE_NAME).so $(LIB_DIR)/$(DYNAMIC) |
| 95 | + @ln -sf $(DYNAMIC) $(LIB_DIR)/$(BASE_NAME).so | 84 | + $Q ln -sf $(DYNAMIC) $(LIB_DIR)/$(BASE_NAME).so |
| 96 | + @ln -sf $(DYNAMIC) $(LIB_DIR)/$(BASE_NAME).so.$(DYN_VERS_MAJ) | 85 | + $Q ln -sf $(DYNAMIC) $(LIB_DIR)/$(BASE_NAME).so.$(DYN_VERS_MAJ) |
| 97 | 86 | ||
| 98 | .PHONY: install-static | 87 | .PHONY: install-static |
| 99 | install-static: $(STATIC) | 88 | install-static: $(STATIC) |
| 100 | @echo "[Install Headers]" | 89 | $Q echo "[Install Headers]" |
| 101 | - @install -m 0755 -d $(DESTDIR)$(PREFIX)/include | 90 | - $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include |
| 102 | - @install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include | 91 | - $Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include |
| 103 | + @install -m 0755 -d $(INCLUDE_DIR) | 92 | + $Q install -m 0755 -d $(INCLUDE_DIR) |
| 104 | + @install -m 0644 $(HEADERS) $(INCLUDE_DIR) | 93 | + $Q install -m 0644 $(HEADERS) $(INCLUDE_DIR) |
| 105 | @echo "[Install Static Lib]" | 94 | $Q echo "[Install Static Lib]" |
| 106 | - @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib | 95 | - $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib |
| 107 | - @install -m 0755 libwiringPiDev.a $(DESTDIR)$(PREFIX)/lib | 96 | - $Q install -m 0755 libwiringPiDev.a $(DESTDIR)$(PREFIX)/lib |
| 108 | + @install -m 0755 -d $(LIB_DIR) | 97 | + $Q install -m 0755 -d $(LIB_DIR) |
| 109 | + @install -m 0644 $(STATIC) $(LIB_DIR) | 98 | + $Q install -m 0755 $(STATIC) $(LIB_DIR) |
| 110 | 99 | ||
| 111 | .PHONY: install-deb | 100 | .PHONY: install-deb |
| 112 | install-deb: $(DYNAMIC) | 101 | install-deb: $(DYNAMIC) |
| 113 | @@ -110,9 +114,11 @@ install-deb: $(DYNAMIC) | 102 | @@ -116,9 +120,11 @@ install-deb: $(DYNAMIC) |
| 114 | .PHONY: uninstall | 103 | .PHONY: uninstall |
| 115 | uninstall: | 104 | uninstall: |
| 116 | @echo "[UnInstall]" | 105 | $Q echo "[UnInstall]" |
| 117 | - @cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS) | 106 | - $Q cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS) |
| 118 | - @cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPiDev.* | 107 | - $Q cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPiDev.* |
| 119 | - @ldconfig | 108 | - $Q $(LDCONFIG) |
| 120 | + @cd $(INCLUDE_DIR) && rm -f $(HEADERS) | 109 | + $Q cd $(INCLUDE_DIR) && rm -f $(HEADERS) |
| 121 | + @rm -f $(LIB_DIR)/$(STATIC) | 110 | + $Q rm -f $(LIB_DIR)/$(STATIC) |
| 122 | + @rm -f $(LIB_DIR)/$(DYNAMIC) | 111 | + $Q rm -f $(LIB_DIR)/$(DYNAMIC) |
| 123 | + @rm -f $(LIB_DIR)/$(BASE_NAME).so | 112 | + $Q rm -f $(LIB_DIR)/$(BASE_NAME).so |
| 124 | + @rm -f $(LIB_DIR)/$(BASE_NAME).so.$(DYN_VERS_MAJ) | 113 | + $Q rm -f $(LIB_DIR)/$(BASE_NAME).so.$(DYN_VERS_MAJ) |
| 125 | 114 | ||
| 126 | 115 | ||
| 127 | .PHONY: depend | 116 | .PHONY: depend |
| 128 | diff --git a/examples/Gertboard/Makefile b/examples/Gertboard/Makefile | 117 | diff --git a/examples/Gertboard/Makefile b/examples/Gertboard/Makefile |
| 129 | index 7569261..b0c32e0 100644 | 118 | index 1939ad6..98d1415 100644 |
| 130 | --- a/examples/Gertboard/Makefile | 119 | --- a/examples/Gertboard/Makefile |
| 131 | +++ b/examples/Gertboard/Makefile | 120 | +++ b/examples/Gertboard/Makefile |
| 132 | @@ -5,14 +5,20 @@ | 121 | @@ -9,14 +9,20 @@ ifneq ($V,1) |
| 133 | # Copyright (c) 2013 Gordon Henderson | 122 | Q ?= @ |
| 134 | ################################################################################# | 123 | endif |
| 135 | 124 | ||
| 136 | -#DEBUG = -g -O0 | 125 | -#DEBUG = -g -O0 |
| 137 | -DEBUG = -O3 | 126 | -DEBUG = -O3 |
| @@ -159,26 +148,27 @@ index 7569261..b0c32e0 100644 | |||
| 159 | # Should not alter anything below this line | 148 | # Should not alter anything below this line |
| 160 | ############################################################################### | 149 | ############################################################################### |
| 161 | diff --git a/examples/Makefile b/examples/Makefile | 150 | diff --git a/examples/Makefile b/examples/Makefile |
| 162 | index c9967dc..c2f8b9d 100644 | 151 | index e6b9b71..931b167 100644 |
| 163 | --- a/examples/Makefile | 152 | --- a/examples/Makefile |
| 164 | +++ b/examples/Makefile | 153 | +++ b/examples/Makefile |
| 165 | @@ -22,15 +22,20 @@ | 154 | @@ -26,14 +26,20 @@ ifneq ($V,1) |
| 166 | # along with wiringPi. If not, see <http://www.gnu.org/licenses/>. | 155 | Q ?= @ |
| 167 | ################################################################################# | 156 | endif |
| 168 | |||
| 169 | +DESTDIR?=/usr | ||
| 170 | +PREFIX?=/local | ||
| 171 | 157 | ||
| 172 | -#DEBUG = -g -O0 | 158 | -#DEBUG = -g -O0 |
| 173 | -DEBUG = -O3 | 159 | -DEBUG = -O3 |
| 174 | -CC = gcc | 160 | -CC = gcc |
| 175 | -INCLUDE = -I/usr/local/include | 161 | -INCLUDE = -I/usr/local/include |
| 176 | -CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe | 162 | -CFLAGS = $(DEBUG) -Wall $(INCLUDE) -Winline -pipe |
| 177 | +INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include | 163 | - |
| 178 | +LIB_DIR?=$(DESTDIR)$(PREFIX)/lib | ||
| 179 | |||
| 180 | -LDFLAGS = -L/usr/local/lib | 164 | -LDFLAGS = -L/usr/local/lib |
| 181 | -LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm | 165 | -LDLIBS = -lwiringPi -lwiringPiDev -lpthread -lm |
| 166 | +DESTDIR?=/usr | ||
| 167 | +PREFIX?=/local | ||
| 168 | + | ||
| 169 | +INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include | ||
| 170 | +LIB_DIR?=$(DESTDIR)$(PREFIX)/lib | ||
| 171 | + | ||
| 182 | +#DEBUG ?= -g -O0 | 172 | +#DEBUG ?= -g -O0 |
| 183 | +DEBUG ?= -O3 | 173 | +DEBUG ?= -O3 |
| 184 | +CC ?= gcc | 174 | +CC ?= gcc |
| @@ -191,12 +181,12 @@ index c9967dc..c2f8b9d 100644 | |||
| 191 | # Should not alter anything below this line | 181 | # Should not alter anything below this line |
| 192 | ############################################################################### | 182 | ############################################################################### |
| 193 | diff --git a/examples/PiFace/Makefile b/examples/PiFace/Makefile | 183 | diff --git a/examples/PiFace/Makefile b/examples/PiFace/Makefile |
| 194 | index 0bde334..fc14c0c 100644 | 184 | index 4685adc..cfaf902 100644 |
| 195 | --- a/examples/PiFace/Makefile | 185 | --- a/examples/PiFace/Makefile |
| 196 | +++ b/examples/PiFace/Makefile | 186 | +++ b/examples/PiFace/Makefile |
| 197 | @@ -23,14 +23,20 @@ | 187 | @@ -26,14 +26,20 @@ ifneq ($V,1) |
| 198 | ################################################################################# | 188 | Q ?= @ |
| 199 | 189 | endif | |
| 200 | 190 | ||
| 201 | -#DEBUG = -g -O0 | 191 | -#DEBUG = -g -O0 |
| 202 | -DEBUG = -O3 | 192 | -DEBUG = -O3 |
| @@ -224,10 +214,10 @@ index 0bde334..fc14c0c 100644 | |||
| 224 | # Should not alter anything below this line | 214 | # Should not alter anything below this line |
| 225 | ############################################################################### | 215 | ############################################################################### |
| 226 | diff --git a/examples/PiGlow/Makefile b/examples/PiGlow/Makefile | 216 | diff --git a/examples/PiGlow/Makefile b/examples/PiGlow/Makefile |
| 227 | index 8d31141..482c9e7 100644 | 217 | index acd4818..dabd64e 100644 |
| 228 | --- a/examples/PiGlow/Makefile | 218 | --- a/examples/PiGlow/Makefile |
| 229 | +++ b/examples/PiGlow/Makefile | 219 | +++ b/examples/PiGlow/Makefile |
| 230 | @@ -26,10 +26,10 @@ | 220 | @@ -29,10 +29,10 @@ endif |
| 231 | #DEBUG = -g -O0 | 221 | #DEBUG = -g -O0 |
| 232 | DEBUG = -O3 | 222 | DEBUG = -O3 |
| 233 | CC = gcc | 223 | CC = gcc |
| @@ -241,14 +231,10 @@ index 8d31141..482c9e7 100644 | |||
| 241 | 231 | ||
| 242 | # Should not alter anything below this line | 232 | # Should not alter anything below this line |
| 243 | diff --git a/examples/q2w/Makefile b/examples/q2w/Makefile | 233 | diff --git a/examples/q2w/Makefile b/examples/q2w/Makefile |
| 244 | index 150c825..0544aa3 100644 | 234 | index 6f50fa0..c5e9f6e 100644 |
| 245 | --- a/examples/q2w/Makefile | 235 | --- a/examples/q2w/Makefile |
| 246 | +++ b/examples/q2w/Makefile | 236 | +++ b/examples/q2w/Makefile |
| 247 | @@ -22,14 +22,13 @@ | 237 | @@ -29,10 +29,10 @@ endif |
| 248 | # along with wiringPi. If not, see <http://www.gnu.org/licenses/>. | ||
| 249 | ################################################################################# | ||
| 250 | |||
| 251 | - | ||
| 252 | #DEBUG = -g -O0 | 238 | #DEBUG = -g -O0 |
| 253 | DEBUG = -O3 | 239 | DEBUG = -O3 |
| 254 | CC = gcc | 240 | CC = gcc |
| @@ -262,17 +248,12 @@ index 150c825..0544aa3 100644 | |||
| 262 | 248 | ||
| 263 | ############################################################################### | 249 | ############################################################################### |
| 264 | diff --git a/gpio/Makefile b/gpio/Makefile | 250 | diff --git a/gpio/Makefile b/gpio/Makefile |
| 265 | index 449986e..95af1ad 100644 | 251 | index 7dcd090..83ec454 100644 |
| 266 | --- a/gpio/Makefile | 252 | --- a/gpio/Makefile |
| 267 | +++ b/gpio/Makefile | 253 | +++ b/gpio/Makefile |
| 268 | @@ -23,16 +23,20 @@ | 254 | @@ -30,13 +30,17 @@ ifneq ($V,1) |
| 269 | # along with wiringPi. If not, see <http://www.gnu.org/licenses/>. | 255 | Q ?= @ |
| 270 | ################################################################################# | 256 | endif |
| 271 | |||
| 272 | -DESTDIR=/usr | ||
| 273 | -PREFIX=/local | ||
| 274 | +DESTDIR?=/usr | ||
| 275 | +PREFIX?=/local | ||
| 276 | 257 | ||
| 277 | -#DEBUG = -g -O0 | 258 | -#DEBUG = -g -O0 |
| 278 | -DEBUG = -O2 | 259 | -DEBUG = -O2 |
| @@ -290,49 +271,53 @@ index 449986e..95af1ad 100644 | |||
| 290 | +INCLUDE ?= -I$(INCLUDE_DIR) | 271 | +INCLUDE ?= -I$(INCLUDE_DIR) |
| 291 | +CFLAGS ?= $(DEBUG) -Wall $(INCLUDE) -Winline -pipe | 272 | +CFLAGS ?= $(DEBUG) -Wall $(INCLUDE) -Winline -pipe |
| 292 | + | 273 | + |
| 293 | +LDFLAGS = -L$(LIB_DIR) | 274 | +LDFLAGS ?= -L$(LIB_DIR) |
| 294 | LIBS = -lwiringPi -lwiringPiDev -lpthread -lm | 275 | LIBS = -lwiringPi -lwiringPiDev -lpthread |
| 295 | 276 | ||
| 296 | # May not need to alter anything below this line | 277 | # May not need to alter anything below this line |
| 297 | @@ -68,11 +72,10 @@ tags: $(SRC) | 278 | @@ -72,13 +76,10 @@ tags: $(SRC) |
| 298 | .PHONY: install | 279 | .PHONY: install |
| 299 | install: gpio | 280 | install: gpio |
| 300 | @echo "[Install]" | 281 | $Q echo "[Install]" |
| 301 | - @cp gpio $(DESTDIR)$(PREFIX)/bin | 282 | - $Q cp gpio $(DESTDIR)$(PREFIX)/bin |
| 302 | - @chown root.root $(DESTDIR)$(PREFIX)/bin/gpio | 283 | -ifneq ($(WIRINGPI_SUID),0) |
| 303 | - @chmod 4755 $(DESTDIR)$(PREFIX)/bin/gpio | 284 | - $Q chown root.root $(DESTDIR)$(PREFIX)/bin/gpio |
| 304 | - @mkdir -p $(DESTDIR)$(PREFIX)/man/man1 | 285 | - $Q chmod 4755 $(DESTDIR)$(PREFIX)/bin/gpio |
| 305 | - @cp gpio.1 $(DESTDIR)$(PREFIX)/man/man1 | 286 | -endif |
| 306 | + @install -d $(BIN_DIR) | 287 | - $Q mkdir -p $(DESTDIR)$(PREFIX)/man/man1 |
| 307 | + @install -m 4755 -o root -g root gpio $(BIN_DIR) | 288 | - $Q cp gpio.1 $(DESTDIR)$(PREFIX)/man/man1 |
| 308 | + @install -d $(DESTDIR)$(PREFIX)/share/man/man1 | 289 | + $Q install -d $(BIN_DIR) |
| 309 | + @install -m 644 -o root -g root gpio.1 $(DESTDIR)$(PREFIX)/share/man/man1 | 290 | + $Q install -m 4755 -o root -g root gpio $(BIN_DIR) |
| 291 | + $Q install -d $(DESTDIR)$(PREFIX)/share/man/man1 | ||
| 292 | + $Q install -m 644 -o root -g root gpio.1 $(DESTDIR)$(PREFIX)/share/man/man1 | ||
| 310 | 293 | ||
| 311 | .PHONY: install-deb | 294 | .PHONY: install-deb |
| 312 | install-deb: gpio | 295 | install-deb: gpio |
| 313 | @@ -83,7 +86,7 @@ install-deb: gpio | 296 | @@ -89,7 +90,7 @@ install-deb: gpio |
| 314 | .PHONY: uninstall | 297 | .PHONY: uninstall |
| 315 | uninstall: | 298 | uninstall: |
| 316 | @echo "[UnInstall]" | 299 | $Q echo "[UnInstall]" |
| 317 | - @rm -f $(DESTDIR)$(PREFIX)/bin/gpio | 300 | - $Q rm -f $(DESTDIR)$(PREFIX)/bin/gpio |
| 318 | + @rm -f $(BIN_DIR)/gpio | 301 | + $Q rm -f $(BIN_DIR)/gpio |
| 319 | @rm -f $(DESTDIR)$(PREFIX)/man/man1/gpio.1 | 302 | $Q rm -f $(DESTDIR)$(PREFIX)/man/man1/gpio.1 |
| 320 | 303 | ||
| 321 | .PHONY: depend | 304 | .PHONY: depend |
| 322 | diff --git a/wiringPi/Makefile b/wiringPi/Makefile | 305 | diff --git a/wiringPi/Makefile b/wiringPi/Makefile |
| 323 | index 015a894..5fc0659 100644 | 306 | index 6bbcc5d..5355b74 100644 |
| 324 | --- a/wiringPi/Makefile | 307 | --- a/wiringPi/Makefile |
| 325 | +++ b/wiringPi/Makefile | 308 | +++ b/wiringPi/Makefile |
| 326 | @@ -22,18 +22,22 @@ | 309 | @@ -25,19 +25,23 @@ VERSION=$(shell cat ../VERSION) |
| 327 | ################################################################################# | 310 | DESTDIR?=/usr |
| 311 | PREFIX?=/local | ||
| 328 | 312 | ||
| 329 | VERSION=$(shell cat ../VERSION) | ||
| 330 | -DESTDIR=/usr | ||
| 331 | -PREFIX=/local | ||
| 332 | +DESTDIR?=/usr | ||
| 333 | +PREFIX?=/local | ||
| 334 | +INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include | 313 | +INCLUDE_DIR?=$(DESTDIR)$(PREFIX)/include |
| 335 | +LIB_DIR?=$(DESTDIR)$(PREFIX)/lib | 314 | +LIB_DIR?=$(DESTDIR)$(PREFIX)/lib |
| 315 | + | ||
| 316 | LDCONFIG?=ldconfig | ||
| 317 | |||
| 318 | ifneq ($V,1) | ||
| 319 | Q ?= @ | ||
| 320 | endif | ||
| 336 | 321 | ||
| 337 | -STATIC=libwiringPi.a | 322 | -STATIC=libwiringPi.a |
| 338 | -DYNAMIC=libwiringPi.so.$(VERSION) | 323 | -DYNAMIC=libwiringPi.so.$(VERSION) |
| @@ -344,86 +329,82 @@ index 015a894..5fc0659 100644 | |||
| 344 | -DEBUG = -O2 | 329 | -DEBUG = -O2 |
| 345 | -CC = gcc | 330 | -CC = gcc |
| 346 | -INCLUDE = -I. | 331 | -INCLUDE = -I. |
| 347 | -DEFS = -D_GNU_SOURCE | ||
| 348 | +#DEBUG ?= -g -O0 | 332 | +#DEBUG ?= -g -O0 |
| 349 | CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC | ||
| 350 | +DEBUG ?= -O2 | 333 | +DEBUG ?= -O2 |
| 351 | +CC ?= gcc | 334 | +CC ?= gcc |
| 352 | +DEFS = -D_GNU_SOURCE | ||
| 353 | +INCLUDE ?= -I. | 335 | +INCLUDE ?= -I. |
| 354 | +CFLAGS ?= $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC | 336 | DEFS = -D_GNU_SOURCE |
| 355 | 337 | CFLAGS = $(DEBUG) $(DEFS) -Wformat=2 -Wall -Winline $(INCLUDE) -pipe -fPIC | |
| 356 | LIBS = | ||
| 357 | 338 | ||
| 358 | @@ -83,17 +87,17 @@ $(STATIC): $(OBJ) | 339 | @@ -89,17 +93,17 @@ $(STATIC): $(OBJ) |
| 359 | 340 | ||
| 360 | $(DYNAMIC): $(OBJ) | 341 | $(DYNAMIC): $(OBJ) |
| 361 | @echo "[Link (Dynamic)]" | 342 | $Q echo "[Link (Dynamic)]" |
| 362 | - @$(CC) -shared -Wl,-soname,libwiringPi.so -o libwiringPi.so.$(VERSION) -lpthread $(OBJ) | 343 | - $Q $(CC) -shared -Wl,-soname,libwiringPi.so$(WIRINGPI_SONAME_SUFFIX) -o libwiringPi.so.$(VERSION) -lpthread $(OBJ) |
| 363 | + @$(CC) -shared -Wl,-soname,$(BASE_NAME).so.$(DYN_VERS_MAJ) -o $(BASE_NAME).so -lpthread $(OBJ) | 344 | + $Q $(CC) -shared -Wl,-soname,$(BASE_NAME).so.$(DYN_VERS_MAJ) -o $(BASE_NAME).so -lpthread $(OBJ) |
| 364 | 345 | ||
| 365 | .c.o: | 346 | .c.o: |
| 366 | @echo [Compile] $< | 347 | $Q echo [Compile] $< |
| 367 | - @$(CC) -c $(CFLAGS) $< -o $@ | 348 | - $Q $(CC) -c $(CFLAGS) $< -o $@ |
| 368 | + @$(CC) -c $(CFLAGS) -fPIC $< -o $@ | 349 | + $Q $(CC) -c $(CFLAGS) -fPIC $< -o $@ |
| 369 | 350 | ||
| 370 | 351 | ||
| 371 | .PHONY: clean | 352 | .PHONY: clean |
| 372 | clean: | 353 | clean: |
| 373 | @echo "[Clean]" | 354 | $Q echo "[Clean]" |
| 374 | - @rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.* | 355 | - $Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak libwiringPi.* |
| 375 | + @rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak $(BASE_NAME).so* $(BASE_NAME).a | 356 | + $Q rm -f $(OBJ) $(OBJ_I2C) *~ core tags Makefile.bak $(BASE_NAME).so* $(BASE_NAME).a |
| 376 | 357 | ||
| 377 | .PHONY: tags | 358 | .PHONY: tags |
| 378 | tags: $(SRC) | 359 | tags: $(SRC) |
| 379 | @@ -104,22 +108,22 @@ tags: $(SRC) | 360 | @@ -110,22 +114,22 @@ tags: $(SRC) |
| 380 | .PHONY: install | 361 | .PHONY: install |
| 381 | install: $(DYNAMIC) | 362 | install: $(DYNAMIC) |
| 382 | @echo "[Install Headers]" | 363 | $Q echo "[Install Headers]" |
| 383 | - @install -m 0755 -d $(DESTDIR)$(PREFIX)/include | 364 | - $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include |
| 384 | - @install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include | 365 | - $Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include |
| 385 | + @install -m 0755 -d $(INCLUDE_DIR) | 366 | + $Q install -m 0755 -d $(INCLUDE_DIR) |
| 386 | + @install -m 0644 $(HEADERS) $(INCLUDE_DIR) | 367 | + $Q install -m 0644 $(HEADERS) $(INCLUDE_DIR) |
| 387 | @echo "[Install Dynamic Lib]" | 368 | $Q echo "[Install Dynamic Lib]" |
| 388 | - @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib | 369 | - $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib |
| 389 | - @install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) | 370 | - $Q install -m 0755 libwiringPi.so.$(VERSION) $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) |
| 390 | - @ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so | 371 | - $Q ln -sf $(DESTDIR)$(PREFIX)/lib/libwiringPi.so.$(VERSION) $(DESTDIR)/lib/libwiringPi.so |
| 391 | - @ldconfig | 372 | - $Q $(LDCONFIG) |
| 392 | + @install -m 0755 -d $(LIB_DIR) | 373 | + $Q install -m 0755 -d $(LIB_DIR) |
| 393 | + @install -m 0755 $(BASE_NAME).so $(LIB_DIR)/$(DYNAMIC) | 374 | + $Q install -m 0755 $(BASE_NAME).so $(LIB_DIR)/$(DYNAMIC) |
| 394 | + @ln -sf $(DYNAMIC) $(LIB_DIR)/$(BASE_NAME).so | 375 | + $Q ln -sf $(DYNAMIC) $(LIB_DIR)/$(BASE_NAME).so |
| 395 | + @ln -sf $(DYNAMIC) $(LIB_DIR)/$(BASE_NAME).so.$(DYN_VERS_MAJ) | 376 | + $Q ln -sf $(DYNAMIC) $(LIB_DIR)/$(BASE_NAME).so.$(DYN_VERS_MAJ) |
| 396 | 377 | ||
| 397 | .PHONY: install-static | 378 | .PHONY: install-static |
| 398 | install-static: $(STATIC) | 379 | install-static: $(STATIC) |
| 399 | @echo "[Install Headers]" | 380 | $Q echo "[Install Headers]" |
| 400 | - @install -m 0755 -d $(DESTDIR)$(PREFIX)/include | 381 | - $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/include |
| 401 | - @install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include | 382 | - $Q install -m 0644 $(HEADERS) $(DESTDIR)$(PREFIX)/include |
| 402 | + @install -m 0755 -d $(INCLUDE_DIR) | 383 | + $Q install -m 0755 -d $(INCLUDE_DIR) |
| 403 | + @install -m 0644 $(HEADERS) $(INCLUDE_DIR) | 384 | + $Q install -m 0644 $(HEADERS) $(INCLUDE_DIR) |
| 404 | @echo "[Install Static Lib]" | 385 | $Q echo "[Install Static Lib]" |
| 405 | - @install -m 0755 -d $(DESTDIR)$(PREFIX)/lib | 386 | - $Q install -m 0755 -d $(DESTDIR)$(PREFIX)/lib |
| 406 | - @install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib | 387 | - $Q install -m 0755 libwiringPi.a $(DESTDIR)$(PREFIX)/lib |
| 407 | + @install -m 0755 -d $(LIB_DIR) | 388 | + $Q install -m 0755 -d $(LIB_DIR) |
| 408 | + @install -m 0644 $(STATIC) $(LIB_DIR) | 389 | + $Q install -m 0755 $(STATIC) $(LIB_DIR) |
| 409 | 390 | ||
| 410 | .PHONY: install-deb | 391 | .PHONY: install-deb |
| 411 | install-deb: $(DYNAMIC) | 392 | install-deb: $(DYNAMIC) |
| 412 | @@ -134,9 +138,11 @@ install-deb: $(DYNAMIC) | 393 | @@ -140,9 +144,11 @@ install-deb: $(DYNAMIC) |
| 413 | .PHONY: uninstall | 394 | .PHONY: uninstall |
| 414 | uninstall: | 395 | uninstall: |
| 415 | @echo "[UnInstall]" | 396 | $Q echo "[UnInstall]" |
| 416 | - @cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS) | 397 | - $Q cd $(DESTDIR)$(PREFIX)/include/ && rm -f $(HEADERS) |
| 417 | - @cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPi.* | 398 | - $Q cd $(DESTDIR)$(PREFIX)/lib/ && rm -f libwiringPi.* |
| 418 | - @ldconfig | 399 | - $Q $(LDCONFIG) |
| 419 | + @cd $(INCLUDE_DIR) && rm -f $(HEADERS) | 400 | + $Q cd $(INCLUDE_DIR) && rm -f $(HEADERS) |
| 420 | + @rm -f $(LIB_DIR)/$(STATIC) | 401 | + $Q rm -f $(LIB_DIR)/$(STATIC) |
| 421 | + @rm -f $(LIB_DIR)/$(DYNAMIC) | 402 | + $Q rm -f $(LIB_DIR)/$(DYNAMIC) |
| 422 | + @rm -f $(LIB_DIR)/$(BASE_NAME).so | 403 | + $Q rm -f $(LIB_DIR)/$(BASE_NAME).so |
| 423 | + @rm -f $(LIB_DIR)/$(BASE_NAME).so.$(DYN_VERS_MAJ) | 404 | + $Q rm -f $(LIB_DIR)/$(BASE_NAME).so.$(DYN_VERS_MAJ) |
| 424 | 405 | ||
| 425 | 406 | ||
| 426 | .PHONY: depend | 407 | .PHONY: depend |
| 427 | -- | 408 | -- |
| 428 | 1.9.1 | 409 | 2.1.4 |
| 429 | 410 | ||
