Back to home page

LXR

 
 

    


0001 #
0002 # This file is subject to the terms and conditions of the GNU General Public
0003 # License.  See the file "COPYING" in the main directory of this archive
0004 # for more details.
0005 #
0006 # Copyright (C) 2001 - 2005  Tensilica Inc.
0007 # Copyright (C) 2014 Cadence Design Systems Inc.
0008 #
0009 # This file is included by the global makefile so that you can add your own
0010 # architecture-specific flags and dependencies. Remember to do have actions
0011 # for "archclean" and "archdep" for cleaning up and making dependencies for
0012 # this architecture
0013 
0014 # Core configuration.
0015 # (Use VAR=<xtensa_config> to use another default compiler.)
0016 
0017 variant-y := $(patsubst "%",%,$(CONFIG_XTENSA_VARIANT_NAME))
0018 
0019 VARIANT = $(variant-y)
0020 export VARIANT
0021 
0022 # Test for cross compiling
0023 
0024 ifneq ($(VARIANT),)
0025   COMPILE_ARCH = $(shell uname -m)
0026 
0027   ifneq ($(COMPILE_ARCH), xtensa)
0028     ifndef CROSS_COMPILE
0029       CROSS_COMPILE = xtensa_$(VARIANT)-
0030     endif
0031   endif
0032 endif
0033 
0034 # Platform configuration
0035 
0036 platform-$(CONFIG_XTENSA_PLATFORM_XT2000)       := xt2000
0037 platform-$(CONFIG_XTENSA_PLATFORM_ISS)          := iss
0038 platform-$(CONFIG_XTENSA_PLATFORM_XTFPGA)       := xtfpga
0039 
0040 PLATFORM = $(platform-y)
0041 export PLATFORM
0042 
0043 # temporarily until string.h is fixed
0044 KBUILD_CFLAGS += -ffreestanding -D__linux__
0045 
0046 KBUILD_CFLAGS += -pipe -mlongcalls
0047 
0048 KBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
0049 
0050 ifneq ($(CONFIG_LD_NO_RELAX),)
0051 LDFLAGS := --no-relax
0052 endif
0053 
0054 ifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)
0055 CHECKFLAGS += -D__XTENSA_EB__
0056 KBUILD_CPPFLAGS += -DCONFIG_CPU_BIG_ENDIAN
0057 endif
0058 ifeq ($(shell echo __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1)
0059 CHECKFLAGS += -D__XTENSA_EL__
0060 KBUILD_CPPFLAGS += -DCONFIG_CPU_LITTLE_ENDIAN
0061 endif
0062 
0063 vardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
0064 plfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
0065 
0066 ifeq ($(KBUILD_SRC),)
0067 KBUILD_CPPFLAGS += $(patsubst %,-I%include,$(vardirs) $(plfdirs))
0068 else
0069 KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs))
0070 endif
0071 
0072 KBUILD_DEFCONFIG := iss_defconfig
0073 
0074 # Only build variant and/or platform if it includes a Makefile
0075 
0076 buildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/)
0077 buildplf := $(shell test -e $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/)
0078 
0079 # Find libgcc.a
0080 
0081 LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
0082 
0083 head-y          := arch/xtensa/kernel/head.o
0084 core-y          += arch/xtensa/kernel/ arch/xtensa/mm/
0085 core-y          += $(buildvar) $(buildplf)
0086 
0087 libs-y          += arch/xtensa/lib/ $(LIBGCC)
0088 drivers-$(CONFIG_OPROFILE)      += arch/xtensa/oprofile/
0089 
0090 ifneq ($(CONFIG_BUILTIN_DTB),"")
0091 core-$(CONFIG_OF) += arch/xtensa/boot/dts/
0092 endif
0093 
0094 boot            := arch/xtensa/boot
0095 
0096 all: zImage
0097 
0098 bzImage : zImage
0099 
0100 zImage: vmlinux
0101         $(Q)$(MAKE) $(build)=$(boot) $@
0102 
0103 %.dtb:
0104         $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
0105 
0106 dtbs: scripts
0107         $(Q)$(MAKE) $(build)=$(boot)/dts
0108 
0109 define archhelp
0110   @echo '* zImage      - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
0111   @echo '  dtbs        - Build device tree blobs for enabled boards'
0112 endef