[OpenWrt-Devel] [PATCH v3 1/4] kernel.mk: Refactor LINUX_KARCH affectation
Jonas Gorski
jogo at openwrt.org
Fri Nov 28 16:19:28 EST 2014
On Fri, Nov 28, 2014 at 7:20 PM, Maxime Ripard
<maxime.ripard at free-electrons.com> 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 <maxime.ripard at free-electrons.com>
> ---
> 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).
>
> -
Unrelated whitespace change.
> define KernelPackage/Defaults
> FILES:=
> AUTOLOAD:=
Jonas
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list