18c2ecf20Sopenharmony_ci#
28c2ecf20Sopenharmony_ci# This file is subject to the terms and conditions of the GNU General Public
38c2ecf20Sopenharmony_ci# License.  See the file "COPYING" in the main directory of this archive
48c2ecf20Sopenharmony_ci# for more details.
58c2ecf20Sopenharmony_ci#
68c2ecf20Sopenharmony_ci# Copyright (C) 2001 - 2005  Tensilica Inc.
78c2ecf20Sopenharmony_ci# Copyright (C) 2014 Cadence Design Systems Inc.
88c2ecf20Sopenharmony_ci#
98c2ecf20Sopenharmony_ci# This file is included by the global makefile so that you can add your own
108c2ecf20Sopenharmony_ci# architecture-specific flags and dependencies. Remember to do have actions
118c2ecf20Sopenharmony_ci# for "archclean" and "archdep" for cleaning up and making dependencies for
128c2ecf20Sopenharmony_ci# this architecture
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci# Core configuration.
158c2ecf20Sopenharmony_ci# (Use VAR=<xtensa_config> to use another default compiler.)
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_civariant-y := $(patsubst "%",%,$(CONFIG_XTENSA_VARIANT_NAME))
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciVARIANT = $(variant-y)
208c2ecf20Sopenharmony_ciexport VARIANT
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci# Test for cross compiling
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ciifneq ($(VARIANT),)
258c2ecf20Sopenharmony_ci  COMPILE_ARCH = $(shell uname -m)
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci  ifneq ($(COMPILE_ARCH), xtensa)
288c2ecf20Sopenharmony_ci    ifndef CROSS_COMPILE
298c2ecf20Sopenharmony_ci      CROSS_COMPILE = xtensa_$(VARIANT)-
308c2ecf20Sopenharmony_ci    endif
318c2ecf20Sopenharmony_ci  endif
328c2ecf20Sopenharmony_ciendif
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci# Platform configuration
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciplatform-$(CONFIG_XTENSA_PLATFORM_XT2000)	:= xt2000
378c2ecf20Sopenharmony_ciplatform-$(CONFIG_XTENSA_PLATFORM_ISS)		:= iss
388c2ecf20Sopenharmony_ciplatform-$(CONFIG_XTENSA_PLATFORM_XTFPGA)	:= xtfpga
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ciPLATFORM = $(platform-y)
418c2ecf20Sopenharmony_ciexport PLATFORM
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci# temporarily until string.h is fixed
448c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -ffreestanding -D__linux__
458c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -pipe -mlongcalls -mtext-section-literals
468c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
478c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mno-serialize-volatile,)
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ciKBUILD_AFLAGS += -mlongcalls -mtext-section-literals
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ciifneq ($(CONFIG_LD_NO_RELAX),)
528c2ecf20Sopenharmony_ciKBUILD_LDFLAGS := --no-relax
538c2ecf20Sopenharmony_ciendif
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ciifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)
568c2ecf20Sopenharmony_ciCHECKFLAGS += -D__XTENSA_EB__
578c2ecf20Sopenharmony_ciKBUILD_CPPFLAGS += -DCONFIG_CPU_BIG_ENDIAN
588c2ecf20Sopenharmony_ciendif
598c2ecf20Sopenharmony_ciifeq ($(shell echo __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1)
608c2ecf20Sopenharmony_ciCHECKFLAGS += -D__XTENSA_EL__
618c2ecf20Sopenharmony_ciKBUILD_CPPFLAGS += -DCONFIG_CPU_LITTLE_ENDIAN
628c2ecf20Sopenharmony_ciendif
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_civardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
658c2ecf20Sopenharmony_ciplfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ciKBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs))
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ciKBUILD_DEFCONFIG := iss_defconfig
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci# Only build variant and/or platform if it includes a Makefile
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_cibuildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/)
748c2ecf20Sopenharmony_cibuildplf := $(shell test -e $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/)
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci# Find libgcc.a
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ciLIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_cihead-y		:= arch/xtensa/kernel/head.o
818c2ecf20Sopenharmony_cicore-y		+= arch/xtensa/kernel/ arch/xtensa/mm/
828c2ecf20Sopenharmony_cicore-y		+= $(buildvar) $(buildplf)
838c2ecf20Sopenharmony_cicore-y 		+= arch/xtensa/boot/dts/
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_cilibs-y		+= arch/xtensa/lib/ $(LIBGCC)
868c2ecf20Sopenharmony_cidrivers-$(CONFIG_OPROFILE)	+= arch/xtensa/oprofile/
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ciboot		:= arch/xtensa/boot
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ciall Image zImage uImage xipImage: vmlinux
918c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(build)=$(boot) $@
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ciarchheaders:
948c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(build)=arch/xtensa/kernel/syscalls all
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_cidefine archhelp
978c2ecf20Sopenharmony_ci  @echo '* Image       - Kernel ELF image with reset vector'
988c2ecf20Sopenharmony_ci  @echo '* zImage      - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
998c2ecf20Sopenharmony_ci  @echo '* uImage      - U-Boot wrapped image'
1008c2ecf20Sopenharmony_ci  @echo '  xipImage    - XIP image'
1018c2ecf20Sopenharmony_ciendef
102