Chris Zankel | 8e1a6dd | 2005-06-23 22:01:10 -0700 | [diff] [blame] | 1 | # |
| 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 Zankel | 173d668 | 2006-12-10 02:18:48 -0800 | [diff] [blame] | 14 | # (Use VAR=<xtensa_config> to use another default compiler.) |
Chris Zankel | 8e1a6dd | 2005-06-23 22:01:10 -0700 | [diff] [blame] | 15 | |
Chris Zankel | 173d668 | 2006-12-10 02:18:48 -0800 | [diff] [blame] | 16 | variant-$(CONFIG_XTENSA_VARIANT_FSF) := fsf |
Chris Zankel | 0025427 | 2008-10-21 09:11:43 -0700 | [diff] [blame] | 17 | variant-$(CONFIG_XTENSA_VARIANT_DC232B) := dc232b |
Johannes Weiner | 000af2c | 2009-03-04 16:21:32 +0100 | [diff] [blame] | 18 | variant-$(CONFIG_XTENSA_VARIANT_S6000) := s6000 |
Chris Zankel | 173d668 | 2006-12-10 02:18:48 -0800 | [diff] [blame] | 19 | variant-$(CONFIG_XTENSA_VARIANT_LINUX_CUSTOM) := custom |
Chris Zankel | 8e1a6dd | 2005-06-23 22:01:10 -0700 | [diff] [blame] | 20 | |
Chris Zankel | 173d668 | 2006-12-10 02:18:48 -0800 | [diff] [blame] | 21 | VARIANT = $(variant-y) |
| 22 | export VARIANT |
Chris Zankel | 8e1a6dd | 2005-06-23 22:01:10 -0700 | [diff] [blame] | 23 | |
Geert Uytterhoeven | 70cefe7 | 2012-05-12 22:39:08 +0200 | [diff] [blame] | 24 | # Test for cross compiling |
| 25 | |
| 26 | ifneq ($(VARIANT),) |
| 27 | COMPILE_ARCH = $(shell uname -m) |
| 28 | |
| 29 | ifneq ($(COMPILE_ARCH), xtensa) |
| 30 | ifndef CROSS_COMPILE |
| 31 | CROSS_COMPILE = xtensa_$(VARIANT)- |
| 32 | endif |
| 33 | endif |
| 34 | endif |
| 35 | |
Chris Zankel | 8e1a6dd | 2005-06-23 22:01:10 -0700 | [diff] [blame] | 36 | # Platform configuration |
| 37 | |
Chris Zankel | 8e1a6dd | 2005-06-23 22:01:10 -0700 | [diff] [blame] | 38 | platform-$(CONFIG_XTENSA_PLATFORM_XT2000) := xt2000 |
| 39 | platform-$(CONFIG_XTENSA_PLATFORM_ISS) := iss |
Johannes Weiner | f82e939 | 2009-03-04 16:21:33 +0100 | [diff] [blame] | 40 | platform-$(CONFIG_XTENSA_PLATFORM_S6105) := s6105 |
Max Filippov | 0d456ba | 2012-11-05 07:37:14 +0400 | [diff] [blame] | 41 | platform-$(CONFIG_XTENSA_PLATFORM_XTFPGA) := xtfpga |
Chris Zankel | 8e1a6dd | 2005-06-23 22:01:10 -0700 | [diff] [blame] | 42 | |
| 43 | PLATFORM = $(platform-y) |
| 44 | export PLATFORM |
| 45 | |
Chris Zankel | b2444d3 | 2007-08-04 09:23:54 -0700 | [diff] [blame] | 46 | # temporarily until string.h is fixed |
Max Filippov | a753cd9 | 2012-09-17 05:44:51 +0400 | [diff] [blame] | 47 | KBUILD_CFLAGS += -ffreestanding -D__linux__ |
Chris Zankel | b2444d3 | 2007-08-04 09:23:54 -0700 | [diff] [blame] | 48 | |
Sam Ravnborg | a0f97e0 | 2007-10-14 22:21:35 +0200 | [diff] [blame] | 49 | KBUILD_CFLAGS += -pipe -mlongcalls |
Chris Zankel | 8e1a6dd | 2005-06-23 22:01:10 -0700 | [diff] [blame] | 50 | |
Chris Zankel | cf1c0aa | 2010-05-02 01:00:22 -0700 | [diff] [blame] | 51 | KBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,) |
| 52 | |
Chris Zankel | 6550162 | 2012-11-13 15:16:36 -0800 | [diff] [blame] | 53 | ifneq ($(CONFIG_LD_NO_RELAX),) |
| 54 | LDFLAGS := --no-relax |
| 55 | endif |
| 56 | |
Max Filippov | 72100ed | 2012-12-11 01:26:25 +0400 | [diff] [blame^] | 57 | ifeq ($(shell echo -e __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1) |
| 58 | CHECKFLAGS += -D__XTENSA_EB__ |
| 59 | endif |
| 60 | ifeq ($(shell echo -e __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1) |
| 61 | CHECKFLAGS += -D__XTENSA_EL__ |
| 62 | endif |
| 63 | |
Chris Zankel | 367b811 | 2008-11-06 06:40:46 -0800 | [diff] [blame] | 64 | vardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y)) |
| 65 | plfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y)) |
| 66 | |
| 67 | ifeq ($(KBUILD_SRC),) |
| 68 | KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(vardirs) $(plfdirs)) |
| 69 | else |
| 70 | KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs)) |
| 71 | endif |
| 72 | |
Chris Zankel | e7d163f | 2005-06-30 02:58:59 -0700 | [diff] [blame] | 73 | KBUILD_DEFCONFIG := iss_defconfig |
Chris Zankel | 8e1a6dd | 2005-06-23 22:01:10 -0700 | [diff] [blame] | 74 | |
Chris Zankel | f193318 | 2009-04-02 16:58:53 -0700 | [diff] [blame] | 75 | # Only build variant and/or platform if it includes a Makefile |
| 76 | |
Geert Uytterhoeven | 0eff08b | 2012-06-20 12:52:59 -0700 | [diff] [blame] | 77 | buildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/) |
| 78 | buildplf := $(shell test -e $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/) |
Chris Zankel | f193318 | 2009-04-02 16:58:53 -0700 | [diff] [blame] | 79 | |
| 80 | # Find libgcc.a |
Chris Zankel | 8e1a6dd | 2005-06-23 22:01:10 -0700 | [diff] [blame] | 81 | |
Sam Ravnborg | a0f97e0 | 2007-10-14 22:21:35 +0200 | [diff] [blame] | 82 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
Chris Zankel | 8e1a6dd | 2005-06-23 22:01:10 -0700 | [diff] [blame] | 83 | |
| 84 | head-y := arch/xtensa/kernel/head.o |
Chris Zankel | e7d163f | 2005-06-30 02:58:59 -0700 | [diff] [blame] | 85 | core-y += arch/xtensa/kernel/ arch/xtensa/mm/ |
Chris Zankel | f193318 | 2009-04-02 16:58:53 -0700 | [diff] [blame] | 86 | core-y += $(buildvar) $(buildplf) |
| 87 | |
Chris Zankel | 8e1a6dd | 2005-06-23 22:01:10 -0700 | [diff] [blame] | 88 | libs-y += arch/xtensa/lib/ $(LIBGCC) |
| 89 | |
Max Filippov | da844a8 | 2012-11-04 00:30:13 +0400 | [diff] [blame] | 90 | ifneq ($(CONFIG_BUILTIN_DTB),"") |
| 91 | core-y += arch/xtensa/boot/ |
| 92 | endif |
| 93 | |
Chris Zankel | e7d163f | 2005-06-30 02:58:59 -0700 | [diff] [blame] | 94 | boot := arch/xtensa/boot |
| 95 | |
Chris Zankel | 8e1a6dd | 2005-06-23 22:01:10 -0700 | [diff] [blame] | 96 | all: zImage |
| 97 | |
| 98 | bzImage : zImage |
| 99 | |
Max Filippov | 9ad79b5 | 2012-09-17 05:44:50 +0400 | [diff] [blame] | 100 | zImage: vmlinux |
Chris Zankel | 8e1a6dd | 2005-06-23 22:01:10 -0700 | [diff] [blame] | 101 | $(Q)$(MAKE) $(build)=$(boot) $@ |
| 102 | |
Max Filippov | da844a8 | 2012-11-04 00:30:13 +0400 | [diff] [blame] | 103 | %.dtb: |
| 104 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
| 105 | |
Chris Zankel | 8e1a6dd | 2005-06-23 22:01:10 -0700 | [diff] [blame] | 106 | define archhelp |
| 107 | @echo '* zImage - Compressed kernel image (arch/xtensa/boot/images/zImage.*)' |
| 108 | endef |
| 109 | |