blob: 81250ece3062ae914628d8b49f777ac7de580263 [file] [log] [blame]
Chris Zankel8e1a6dd2005-06-23 22:01:10 -07001#
2# This file is subject to the terms and conditions of the GNU General Public
3# License. See the file "COPYING" in the main directory of this archive
4# for more details.
5#
6# Copyright (C) 2001 - 2005 Tensilica Inc.
7#
8# This file is included by the global makefile so that you can add your own
9# architecture-specific flags and dependencies. Remember to do have actions
10# for "archclean" and "archdep" for cleaning up and making dependencies for
11# this architecture
12
13# Core configuration.
Chris Zankel173d66812006-12-10 02:18:48 -080014# (Use VAR=<xtensa_config> to use another default compiler.)
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070015
Chris Zankel173d66812006-12-10 02:18:48 -080016variant-$(CONFIG_XTENSA_VARIANT_FSF) := fsf
Chris Zankel00254272008-10-21 09:11:43 -070017variant-$(CONFIG_XTENSA_VARIANT_DC232B) := dc232b
Pete Delaneyd0b73b42013-01-05 04:57:16 +040018variant-$(CONFIG_XTENSA_VARIANT_DC233C) := dc233c
Johannes Weiner000af2c2009-03-04 16:21:32 +010019variant-$(CONFIG_XTENSA_VARIANT_S6000) := s6000
Chris Zankel173d66812006-12-10 02:18:48 -080020variant-$(CONFIG_XTENSA_VARIANT_LINUX_CUSTOM) := custom
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070021
Chris Zankel173d66812006-12-10 02:18:48 -080022VARIANT = $(variant-y)
23export VARIANT
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070024
Geert Uytterhoeven70cefe72012-05-12 22:39:08 +020025# Test for cross compiling
26
27ifneq ($(VARIANT),)
28 COMPILE_ARCH = $(shell uname -m)
29
30 ifneq ($(COMPILE_ARCH), xtensa)
31 ifndef CROSS_COMPILE
32 CROSS_COMPILE = xtensa_$(VARIANT)-
33 endif
34 endif
35endif
36
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070037# Platform configuration
38
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070039platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000
40platform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss
Johannes Weinerf82e9392009-03-04 16:21:33 +010041platform-$(CONFIG_XTENSA_PLATFORM_S6105) := s6105
Max Filippov0d456ba2012-11-05 07:37:14 +040042platform-$(CONFIG_XTENSA_PLATFORM_XTFPGA) := xtfpga
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070043
44PLATFORM = $(platform-y)
45export PLATFORM
46
Chris Zankelb2444d32007-08-04 09:23:54 -070047# temporarily until string.h is fixed
Max Filippova753cd92012-09-17 05:44:51 +040048KBUILD_CFLAGS += -ffreestanding -D__linux__
Chris Zankelb2444d32007-08-04 09:23:54 -070049
Sam Ravnborga0f97e02007-10-14 22:21:35 +020050KBUILD_CFLAGS += -pipe -mlongcalls
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070051
Chris Zankelcf1c0aa2010-05-02 01:00:22 -070052KBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
53
Chris Zankel65501622012-11-13 15:16:36 -080054ifneq ($(CONFIG_LD_NO_RELAX),)
55LDFLAGS := --no-relax
56endif
57
Max Filippov123f15e2013-08-22 18:09:47 +040058ifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)
Max Filippov72100ed2012-12-11 01:26:25 +040059CHECKFLAGS += -D__XTENSA_EB__
60endif
Max Filippov123f15e2013-08-22 18:09:47 +040061ifeq ($(shell echo __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1)
Max Filippov72100ed2012-12-11 01:26:25 +040062CHECKFLAGS += -D__XTENSA_EL__
63endif
64
Chris Zankel367b8112008-11-06 06:40:46 -080065vardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
66plfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
67
68ifeq ($(KBUILD_SRC),)
69KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(vardirs) $(plfdirs))
70else
71KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs))
72endif
73
Chris Zankele7d163f2005-06-30 02:58:59 -070074KBUILD_DEFCONFIG := iss_defconfig
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070075
Chris Zankelf1933182009-04-02 16:58:53 -070076# Only build variant and/or platform if it includes a Makefile
77
Geert Uytterhoeven0eff08b2012-06-20 12:52:59 -070078buildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/)
79buildplf := $(shell test -e $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/)
Chris Zankelf1933182009-04-02 16:58:53 -070080
81# Find libgcc.a
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070082
Sam Ravnborga0f97e02007-10-14 22:21:35 +020083LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070084
85head-y := arch/xtensa/kernel/head.o
Chris Zankele7d163f2005-06-30 02:58:59 -070086core-y += arch/xtensa/kernel/ arch/xtensa/mm/
Chris Zankelf1933182009-04-02 16:58:53 -070087core-y += $(buildvar) $(buildplf)
88
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070089libs-y += arch/xtensa/lib/ $(LIBGCC)
danne6ffe172008-05-21 17:43:50 -070090drivers-$(CONFIG_OPROFILE) += arch/xtensa/oprofile/
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070091
Max Filippovda844a82012-11-04 00:30:13 +040092ifneq ($(CONFIG_BUILTIN_DTB),"")
Stephen Warren2a02bc12013-01-02 11:27:14 -070093core-$(CONFIG_OF) += arch/xtensa/boot/dts/
Max Filippovda844a82012-11-04 00:30:13 +040094endif
95
Chris Zankele7d163f2005-06-30 02:58:59 -070096boot := arch/xtensa/boot
97
Chris Zankel8e1a6dd2005-06-23 22:01:10 -070098all: zImage
99
100bzImage : zImage
101
Max Filippov9ad79b52012-09-17 05:44:50 +0400102zImage: vmlinux
Chris Zankel8e1a6dd2005-06-23 22:01:10 -0700103 $(Q)$(MAKE) $(build)=$(boot) $@
104
Max Filippovda844a82012-11-04 00:30:13 +0400105%.dtb:
Stephen Warren2a02bc12013-01-02 11:27:14 -0700106 $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
Max Filippovda844a82012-11-04 00:30:13 +0400107
Chris Zankel8e1a6dd2005-06-23 22:01:10 -0700108define archhelp
109 @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
110endef