blob: b10b7a27c33fd16b10fa3d7fcfd7a5fa372f2d59 [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/ \
Arnd Bergmannbb9d8122018-03-09 14:13:42 +01007 -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ )
Josh Poimboeuf60cbdf52016-07-22 14:19:20 -05008
Arnaldo Carvalho de Melo0a943cb2016-07-22 09:55:53 -03009ifndef ARCH
10ARCH := $(HOSTARCH)
11endif
Jiri Olsaa6cf5f32014-01-03 15:32:32 +010012
Josh Poimboeuf60cbdf52016-07-22 14:19:20 -050013SRCARCH := $(ARCH)
14
15# Additional ARCH settings for x86
16ifeq ($(ARCH),i386)
17 SRCARCH := x86
18endif
19ifeq ($(ARCH),x86_64)
20 SRCARCH := x86
21endif
22
23# Additional ARCH settings for sparc
24ifeq ($(ARCH),sparc32)
25 SRCARCH := sparc
26endif
27ifeq ($(ARCH),sparc64)
28 SRCARCH := sparc
29endif
30
31# Additional ARCH settings for sh
32ifeq ($(ARCH),sh64)
33 SRCARCH := sh
34endif
35
Namhyung Kimc6e5e9f2015-01-12 10:20:55 +080036LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
37ifeq ($(LP64), 1)
Adrian Huntere477f3f2014-10-23 18:16:03 -030038 IS_64_BIT := 1
Adrian Huntere477f3f2014-10-23 18:16:03 -030039else
Namhyung Kimc6e5e9f2015-01-12 10:20:55 +080040 IS_64_BIT := 0
Adrian Huntere477f3f2014-10-23 18:16:03 -030041endif