18e1a6dd2SChris Zankel# 28e1a6dd2SChris Zankel# This file is subject to the terms and conditions of the GNU General Public 38e1a6dd2SChris Zankel# License. See the file "COPYING" in the main directory of this archive 48e1a6dd2SChris Zankel# for more details. 58e1a6dd2SChris Zankel# 68e1a6dd2SChris Zankel# Copyright (C) 2001 - 2005 Tensilica Inc. 7420ae951SMax Filippov# Copyright (C) 2014 Cadence Design Systems Inc. 88e1a6dd2SChris Zankel# 98e1a6dd2SChris Zankel# This file is included by the global makefile so that you can add your own 108e1a6dd2SChris Zankel# architecture-specific flags and dependencies. Remember to do have actions 118e1a6dd2SChris Zankel# for "archclean" and "archdep" for cleaning up and making dependencies for 128e1a6dd2SChris Zankel# this architecture 138e1a6dd2SChris Zankel 148e1a6dd2SChris Zankel# Core configuration. 15173d6681SChris Zankel# (Use VAR=<xtensa_config> to use another default compiler.) 168e1a6dd2SChris Zankel 17420ae951SMax Filippovvariant-y := $(patsubst "%",%,$(CONFIG_XTENSA_VARIANT_NAME)) 188e1a6dd2SChris Zankel 19173d6681SChris ZankelVARIANT = $(variant-y) 20173d6681SChris Zankelexport VARIANT 218e1a6dd2SChris Zankel 2270cefe76SGeert Uytterhoeven# Test for cross compiling 2370cefe76SGeert Uytterhoeven 2470cefe76SGeert Uytterhoevenifneq ($(VARIANT),) 2570cefe76SGeert Uytterhoeven COMPILE_ARCH = $(shell uname -m) 2670cefe76SGeert Uytterhoeven 2770cefe76SGeert Uytterhoeven ifneq ($(COMPILE_ARCH), xtensa) 2870cefe76SGeert Uytterhoeven ifndef CROSS_COMPILE 2970cefe76SGeert Uytterhoeven CROSS_COMPILE = xtensa_$(VARIANT)- 3070cefe76SGeert Uytterhoeven endif 3170cefe76SGeert Uytterhoeven endif 3270cefe76SGeert Uytterhoevenendif 3370cefe76SGeert Uytterhoeven 348e1a6dd2SChris Zankel# Platform configuration 358e1a6dd2SChris Zankel 368e1a6dd2SChris Zankelplatform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000 378e1a6dd2SChris Zankelplatform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss 380d456badSMax Filippovplatform-$(CONFIG_XTENSA_PLATFORM_XTFPGA) := xtfpga 398e1a6dd2SChris Zankel 408e1a6dd2SChris ZankelPLATFORM = $(platform-y) 418e1a6dd2SChris Zankelexport PLATFORM 428e1a6dd2SChris Zankel 43b2444d34SChris Zankel# temporarily until string.h is fixed 44a753cd9aSMax FilippovKBUILD_CFLAGS += -ffreestanding -D__linux__ 45f8f02ca7SMax FilippovKBUILD_CFLAGS += -pipe -mlongcalls -mtext-section-literals 46cf1c0aafSChris ZankelKBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,) 477bf5234dSMax FilippovKBUILD_CFLAGS += $(call cc-option,-mno-serialize-volatile,) 48cf1c0aafSChris Zankel 49f8f02ca7SMax FilippovKBUILD_AFLAGS += -mlongcalls -mtext-section-literals 50f8f02ca7SMax Filippov 5165501622SChris Zankelifneq ($(CONFIG_LD_NO_RELAX),) 52d503ac53SMasahiro YamadaKBUILD_LDFLAGS := --no-relax 5365501622SChris Zankelendif 5465501622SChris Zankel 55*c425c546SMasahiro YamadaCHECKFLAGS += -D$(if $(CONFIG_CPU_BIG_ENDIAN),__XTENSA_EB__,__XTENSA_EL__) 5672100ed7SMax Filippov 57367b8112SChris Zankelvardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y)) 58367b8112SChris Zankelplfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y)) 59367b8112SChris Zankel 60367b8112SChris ZankelKBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs)) 61367b8112SChris Zankel 62e7d163f7SChris ZankelKBUILD_DEFCONFIG := iss_defconfig 638e1a6dd2SChris Zankel 64f1933189SChris Zankel# Only build variant and/or platform if it includes a Makefile 65f1933189SChris Zankel 660eff08b5SGeert Uytterhoevenbuildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/) 670eff08b5SGeert Uytterhoevenbuildplf := $(shell test -e $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/) 68f1933189SChris Zankel 69f1933189SChris Zankel# Find libgcc.a 708e1a6dd2SChris Zankel 71a0f97e06SSam RavnborgLIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) 728e1a6dd2SChris Zankel 738e1a6dd2SChris Zankelhead-y := arch/xtensa/kernel/head.o 74e7d163f7SChris Zankelcore-y += arch/xtensa/kernel/ arch/xtensa/mm/ 75f1933189SChris Zankelcore-y += $(buildvar) $(buildplf) 7637c8a5faSRob Herringcore-y += arch/xtensa/boot/dts/ 77f1933189SChris Zankel 788e1a6dd2SChris Zankellibs-y += arch/xtensa/lib/ $(LIBGCC) 798e1a6dd2SChris Zankel 808e1a6dd2SChris Zankelboot := arch/xtensa/boot 818e1a6dd2SChris Zankel 827af710d9SMax Filippovall Image zImage uImage xipImage: vmlinux 838e1a6dd2SChris Zankel $(Q)$(MAKE) $(build)=$(boot) $@ 848e1a6dd2SChris Zankel 855eacadb5SFiroz Khanarchheaders: 865eacadb5SFiroz Khan $(Q)$(MAKE) $(build)=arch/xtensa/kernel/syscalls all 875eacadb5SFiroz Khan 888e1a6dd2SChris Zankeldefine archhelp 899a736fcbSMax Filippov @echo '* Image - Kernel ELF image with reset vector' 908e1a6dd2SChris Zankel @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)' 919a736fcbSMax Filippov @echo '* uImage - U-Boot wrapped image' 927af710d9SMax Filippov @echo ' xipImage - XIP image' 938e1a6dd2SChris Zankelendef 94