xref: /openbmc/linux/arch/xtensa/Makefile (revision 8212f898)
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
10*8212f898SMasahiro Yamada# architecture-specific flags and dependencies.
118e1a6dd2SChris Zankel
128e1a6dd2SChris Zankel# Core configuration.
13173d6681SChris Zankel# (Use VAR=<xtensa_config> to use another default compiler.)
148e1a6dd2SChris Zankel
15420ae951SMax Filippovvariant-y := $(patsubst "%",%,$(CONFIG_XTENSA_VARIANT_NAME))
168e1a6dd2SChris Zankel
17173d6681SChris ZankelVARIANT = $(variant-y)
188e1a6dd2SChris Zankel
1970cefe76SGeert Uytterhoevenifneq ($(VARIANT),)
2023243c1aSMasahiro Yamada  ifdef cross_compiling
2170cefe76SGeert Uytterhoeven    ifndef CROSS_COMPILE
2270cefe76SGeert Uytterhoeven      CROSS_COMPILE = xtensa_$(VARIANT)-
2370cefe76SGeert Uytterhoeven    endif
2470cefe76SGeert Uytterhoeven  endif
2570cefe76SGeert Uytterhoevenendif
2670cefe76SGeert Uytterhoeven
278e1a6dd2SChris Zankel# Platform configuration
288e1a6dd2SChris Zankel
298e1a6dd2SChris Zankelplatform-$(CONFIG_XTENSA_PLATFORM_XT2000)	:= xt2000
308e1a6dd2SChris Zankelplatform-$(CONFIG_XTENSA_PLATFORM_ISS)		:= iss
310d456badSMax Filippovplatform-$(CONFIG_XTENSA_PLATFORM_XTFPGA)	:= xtfpga
328e1a6dd2SChris Zankel
33b2444d34SChris Zankel# temporarily until string.h is fixed
34a753cd9aSMax FilippovKBUILD_CFLAGS += -ffreestanding -D__linux__
35f8f02ca7SMax FilippovKBUILD_CFLAGS += -pipe -mlongcalls -mtext-section-literals
36cf1c0aafSChris ZankelKBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
377bf5234dSMax FilippovKBUILD_CFLAGS += $(call cc-option,-mno-serialize-volatile,)
38cf1c0aafSChris Zankel
39f8f02ca7SMax FilippovKBUILD_AFLAGS += -mlongcalls -mtext-section-literals
40f8f02ca7SMax Filippov
4165501622SChris Zankelifneq ($(CONFIG_LD_NO_RELAX),)
42d503ac53SMasahiro YamadaKBUILD_LDFLAGS := --no-relax
4365501622SChris Zankelendif
4465501622SChris Zankel
45c425c546SMasahiro YamadaCHECKFLAGS += -D$(if $(CONFIG_CPU_BIG_ENDIAN),__XTENSA_EB__,__XTENSA_EL__)
4672100ed7SMax Filippov
47367b8112SChris Zankelvardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
48367b8112SChris Zankelplfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
49367b8112SChris Zankel
50367b8112SChris ZankelKBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs))
51367b8112SChris Zankel
52e7d163f7SChris ZankelKBUILD_DEFCONFIG := iss_defconfig
538e1a6dd2SChris Zankel
54f1933189SChris Zankel# Find libgcc.a
558e1a6dd2SChris Zankel
56a0f97e06SSam RavnborgLIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
578e1a6dd2SChris Zankel
588e1a6dd2SChris Zankelhead-y		:= arch/xtensa/kernel/head.o
59f1933189SChris Zankel
608e1a6dd2SChris Zankellibs-y		+= arch/xtensa/lib/ $(LIBGCC)
618e1a6dd2SChris Zankel
628e1a6dd2SChris Zankelboot		:= arch/xtensa/boot
638e1a6dd2SChris Zankel
647af710d9SMax Filippovall Image zImage uImage xipImage: vmlinux
658e1a6dd2SChris Zankel	$(Q)$(MAKE) $(build)=$(boot) $@
668e1a6dd2SChris Zankel
675eacadb5SFiroz Khanarchheaders:
685eacadb5SFiroz Khan	$(Q)$(MAKE) $(build)=arch/xtensa/kernel/syscalls all
695eacadb5SFiroz Khan
708e1a6dd2SChris Zankeldefine archhelp
719a736fcbSMax Filippov  @echo '* Image       - Kernel ELF image with reset vector'
728e1a6dd2SChris Zankel  @echo '* zImage      - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
739a736fcbSMax Filippov  @echo '* uImage      - U-Boot wrapped image'
747af710d9SMax Filippov  @echo '  xipImage    - XIP image'
758e1a6dd2SChris Zankelendef
76