Jiri Olsa | a6cf5f3 | 2014-01-03 15:32:32 +0100 | [diff] [blame] | 1 | |
| 2 | uname_M := $(shell uname -m 2>/dev/null || echo not) |
| 3 | |
Namhyung Kim | c6e5e9f | 2015-01-12 10:20:55 +0800 | [diff] [blame] | 4 | RAW_ARCH := $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ |
Jiri Olsa | a6cf5f3 | 2014-01-03 15:32:32 +0100 | [diff] [blame] | 5 | -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 Lu | 620830b | 2014-02-11 11:03:48 +0800 | [diff] [blame] | 8 | -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \ |
| 9 | -e s/tile.*/tile/ ) |
Jiri Olsa | a6cf5f3 | 2014-01-03 15:32:32 +0100 | [diff] [blame] | 10 | |
| 11 | # Additional ARCH settings for x86 |
Namhyung Kim | c6e5e9f | 2015-01-12 10:20:55 +0800 | [diff] [blame] | 12 | ifeq ($(RAW_ARCH),i386) |
| 13 | ARCH ?= x86 |
Jiri Olsa | a6cf5f3 | 2014-01-03 15:32:32 +0100 | [diff] [blame] | 14 | endif |
| 15 | |
Namhyung Kim | c6e5e9f | 2015-01-12 10:20:55 +0800 | [diff] [blame] | 16 | ifeq ($(RAW_ARCH),x86_64) |
| 17 | ARCH ?= x86 |
| 18 | |
| 19 | ifneq (, $(findstring m32,$(CFLAGS))) |
| 20 | RAW_ARCH := x86_32 |
Jiri Olsa | a6cf5f3 | 2014-01-03 15:32:32 +0100 | [diff] [blame] | 21 | endif |
| 22 | endif |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 23 | |
David Ahern | 4861f87 | 2015-02-18 19:37:02 -0500 | [diff] [blame^] | 24 | ifeq ($(RAW_ARCH),sparc64) |
| 25 | ARCH ?= sparc |
| 26 | endif |
| 27 | |
Namhyung Kim | c6e5e9f | 2015-01-12 10:20:55 +0800 | [diff] [blame] | 28 | ARCH ?= $(RAW_ARCH) |
| 29 | |
| 30 | LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1) |
| 31 | ifeq ($(LP64), 1) |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 32 | IS_64_BIT := 1 |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 33 | else |
Namhyung Kim | c6e5e9f | 2015-01-12 10:20:55 +0800 | [diff] [blame] | 34 | IS_64_BIT := 0 |
Adrian Hunter | e477f3f | 2014-10-23 18:16:03 -0300 | [diff] [blame] | 35 | endif |