Makefile.arch 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # SPDX-License-Identifier: GPL-2.0
  2. HOSTARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
  3. -e s/sun4u/sparc/ -e s/sparc64/sparc/ \
  4. -e /arm64/!s/arm.*/arm/ -e s/sa110/arm/ \
  5. -e s/s390x/s390/ -e s/parisc64/parisc/ \
  6. -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
  7. -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ \
  8. -e s/riscv.*/riscv/ -e s/loongarch.*/loongarch/)
  9. ifeq ($(strip $(ARCH)),)
  10. override ARCH := $(HOSTARCH)
  11. endif
  12. SRCARCH := $(ARCH)
  13. # Additional ARCH settings for x86
  14. ifeq ($(ARCH),i386)
  15. SRCARCH := x86
  16. endif
  17. ifeq ($(ARCH),x86_64)
  18. SRCARCH := x86
  19. endif
  20. # Additional ARCH settings for sparc
  21. ifeq ($(ARCH),sparc32)
  22. SRCARCH := sparc
  23. endif
  24. ifeq ($(ARCH),sparc64)
  25. SRCARCH := sparc
  26. endif
  27. # Additional ARCH settings for loongarch
  28. ifeq ($(ARCH),loongarch32)
  29. SRCARCH := loongarch
  30. endif
  31. ifeq ($(ARCH),loongarch64)
  32. SRCARCH := loongarch
  33. endif
  34. LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
  35. ifeq ($(LP64), 1)
  36. IS_64_BIT := 1
  37. else
  38. IS_64_BIT := 0
  39. endif