blob: 0c6c7f45688784b59cd7e85032c8d1d9a3a12925 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
Arnaldo Carvalho de Melo0a943cb2016-07-22 09:55:53 -03002HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
Namhyung Kimb11db652015-03-02 13:31:03 +09003 -e s/sun4u/sparc/ -e s/sparc64/sparc/ \
Wang Nan235504d2015-03-17 13:29:47 +00004 -e /arm64/!s/arm.*/arm/ -e s/sa110/arm/ \
Jiri Olsaa6cf5f32014-01-03 15:32:32 +01005 -e s/s390x/s390/ -e s/parisc64/parisc/ \
6 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
Björn Töpelb390d692021-10-28 18:10:55 +02007 -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
8 -e s/riscv.*/riscv/)
Josh Poimboeuf60cbdf52016-07-22 14:19:20 -05009
Arnaldo Carvalho de Melo0a943cb2016-07-22 09:55:53 -030010ifndef ARCH
11ARCH := $(HOSTARCH)
12endif
Jiri Olsaa6cf5f32014-01-03 15:32:32 +010013
Josh Poimboeuf60cbdf52016-07-22 14:19:20 -050014SRCARCH := $(ARCH)
15
16# Additional ARCH settings for x86
17ifeq ($(ARCH),i386)
18 SRCARCH := x86
19endif
20ifeq ($(ARCH),x86_64)
21 SRCARCH := x86
22endif
23
24# Additional ARCH settings for sparc
25ifeq ($(ARCH),sparc32)
26 SRCARCH := sparc
27endif
28ifeq ($(ARCH),sparc64)
29 SRCARCH := sparc
30endif
31
32# Additional ARCH settings for sh
33ifeq ($(ARCH),sh64)
34 SRCARCH := sh
35endif
36
Namhyung Kimc6e5e9f2015-01-12 10:20:55 +080037LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
38ifeq ($(LP64), 1)
Adrian Huntere477f3f2014-10-23 18:16:03 -030039 IS_64_BIT := 1
Adrian Huntere477f3f2014-10-23 18:16:03 -030040else
Namhyung Kimc6e5e9f2015-01-12 10:20:55 +080041 IS_64_BIT := 0
Adrian Huntere477f3f2014-10-23 18:16:03 -030042endif