From 5faef372d42ded1daa3d22a0f54d2c4ca9196792 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 14 May 2016 05:23:25 +0000 Subject: [PATCH] litecross: automatically determine LINUX_ARCH for kernel headers --- litecross/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/litecross/Makefile b/litecross/Makefile index 316a8ed..485eae1 100644 --- a/litecross/Makefile +++ b/litecross/Makefile @@ -157,6 +157,10 @@ install-toolchain: | obj_toolchain/.lc_built ln -sf $(TARGET)-gcc $(DESTDIR)$(OUTPUT)/bin/$(TARGET)-cc ifneq ($(LINUX_SRCDIR),) +TARGET_ARCH = $(firstword $(subst -, ,$(TARGET))) +TARGET_ARCH_MANGLED = $(patsubst i%86,x86,$(patsubst aarch64%,arm64%,$(TARGET_ARCH))) +LINUX_ARCH_LIST = $(sort $(notdir $(wildcard $(LINUX_SRCDIR)/arch/*))) +LINUX_ARCH = $(firstword $(foreach a,$(LINUX_ARCH_LIST),$(findstring $(a),$(TARGET_ARCH_MANGLED)))) ifneq ($(LINUX_ARCH),) all: kernel-headers install: install-kernel-headers