Skip to contentSkip to conversation

ar9170-fw: Use self-built toolchain by default

PATCH In review Jan Kiszka 2 participants 4 messages Jun 6, 2009 Kbuild

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 2/2 ar9170-fw: Use self-built toolchain by default

---

 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
index e0113d6..5fc0868 100644
@@ -1,7 +1,7 @@
 # Type is AP or STA
 TYPE ?= STA
 
-PFX ?= /usr/share/gnush_v0901_elf-1/bin/sh-elf-
+PFX ?= $(shell pwd)/toolchain/inst/bin/sh-elf-
 CC = $(PFX)gcc
 LD = $(PFX)ld
 AS = $(PFX)as
#1 lore raw
Quoted 11 lines · Jan Kiszka

---

 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +0 -0
index e0113d6..5fc0868 100644

Makefile line 4

Quoted 5 lines
Makefile +1 -1
@@ -1,7 +1,7 @@
 # Type is AP or STA
 TYPE ?= STA
 
-PFX ?= /usr/share/gnush_v0901_elf-1/bin/sh-elf-
+PFX ?= $(shell pwd)/toolchain/inst/bin/sh-elf-

This will fail in strange ways if the user doesn't first manually build the toolchain... It does that if you don't have it installed, but it would be nice to tell them to build it?

johannes

author
#2 lore raw
Quoted 15 lines · Johannes Berg
Quoted 14 lines · Jan Kiszka

---

 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +0 -0
index e0113d6..5fc0868 100644
@@ -1,7 +1,7 @@
 # Type is AP or STA
 TYPE ?= STA
 
Quoted 7 lines

Makefile line 4

Quoted 2 lines
Makefile +1 -1
-PFX ?= /usr/share/gnush_v0901_elf-1/bin/sh-elf-
+PFX ?= $(shell pwd)/toolchain/inst/bin/sh-elf-

This will fail in strange ways if the user doesn't first manually build the toolchain... It does that if you don't have it installed, but it would be nice to tell them to build it?

What about this? There are probably smarter ways to achieve this, but I'm not speaking fluently 'make'.

---------->

Switch the default to our own toolchain and provide a hint in case it's missing or the provided PFX does not point to a gcc.

---

 Makefile |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
Makefile +7 -5
index e0113d6..6316f62 100644
@@ -1,11 +1,13 @@
 # Type is AP or STA
 TYPE ?= STA
 
-PFX ?= /usr/share/gnush_v0901_elf-1/bin/sh-elf-
-CC = $(PFX)gcc
-LD = $(PFX)ld
-AS = $(PFX)as
-OBJCOPY = $(PFX)objcopy
+PFX ?= $(shell pwd)/toolchain/inst/bin/sh-elf-
+VALID_PFX = $(if $(wildcard $(PFX)gcc), $(PFX), \
+	$(error Error: sh2 gcc not found. To build your own, invoke 'make -C toolchain'.))
+CC = $(VALID_PFX)gcc
+LD = $(VALID_PFX)ld
+AS = $(VALID_PFX)as
+OBJCOPY = $(VALID_PFX)objcopy
 
 # CPU is a Little endian sh2a-nofpu-or-sh3-nommu
 CPU = -m2
#3 lore raw
Quoted 2 lines · Jan Kiszka

What about this? There are probably smarter ways to achieve this, but I'm not speaking fluently 'make'.

Seems fine, thanks. I'll test both your patches and then merge them.

johannes