blob: 78d90a249e8863c95e2b281d0707a7719bc30c4c [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/ \
Zhigang Lu620830b2014-02-11 11:03:48 +08007 -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
8 -e s/tile.*/tile/ )
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
37# Additional ARCH settings for tile
38ifeq ($(ARCH),tilepro)
39 SRCARCH := tile
40endif
41ifeq ($(ARCH),tilegx)
42 SRCARCH := tile
43endif
44
Namhyung Kimc6e5e9f2015-01-12 10:20:55 +080045LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
46ifeq ($(LP64), 1)
Adrian Huntere477f3f2014-10-23 18:16:03 -030047 IS_64_BIT := 1
Adrian Huntere477f3f2014-10-23 18:16:03 -030048else
Namhyung Kimc6e5e9f2015-01-12 10:20:55 +080049 IS_64_BIT := 0
Adrian Huntere477f3f2014-10-23 18:16:03 -030050endif