xref: /OK3568_Linux_fs/kernel/arch/xtensa/Makefile (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#
2*4882a593Smuzhiyun# This file is subject to the terms and conditions of the GNU General Public
3*4882a593Smuzhiyun# License.  See the file "COPYING" in the main directory of this archive
4*4882a593Smuzhiyun# for more details.
5*4882a593Smuzhiyun#
6*4882a593Smuzhiyun# Copyright (C) 2001 - 2005  Tensilica Inc.
7*4882a593Smuzhiyun# Copyright (C) 2014 Cadence Design Systems Inc.
8*4882a593Smuzhiyun#
9*4882a593Smuzhiyun# This file is included by the global makefile so that you can add your own
10*4882a593Smuzhiyun# architecture-specific flags and dependencies. Remember to do have actions
11*4882a593Smuzhiyun# for "archclean" and "archdep" for cleaning up and making dependencies for
12*4882a593Smuzhiyun# this architecture
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun# Core configuration.
15*4882a593Smuzhiyun# (Use VAR=<xtensa_config> to use another default compiler.)
16*4882a593Smuzhiyun
17*4882a593Smuzhiyunvariant-y := $(patsubst "%",%,$(CONFIG_XTENSA_VARIANT_NAME))
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunVARIANT = $(variant-y)
20*4882a593Smuzhiyunexport VARIANT
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun# Test for cross compiling
23*4882a593Smuzhiyun
24*4882a593Smuzhiyunifneq ($(VARIANT),)
25*4882a593Smuzhiyun  COMPILE_ARCH = $(shell uname -m)
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun  ifneq ($(COMPILE_ARCH), xtensa)
28*4882a593Smuzhiyun    ifndef CROSS_COMPILE
29*4882a593Smuzhiyun      CROSS_COMPILE = xtensa_$(VARIANT)-
30*4882a593Smuzhiyun    endif
31*4882a593Smuzhiyun  endif
32*4882a593Smuzhiyunendif
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun# Platform configuration
35*4882a593Smuzhiyun
36*4882a593Smuzhiyunplatform-$(CONFIG_XTENSA_PLATFORM_XT2000)	:= xt2000
37*4882a593Smuzhiyunplatform-$(CONFIG_XTENSA_PLATFORM_ISS)		:= iss
38*4882a593Smuzhiyunplatform-$(CONFIG_XTENSA_PLATFORM_XTFPGA)	:= xtfpga
39*4882a593Smuzhiyun
40*4882a593SmuzhiyunPLATFORM = $(platform-y)
41*4882a593Smuzhiyunexport PLATFORM
42*4882a593Smuzhiyun
43*4882a593Smuzhiyun# temporarily until string.h is fixed
44*4882a593SmuzhiyunKBUILD_CFLAGS += -ffreestanding -D__linux__
45*4882a593SmuzhiyunKBUILD_CFLAGS += -pipe -mlongcalls -mtext-section-literals
46*4882a593SmuzhiyunKBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
47*4882a593SmuzhiyunKBUILD_CFLAGS += $(call cc-option,-mno-serialize-volatile,)
48*4882a593Smuzhiyun
49*4882a593SmuzhiyunKBUILD_AFLAGS += -mlongcalls -mtext-section-literals
50*4882a593Smuzhiyun
51*4882a593Smuzhiyunifneq ($(CONFIG_LD_NO_RELAX),)
52*4882a593SmuzhiyunKBUILD_LDFLAGS := --no-relax
53*4882a593Smuzhiyunendif
54*4882a593Smuzhiyun
55*4882a593Smuzhiyunifeq ($(shell echo __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)
56*4882a593SmuzhiyunCHECKFLAGS += -D__XTENSA_EB__
57*4882a593SmuzhiyunKBUILD_CPPFLAGS += -DCONFIG_CPU_BIG_ENDIAN
58*4882a593Smuzhiyunendif
59*4882a593Smuzhiyunifeq ($(shell echo __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1)
60*4882a593SmuzhiyunCHECKFLAGS += -D__XTENSA_EL__
61*4882a593SmuzhiyunKBUILD_CPPFLAGS += -DCONFIG_CPU_LITTLE_ENDIAN
62*4882a593Smuzhiyunendif
63*4882a593Smuzhiyun
64*4882a593Smuzhiyunvardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
65*4882a593Smuzhiyunplfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
66*4882a593Smuzhiyun
67*4882a593SmuzhiyunKBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(vardirs) $(plfdirs))
68*4882a593Smuzhiyun
69*4882a593SmuzhiyunKBUILD_DEFCONFIG := iss_defconfig
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun# Only build variant and/or platform if it includes a Makefile
72*4882a593Smuzhiyun
73*4882a593Smuzhiyunbuildvar := $(shell test -e $(srctree)/arch/xtensa/variants/$(VARIANT)/Makefile && echo arch/xtensa/variants/$(VARIANT)/)
74*4882a593Smuzhiyunbuildplf := $(shell test -e $(srctree)/arch/xtensa/platforms/$(PLATFORM)/Makefile && echo arch/xtensa/platforms/$(PLATFORM)/)
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun# Find libgcc.a
77*4882a593Smuzhiyun
78*4882a593SmuzhiyunLIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
79*4882a593Smuzhiyun
80*4882a593Smuzhiyunhead-y		:= arch/xtensa/kernel/head.o
81*4882a593Smuzhiyuncore-y		+= arch/xtensa/kernel/ arch/xtensa/mm/
82*4882a593Smuzhiyuncore-y		+= $(buildvar) $(buildplf)
83*4882a593Smuzhiyuncore-y 		+= arch/xtensa/boot/dts/
84*4882a593Smuzhiyun
85*4882a593Smuzhiyunlibs-y		+= arch/xtensa/lib/ $(LIBGCC)
86*4882a593Smuzhiyundrivers-$(CONFIG_OPROFILE)	+= arch/xtensa/oprofile/
87*4882a593Smuzhiyun
88*4882a593Smuzhiyunboot		:= arch/xtensa/boot
89*4882a593Smuzhiyun
90*4882a593Smuzhiyunall Image zImage uImage xipImage: vmlinux
91*4882a593Smuzhiyun	$(Q)$(MAKE) $(build)=$(boot) $@
92*4882a593Smuzhiyun
93*4882a593Smuzhiyunarchheaders:
94*4882a593Smuzhiyun	$(Q)$(MAKE) $(build)=arch/xtensa/kernel/syscalls all
95*4882a593Smuzhiyun
96*4882a593Smuzhiyundefine archhelp
97*4882a593Smuzhiyun  @echo '* Image       - Kernel ELF image with reset vector'
98*4882a593Smuzhiyun  @echo '* zImage      - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
99*4882a593Smuzhiyun  @echo '* uImage      - U-Boot wrapped image'
100*4882a593Smuzhiyun  @echo '  xipImage    - XIP image'
101*4882a593Smuzhiyunendef
102