xref: /openbmc/linux/arch/xtensa/Makefile (revision 0d456bad)
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.
78e1a6dd2SChris Zankel#
88e1a6dd2SChris Zankel# This file is included by the global makefile so that you can add your own
98e1a6dd2SChris Zankel# architecture-specific flags and dependencies. Remember to do have actions
108e1a6dd2SChris Zankel# for "archclean" and "archdep" for cleaning up and making dependencies for
118e1a6dd2SChris Zankel# this architecture
128e1a6dd2SChris Zankel
138e1a6dd2SChris Zankel# Core configuration.
14173d6681SChris Zankel# (Use VAR=<xtensa_config> to use another default compiler.)
158e1a6dd2SChris Zankel
16173d6681SChris Zankelvariant-$(CONFIG_XTENSA_VARIANT_FSF)		:= fsf
170025427eSChris Zankelvariant-$(CONFIG_XTENSA_VARIANT_DC232B)		:= dc232b
18000af2c5SJohannes Weinervariant-$(CONFIG_XTENSA_VARIANT_S6000)		:= s6000
19173d6681SChris Zankelvariant-$(CONFIG_XTENSA_VARIANT_LINUX_CUSTOM)	:= custom
208e1a6dd2SChris Zankel
21173d6681SChris ZankelVARIANT = $(variant-y)
22173d6681SChris Zankelexport VARIANT
238e1a6dd2SChris Zankel
2470cefe76SGeert Uytterhoeven# Test for cross compiling
2570cefe76SGeert Uytterhoeven
2670cefe76SGeert Uytterhoevenifneq ($(VARIANT),)
2770cefe76SGeert Uytterhoeven  COMPILE_ARCH = $(shell uname -m)
2870cefe76SGeert Uytterhoeven
2970cefe76SGeert Uytterhoeven  ifneq ($(COMPILE_ARCH), xtensa)
3070cefe76SGeert Uytterhoeven    ifndef CROSS_COMPILE
3170cefe76SGeert Uytterhoeven      CROSS_COMPILE = xtensa_$(VARIANT)-
3270cefe76SGeert Uytterhoeven    endif
3370cefe76SGeert Uytterhoeven  endif
3470cefe76SGeert Uytterhoevenendif
3570cefe76SGeert Uytterhoeven
368e1a6dd2SChris Zankel# Platform configuration
378e1a6dd2SChris Zankel
388e1a6dd2SChris Zankelplatform-$(CONFIG_XTENSA_PLATFORM_XT2000)	:= xt2000
398e1a6dd2SChris Zankelplatform-$(CONFIG_XTENSA_PLATFORM_ISS)		:= iss
40f82e939fSJohannes Weinerplatform-$(CONFIG_XTENSA_PLATFORM_S6105)	:= s6105
410d456badSMax Filippovplatform-$(CONFIG_XTENSA_PLATFORM_XTFPGA)	:= xtfpga
428e1a6dd2SChris Zankel
438e1a6dd2SChris ZankelPLATFORM = $(platform-y)
448e1a6dd2SChris Zankelexport PLATFORM
458e1a6dd2SChris Zankel
46b2444d34SChris Zankel# temporarily until string.h is fixed
47a753cd9aSMax FilippovKBUILD_CFLAGS += -ffreestanding -D__linux__
48b2444d34SChris Zankel
49a0f97e06SSam RavnborgKBUILD_CFLAGS += -pipe -mlongcalls
508e1a6dd2SChris Zankel
51cf1c0aafSChris ZankelKBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
52cf1c0aafSChris Zankel
5365501622SChris Zankelifneq ($(CONFIG_LD_NO_RELAX),)
5465501622SChris ZankelLDFLAGS := --no-relax
5565501622SChris Zankelendif
5665501622SChris Zankel
57367b8112SChris Zankelvardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
58367b8112SChris Zankelplfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
59367b8112SChris Zankel
60367b8112SChris Zankelifeq ($(KBUILD_SRC),)
61367b8112SChris ZankelKBUILD_CPPFLAGS += $(patsubst %,-I%include,$(vardirs) $(plfdirs))
62367b8112SChris Zankelelse
63367b8112SChris ZankelKBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs))
64367b8112SChris Zankelendif
65367b8112SChris Zankel
66e7d163f7SChris ZankelKBUILD_DEFCONFIG := iss_defconfig
678e1a6dd2SChris Zankel
68f1933189SChris Zankel# Only build variant and/or platform if it includes a Makefile
69f1933189SChris Zankel
700eff08b5SGeert Uytterhoevenbuildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/)
710eff08b5SGeert Uytterhoevenbuildplf := $(shell test -e $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/)
72f1933189SChris Zankel
73f1933189SChris Zankel# Find libgcc.a
748e1a6dd2SChris Zankel
75a0f97e06SSam RavnborgLIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
768e1a6dd2SChris Zankel
778e1a6dd2SChris Zankelhead-y		:= arch/xtensa/kernel/head.o
78e7d163f7SChris Zankelcore-y		+= arch/xtensa/kernel/ arch/xtensa/mm/
79f1933189SChris Zankelcore-y		+= $(buildvar) $(buildplf)
80f1933189SChris Zankel
818e1a6dd2SChris Zankellibs-y		+= arch/xtensa/lib/ $(LIBGCC)
828e1a6dd2SChris Zankel
83da844a81SMax Filippovifneq ($(CONFIG_BUILTIN_DTB),"")
84da844a81SMax Filippovcore-y += arch/xtensa/boot/
85da844a81SMax Filippovendif
86da844a81SMax Filippov
878e1a6dd2SChris Zankelboot		:= arch/xtensa/boot
888e1a6dd2SChris Zankel
898e1a6dd2SChris Zankelall: zImage
908e1a6dd2SChris Zankel
918e1a6dd2SChris ZankelbzImage : zImage
928e1a6dd2SChris Zankel
939ad79b58SMax FilippovzImage: vmlinux
948e1a6dd2SChris Zankel	$(Q)$(MAKE) $(build)=$(boot) $@
958e1a6dd2SChris Zankel
96da844a81SMax Filippov%.dtb:
97da844a81SMax Filippov	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
98da844a81SMax Filippov
998e1a6dd2SChris Zankeldefine archhelp
1008e1a6dd2SChris Zankel  @echo '* zImage      - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
1018e1a6dd2SChris Zankelendef
1028e1a6dd2SChris Zankel
103