xref: /openbmc/linux/arch/xtensa/Makefile (revision c1d45424)
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.
14# (Use VAR=<xtensa_config> to use another default compiler.)
15
16variant-$(CONFIG_XTENSA_VARIANT_FSF)		:= fsf
17variant-$(CONFIG_XTENSA_VARIANT_DC232B)		:= dc232b
18variant-$(CONFIG_XTENSA_VARIANT_DC233C)		:= dc233c
19variant-$(CONFIG_XTENSA_VARIANT_S6000)		:= s6000
20variant-$(CONFIG_XTENSA_VARIANT_LINUX_CUSTOM)	:= custom
21
22VARIANT = $(variant-y)
23export VARIANT
24
25# 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
37# Platform configuration
38
39platform-$(CONFIG_XTENSA_PLATFORM_XT2000)	:= xt2000
40platform-$(CONFIG_XTENSA_PLATFORM_ISS)		:= iss
41platform-$(CONFIG_XTENSA_PLATFORM_S6105)	:= s6105
42platform-$(CONFIG_XTENSA_PLATFORM_XTFPGA)	:= xtfpga
43
44PLATFORM = $(platform-y)
45export PLATFORM
46
47# temporarily until string.h is fixed
48KBUILD_CFLAGS += -ffreestanding -D__linux__
49
50KBUILD_CFLAGS += -pipe -mlongcalls
51
52KBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
53
54ifneq ($(CONFIG_LD_NO_RELAX),)
55LDFLAGS := --no-relax
56endif
57
58ifeq ($(shell echo -e __XTENSA_EB__ | $(CC) -E - | grep -v "\#"),1)
59CHECKFLAGS += -D__XTENSA_EB__
60endif
61ifeq ($(shell echo -e __XTENSA_EL__ | $(CC) -E - | grep -v "\#"),1)
62CHECKFLAGS += -D__XTENSA_EL__
63endif
64
65vardirs := $(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
74KBUILD_DEFCONFIG := iss_defconfig
75
76# Only build variant and/or platform if it includes a Makefile
77
78buildvar := $(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)/)
80
81# Find libgcc.a
82
83LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
84
85head-y		:= arch/xtensa/kernel/head.o
86core-y		+= arch/xtensa/kernel/ arch/xtensa/mm/
87core-y		+= $(buildvar) $(buildplf)
88
89libs-y		+= arch/xtensa/lib/ $(LIBGCC)
90drivers-$(CONFIG_OPROFILE)	+= arch/xtensa/oprofile/
91
92ifneq ($(CONFIG_BUILTIN_DTB),"")
93core-$(CONFIG_OF) += arch/xtensa/boot/dts/
94endif
95
96boot		:= arch/xtensa/boot
97
98all: zImage
99
100bzImage : zImage
101
102zImage: vmlinux
103	$(Q)$(MAKE) $(build)=$(boot) $@
104
105%.dtb:
106	$(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
107
108define archhelp
109  @echo '* zImage      - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
110endef
111