xref: /linux/arch/xtensa/Makefile (revision 4bedea94545165364618d403d03b61d797acba0b)
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 CPU=<xtensa_config> to use another default compiler.)
15
16cpu-$(CONFIG_XTENSA_CPU_LINUX_BE)	:= linux_be
17cpu-$(CONFIG_XTENSA_CPU_LINUX_CUSTOM)	:= linux_custom
18
19CPU = $(cpu-y)
20export CPU
21
22# Platform configuration
23
24platform-y					:= common
25platform-$(CONFIG_XTENSA_PLATFORM_XT2000)	:= xt2000
26platform-$(CONFIG_XTENSA_PLATFORM_ISS)		:= iss
27
28PLATFORM = $(platform-y)
29export PLATFORM
30
31#LDFLAGS_vmlinux		:= -T$(word 1,$(LINKSCRIPT))
32AFLAGS_vmlinux.lds.o	:= -Uxtensa
33CPPFLAGS		+= -Iarch/xtensa -Iinclude/asm  -mlongcalls  -g
34AFLAGS			+= -Iarch/xtensa -Iinclude/asm
35CPP			= $(CC) -E $(CFLAGS)
36
37cflags-y	+= -Iarch/xtensa -pipe -mlongcalls
38
39
40KBUILD_DEFCONFIG := common_defconfig
41
42# ramdisk/initrd support
43# You need a compressed ramdisk image, named ramdisk.gz in
44# arch/xtensa/boot/ramdisk
45
46core-$(CONFIG_EMBEDDED_RAMDISK)	+= arch/xtensa/boot/ramdisk/
47
48# Test for cross compiling
49
50ifneq ($(CPU),)
51  COMPILE_ARCH = $(shell uname -m)
52
53  ifneq ($(COMPILE_ARCH), xtensa)
54    ifndef CROSS_COMPILE
55      CROSS_COMPILE = xtensa_$(CPU)-
56    endif
57  endif
58endif
59
60#
61
62LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
63
64head-y		:= arch/xtensa/kernel/head.o
65core-y		+= arch/xtensa/kernel/ \
66		   arch/xtensa/mm/ arch/xtensa/platform-$(PLATFORM)/
67libs-y		+= arch/xtensa/lib/ $(LIBGCC)
68
69boot	:= arch/xtensa/boot
70
71arch/xtensa/kernel/asm-offsets.s: \
72	arch/xtensa/kernel/asm-offsets.c \
73	include/asm-xtensa/.platform
74
75include/asm-xtensa/offsets.h: arch/xtensa/kernel/asm-offsets.s
76	$(call filechk,gen-asm-offsets)
77
78prepare: include/asm-xtensa/.platform include/asm-xtensa/offsets.h
79
80# Update machine cpu and platform symlinks if something which affects
81# them changed.
82
83include/asm-xtensa/.platform: $(wildcard include/config/arch/*.h)
84	@echo '  Setting up cpu ($(CPU)) and platform ($(PLATFORM)) symlinks'
85	$(Q)rm -f include/asm-xtensa/platform
86	$(Q)rm -f include/asm-xtensa/xtensa/config
87	$(Q)(cd include/asm-xtensa/; ln -sf platform-$(PLATFORM) platform)
88	$(Q)(cd include/asm-xtensa/xtensa; ln -sf config-$(CPU) config)
89
90all: zImage
91
92bzImage : zImage
93
94zImage zImage.initrd: vmlinux
95	$(Q)$(MAKE) $(build)=$(boot) $@
96
97CLEAN_FILES	+= arch/xtensa/vmlinux.lds include/asm-xtensa/offset.h
98
99define archhelp
100  @echo '* zImage      - Compressed kernel image (arch/xtensa/boot/images/zImage.*)'
101endef
102
103