^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) # This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) # License. See the file "COPYING" in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) # for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) # Copyright (C) 2001 - 2005 Tensilica Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) # Copyright (C) 2014 Cadence Design Systems Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) # This file is included by the global makefile so that you can add your own
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) # architecture-specific flags and dependencies. Remember to do have actions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) # for "archclean" and "archdep" for cleaning up and making dependencies for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) # this architecture
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) # Core configuration.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) # (Use VAR=<xtensa_config> to use another default compiler.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) variant-y := $(patsubst "%",%,$(CONFIG_XTENSA_VARIANT_NAME))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) VARIANT = $(variant-y)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) export VARIANT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) # Test for cross compiling
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) ifneq ($(VARIANT),)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) COMPILE_ARCH = $(shell uname -m)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) ifneq ($(COMPILE_ARCH), xtensa)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) ifndef CROSS_COMPILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) CROSS_COMPILE = xtensa_$(VARIANT)-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) # Platform configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) platform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) platform-$(CONFIG_XTENSA_PLATFORM_XTFPGA) := xtfpga
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) PLATFORM = $(platform-y)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) export PLATFORM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) # temporarily until string.h is fixed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) KBUILD_CFLAGS += -ffreestanding -D__linux__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) KBUILD_CFLAGS += -pipe -mlongcalls -mtext-section-literals
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) KBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) KBUILD_CFLAGS += $(call cc-option,-mno-serialize-volatile,)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) KBUILD_AFLAGS += -mlongcalls -mtext-section-literals
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) ifneq ($(CONFIG_LD_NO_RELAX),)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) KBUILD_LDFLAGS := --no-relax
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) ifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) CHECKFLAGS += -D__XTENSA_EB__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) KBUILD_CPPFLAGS += -DCONFIG_CPU_BIG_ENDIAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) ifeq ($(shell echo __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) CHECKFLAGS += -D__XTENSA_EL__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) KBUILD_CPPFLAGS += -DCONFIG_CPU_LITTLE_ENDIAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) vardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) plfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) KBUILD_DEFCONFIG := iss_defconfig
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) # Only build variant and/or platform if it includes a Makefile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) buildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) buildplf := $(shell test -e $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) # Find libgcc.a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) head-y := arch/xtensa/kernel/head.o
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) core-y += arch/xtensa/kernel/ arch/xtensa/mm/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) core-y += $(buildvar) $(buildplf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) core-y += arch/xtensa/boot/dts/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) libs-y += arch/xtensa/lib/ $(LIBGCC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) drivers-$(CONFIG_OPROFILE) += arch/xtensa/oprofile/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) boot := arch/xtensa/boot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) all Image zImage uImage xipImage: vmlinux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) $(Q)$(MAKE) $(build)=$(boot) $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) archheaders:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) $(Q)$(MAKE) $(build)=arch/xtensa/kernel/syscalls all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) define archhelp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) @echo '* Image - Kernel ELF image with reset vector'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) @echo '* uImage - U-Boot wrapped image'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) @echo ' xipImage - XIP image'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) endef