Hi Jonas,

On Fri, Nov 28, 2014 at 10:19:28PM +0100, Jonas Gorski wrote:
> On Fri, Nov 28, 2014 at 7:20 PM, Maxime Ripard
> <[email protected]> wrote:
> > Switch to a dumber implementation that will be easier to maintain in the 
> > long
> > run, with only if statements instead of having nested subst calls.
> >
> > Signed-off-by: Maxime Ripard <[email protected]>
> > ---
> >  include/kernel.mk | 25 +++++++++++++++++++++----
> >  1 file changed, 21 insertions(+), 4 deletions(-)
> >
> > diff --git a/include/kernel.mk b/include/kernel.mk
> > index 01fb4dbd8107..97eb1f74f4f7 100644
> > --- a/include/kernel.mk
> > +++ b/include/kernel.mk
> > @@ -64,13 +64,30 @@ endif
> >
> >  ifneq (,$(findstring uml,$(BOARD)))
> >    LINUX_KARCH=um
> > +else ifeq ($(ARCH),aarch64)
> > +  LINUX_KARCH := arm64
> > +else ifeq ($(ARCH),aarch64_be)
> > +  LINUX_KARCH := arm64
> > +else ifeq ($(ARCH),armeb)
> > +  LINUX_KARCH := arm
> > +else ifeq ($(ARCH),mipsel)
> > +  LINUX_KARCH := mips
> > +else ifeq ($(ARCH),mips64)
> > +  LINUX_KARCH := mips
> > +else ifeq ($(ARCH),mips64el)
> > +  LINUX_KARCH := mips
> > +else ifeq ($(ARCH),sh2)
> > +  LINUX_KARCH := sh
> > +else ifeq ($(ARCH),sh3)
> > +  LINUX_KARCH := sh
> > +else ifeq ($(ARCH),sh4)
> > +  LINUX_KARCH := sh
> > +else ifeq ($(ARCH),i386)
> > +  LINUX_KARCH := x86
> > +else ifeq ($(ARCH),aarch64_be)
> > +  LINUX_KARCH := arm64
> > +else ifeq ($(ARCH),armeb)
> > +  LINUX_KARCH := arm
> > +else ifeq ($(ARCH),mipsel)
> > +  LINUX_KARCH := mips
> > +else ifeq ($(ARCH),mips64)
> > +  LINUX_KARCH := mips
> > +else ifeq ($(ARCH),mips64el)
> > +  LINUX_KARCH := mips
> > +else ifeq ($(ARCH),sh2)
> > +  LINUX_KARCH := sh
> > +else ifeq ($(ARCH),sh3)
> > +  LINUX_KARCH := sh
> > +else ifeq ($(ARCH),sh4)
> > +  LINUX_KARCH := sh
> > +else ifeq ($(ARCH),i386)
> > +  LINUX_KARCH := x86
> >  else
> > -  ifeq (,$(LINUX_KARCH))
> > -    LINUX_KARCH=$(strip $(subst i386,x86,$(subst armeb,arm,$(subst 
> > mipsel,mips,$(subst mips64,mips,$(subst mips64el,mips,$(subst 
> > sh2,sh,$(subst sh3,sh,$(subst sh4,sh,$(subst aarch64,arm64,$(subst 
> > aarch64_be,arm64,$(ARCH))))))))))))
> > -  endif
> > +  LINUX_KARCH := $(ARCH)
> >  endif
> 
> 
> How about something in the middle, like
> 
> ifneq (,$(findstring uml,$(BOARD)))
>   LINUX_KARCH := um
> else ifneq (,$(findstring $(ARCH),aarch64 aarch64_be))
>   LINUX_KARCH := arm64
> else ifneq (,$(findstring $(ARCH),armeb))
>   LINUX_KARCH := arm
> else ifneq (,$(findstring $(ARCH),mipsel mips64 mips64el))
>   LINUX_KARCH := mips
> else ifneq (,$(findstring $(ARCH),sh2 sh3 sh4))
>   LINUX_KARCH := sh
> else ifneq (,$(findstring $(ARCH),i386))
>   LINUX_KARCH := x86
> else
>   LINUX_KARCH := $(ARCH)
> endif
> 
> merging the common cases. this is a bit more compact, and should be
> easier to extend. (NOTE: completely untested, likely contains
> typos/thinkos).

Yep, it definitely looks better. I'll come up with something similar
(or identical if it works right away) and post a new version.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Attachment: signature.asc
Description: Digital signature

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to