xref: /openbmc/linux/arch/xtensa/Makefile (revision cf1c0aaf)
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
248e1a6dd2SChris Zankel# Platform configuration
258e1a6dd2SChris Zankel
268e1a6dd2SChris Zankelplatform-$(CONFIG_XTENSA_PLATFORM_XT2000)	:= xt2000
278e1a6dd2SChris Zankelplatform-$(CONFIG_XTENSA_PLATFORM_ISS)		:= iss
28f82e939fSJohannes Weinerplatform-$(CONFIG_XTENSA_PLATFORM_S6105)	:= s6105
298e1a6dd2SChris Zankel
308e1a6dd2SChris ZankelPLATFORM = $(platform-y)
318e1a6dd2SChris Zankelexport PLATFORM
328e1a6dd2SChris Zankel
33b2444d34SChris Zankel# temporarily until string.h is fixed
34a0f97e06SSam RavnborgKBUILD_CFLAGS += -ffreestanding
35b2444d34SChris Zankel
36a0f97e06SSam RavnborgKBUILD_CFLAGS += -pipe -mlongcalls
378e1a6dd2SChris Zankel
38cf1c0aafSChris ZankelKBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
39cf1c0aafSChris Zankel
40367b8112SChris Zankelvardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
41367b8112SChris Zankelplfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
42367b8112SChris Zankel
43367b8112SChris Zankelifeq ($(KBUILD_SRC),)
44367b8112SChris ZankelKBUILD_CPPFLAGS += $(patsubst %,-I%include,$(vardirs) $(plfdirs))
45367b8112SChris Zankelelse
46367b8112SChris ZankelKBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs))
47367b8112SChris Zankelendif
48367b8112SChris Zankel
49e7d163f7SChris ZankelKBUILD_DEFCONFIG := iss_defconfig
508e1a6dd2SChris Zankel
518e1a6dd2SChris Zankel# ramdisk/initrd support
528e1a6dd2SChris Zankel# You need a compressed ramdisk image, named ramdisk.gz in
538e1a6dd2SChris Zankel# arch/xtensa/boot/ramdisk
548e1a6dd2SChris Zankel
558e1a6dd2SChris Zankelcore-$(CONFIG_EMBEDDED_RAMDISK)	+= arch/xtensa/boot/ramdisk/
568e1a6dd2SChris Zankel
578e1a6dd2SChris Zankel# Test for cross compiling
588e1a6dd2SChris Zankel
59173d6681SChris Zankelifneq ($(VARIANT),)
608e1a6dd2SChris Zankel  COMPILE_ARCH = $(shell uname -m)
618e1a6dd2SChris Zankel
628e1a6dd2SChris Zankel  ifneq ($(COMPILE_ARCH), xtensa)
638e1a6dd2SChris Zankel    ifndef CROSS_COMPILE
64173d6681SChris Zankel      CROSS_COMPILE = xtensa_$(VARIANT)-
658e1a6dd2SChris Zankel    endif
668e1a6dd2SChris Zankel  endif
678e1a6dd2SChris Zankelendif
688e1a6dd2SChris Zankel
69f1933189SChris Zankel# Only build variant and/or platform if it includes a Makefile
70f1933189SChris Zankel
71f1933189SChris Zankelbuildvar := $(shell test -a $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/)
72f1933189SChris Zankelbuildplf := $(shell test -a $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/)
73f1933189SChris Zankel
74f1933189SChris Zankel# Find libgcc.a
758e1a6dd2SChris Zankel
76a0f97e06SSam RavnborgLIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
778e1a6dd2SChris Zankel
788e1a6dd2SChris Zankelhead-y		:= arch/xtensa/kernel/head.o
79e7d163f7SChris Zankelcore-y		+= arch/xtensa/kernel/ arch/xtensa/mm/
80f1933189SChris Zankelcore-y		+= $(buildvar) $(buildplf)
81f1933189SChris Zankel
828e1a6dd2SChris Zankellibs-y		+= arch/xtensa/lib/ $(LIBGCC)
838e1a6dd2SChris Zankel
848e1a6dd2SChris Zankelboot		:= arch/xtensa/boot
858e1a6dd2SChris Zankel
868e1a6dd2SChris Zankelall: zImage
878e1a6dd2SChris Zankel
888e1a6dd2SChris ZankelbzImage : zImage
898e1a6dd2SChris Zankel
908e1a6dd2SChris ZankelzImage zImage.initrd: vmlinux
918e1a6dd2SChris Zankel	$(Q)$(MAKE) $(build)=$(boot) $@
928e1a6dd2SChris Zankel
938e1a6dd2SChris Zankeldefine archhelp
948e1a6dd2SChris Zankel  @echo '* zImage      - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
958e1a6dd2SChris Zankelendef
968e1a6dd2SChris Zankel
97