blob: ac8721ffa6c8c681ccdb563607d5b80917062438 [file] [log] [blame]
Jiri Olsaa6cf5f32014-01-03 15:32:32 +01001
2uname_M := $(shell uname -m 2>/dev/null || echo not)
3
Namhyung Kimc6e5e9f2015-01-12 10:20:55 +08004RAW_ARCH := $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
Jiri Olsaa6cf5f32014-01-03 15:32:32 +01005 -e s/arm.*/arm/ -e s/sa110/arm/ \
6 -e s/s390x/s390/ -e s/parisc64/parisc/ \
7 -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
Zhigang Lu620830b2014-02-11 11:03:48 +08008 -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
9 -e s/tile.*/tile/ )
Jiri Olsaa6cf5f32014-01-03 15:32:32 +010010
11# Additional ARCH settings for x86
Namhyung Kimc6e5e9f2015-01-12 10:20:55 +080012ifeq ($(RAW_ARCH),i386)
13 ARCH ?= x86
Jiri Olsaa6cf5f32014-01-03 15:32:32 +010014endif
15
Namhyung Kimc6e5e9f2015-01-12 10:20:55 +080016ifeq ($(RAW_ARCH),x86_64)
17 ARCH ?= x86
18
19 ifneq (, $(findstring m32,$(CFLAGS)))
20 RAW_ARCH := x86_32
Jiri Olsaa6cf5f32014-01-03 15:32:32 +010021 endif
22endif
Adrian Huntere477f3f2014-10-23 18:16:03 -030023
David Ahern4861f872015-02-18 19:37:02 -050024ifeq ($(RAW_ARCH),sparc64)
25 ARCH ?= sparc
26endif
27
Namhyung Kimc6e5e9f2015-01-12 10:20:55 +080028ARCH ?= $(RAW_ARCH)
29
30LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
31ifeq ($(LP64), 1)
Adrian Huntere477f3f2014-10-23 18:16:03 -030032 IS_64_BIT := 1
Adrian Huntere477f3f2014-10-23 18:16:03 -030033else
Namhyung Kimc6e5e9f2015-01-12 10:20:55 +080034 IS_64_BIT := 0
Adrian Huntere477f3f2014-10-23 18:16:03 -030035endif