xref: /openbmc/linux/tools/scripts/Makefile.arch (revision 644a9cf0)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
20a943cb1SArnaldo Carvalho de MeloHOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
3935e6bd3SWang Nan                                  -e s/sun4u/sparc/ -e s/sparc64/sparc/ \
4935e6bd3SWang Nan                                  -e /arm64/!s/arm.*/arm/ -e s/sa110/arm/ \
5935e6bd3SWang Nan                                  -e s/s390x/s390/ -e s/parisc64/parisc/ \
6935e6bd3SWang Nan                                  -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
7b390d698SBjörn Töpel                                  -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
8*121ff07bSHuacai Chen                                  -e s/riscv.*/riscv/ -e s/loongarch.*/loongarch/)
960cbdf5dSJosh Poimboeuf
100a943cb1SArnaldo Carvalho de Meloifndef ARCH
110a943cb1SArnaldo Carvalho de MeloARCH := $(HOSTARCH)
120a943cb1SArnaldo Carvalho de Meloendif
13935e6bd3SWang Nan
1460cbdf5dSJosh PoimboeufSRCARCH := $(ARCH)
1560cbdf5dSJosh Poimboeuf
1660cbdf5dSJosh Poimboeuf# Additional ARCH settings for x86
1760cbdf5dSJosh Poimboeufifeq ($(ARCH),i386)
1860cbdf5dSJosh Poimboeuf        SRCARCH := x86
1960cbdf5dSJosh Poimboeufendif
2060cbdf5dSJosh Poimboeufifeq ($(ARCH),x86_64)
2160cbdf5dSJosh Poimboeuf        SRCARCH := x86
2260cbdf5dSJosh Poimboeufendif
2360cbdf5dSJosh Poimboeuf
2460cbdf5dSJosh Poimboeuf# Additional ARCH settings for sparc
2560cbdf5dSJosh Poimboeufifeq ($(ARCH),sparc32)
2660cbdf5dSJosh Poimboeuf       SRCARCH := sparc
2760cbdf5dSJosh Poimboeufendif
2860cbdf5dSJosh Poimboeufifeq ($(ARCH),sparc64)
2960cbdf5dSJosh Poimboeuf       SRCARCH := sparc
3060cbdf5dSJosh Poimboeufendif
3160cbdf5dSJosh Poimboeuf
32*121ff07bSHuacai Chen# Additional ARCH settings for loongarch
33*121ff07bSHuacai Chenifeq ($(ARCH),loongarch32)
34*121ff07bSHuacai Chen       SRCARCH := loongarch
35*121ff07bSHuacai Chenendif
36*121ff07bSHuacai Chen
37*121ff07bSHuacai Chenifeq ($(ARCH),loongarch64)
38*121ff07bSHuacai Chen       SRCARCH := loongarch
39*121ff07bSHuacai Chenendif
40*121ff07bSHuacai Chen
41935e6bd3SWang NanLP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
42935e6bd3SWang Nanifeq ($(LP64), 1)
43935e6bd3SWang Nan  IS_64_BIT := 1
44935e6bd3SWang Nanelse
45935e6bd3SWang Nan  IS_64_BIT := 0
46935e6bd3SWang Nanendif
47