Blame view

arch/sh/Makefile 7.97 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
  #
c2f1755be   Paul Mundt   sh: Tidy up KBUIL...
2
  # arch/sh/Makefile
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
3
4
  #
  # Copyright (C) 1999  Kaz Kojima
b2d86a3fd   Paul Mundt   sh: Simplify and ...
5
  # Copyright (C) 2002 - 2008  Paul Mundt
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
7
  # Copyright (C) 2002  M. R. Brown
  #
c2f1755be   Paul Mundt   sh: Tidy up KBUIL...
8
9
10
  # This file is subject to the terms and conditions of the GNU General Public
  # License.  See the file "COPYING" in the main directory of this archive
  # for more details.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
11
  #
cad824484   Paul Mundt   [PATCH] sh: Move ...
12
  isa-y					:= any
e5723e0ee   Paul Mundt   sh: Add support f...
13
  isa-$(CONFIG_SH_DSP)			:= sh
cad824484   Paul Mundt   [PATCH] sh: Move ...
14
  isa-$(CONFIG_CPU_SH2)			:= sh2
e5723e0ee   Paul Mundt   sh: Add support f...
15
  isa-$(CONFIG_CPU_SH2A)			:= sh2a
cad824484   Paul Mundt   [PATCH] sh: Move ...
16
17
18
  isa-$(CONFIG_CPU_SH3)			:= sh3
  isa-$(CONFIG_CPU_SH4)			:= sh4
  isa-$(CONFIG_CPU_SH4A)			:= sh4a
e5723e0ee   Paul Mundt   sh: Add support f...
19
  isa-$(CONFIG_CPU_SH4AL_DSP)		:= sh4al
c20c20047   Paul Mundt   sh: Plug SH-5 in ...
20
  isa-$(CONFIG_CPU_SH5)			:= shmedia
ddb72b024   Paul Mundt   sh: SHmedia ISA t...
21
22
  
  ifeq ($(CONFIG_SUPERH32),y)
cad824484   Paul Mundt   [PATCH] sh: Move ...
23
  isa-$(CONFIG_SH_DSP)			:= $(isa-y)-dsp
ddb72b024   Paul Mundt   sh: SHmedia ISA t...
24
25
  isa-y					:= $(isa-y)-up
  endif
cad824484   Paul Mundt   [PATCH] sh: Move ...
26

6240d92f2   Paul Mundt   sh: Wrap CPU tuni...
27
  cflags-$(CONFIG_CPU_SH2)		:= $(call cc-option,-m2,)
aab1b16a6   Paul Mundt   sh: Don't let SH-...
28
  cflags-$(CONFIG_CPU_SH2A)		+= $(call cc-option,-m2a,) \
6240d92f2   Paul Mundt   sh: Wrap CPU tuni...
29
30
31
  					   $(call cc-option,-m2a-nofpu,)
  cflags-$(CONFIG_CPU_SH3)		:= $(call cc-option,-m3,)
  cflags-$(CONFIG_CPU_SH4)		:= $(call cc-option,-m4,) \
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
32
  	$(call cc-option,-mno-implicit-fp,-m4-nofpu)
aab1b16a6   Paul Mundt   sh: Don't let SH-...
33
  cflags-$(CONFIG_CPU_SH4A)		+= $(call cc-option,-m4a,) \
6240d92f2   Paul Mundt   sh: Wrap CPU tuni...
34
  					   $(call cc-option,-m4a-nofpu,)
8bcc5c1c3   Paul Mundt   sh: Add -m4al tun...
35
  cflags-$(CONFIG_CPU_SH4AL_DSP)		+= $(call cc-option,-m4al,)
c20c20047   Paul Mundt   sh: Plug SH-5 in ...
36
  cflags-$(CONFIG_CPU_SH5)		:= $(call cc-option,-m5-32media-nofpu,)
53644087a   Paul Mundt   sh: Explicit endi...
37

5dd614761   Paul Mundt   sh: Re-add suppor...
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  ifeq ($(cflags-y),)
  #
  # In the case where we are stuck with a compiler that has been uselessly
  # restricted to a particular ISA, a favourite default of newer GCCs when
  # extensive multilib targets are not provided, ensure we get the best fit
  # regarding FP generation. This is intentionally stupid (albeit many
  # orders of magnitude less than GCC's default behaviour), as anything
  # with a large number of multilib targets better have been built
  # correctly for the target in mind.
  #
  cflags-y	+= $(shell $(CC) $(KBUILD_CFLAGS) -print-multi-lib | \
  		     grep nofpu | sed q | sed -e 's/^/-/;s/;.*$$//')
  # At this point, anything goes.
  isaflags-y	:= $(call as-option,-Wa$(comma)-isa=any,)
  else
da2f5f7bf   Paul Mundt   sh: Fix DSP opcod...
53
54
55
56
57
58
59
60
61
62
63
64
  #
  # -Wa,-isa= tuning implies -Wa,-dsp for the versions of binutils that
  # support it, while -Wa,-dsp by itself limits the range of usable opcodes
  # on certain CPU subtypes. Try the ISA variant first, and if that fails,
  # fall back on -Wa,-dsp for the old binutils versions. Even without DSP
  # opcodes, we always want the best ISA tuning the version of binutils
  # will provide.
  #
  isaflags-y	:= $(call as-option,-Wa$(comma)-isa=$(isa-y),)
  
  isaflags-$(CONFIG_SH_DSP)		:= \
  	$(call as-option,-Wa$(comma)-isa=$(isa-y),-Wa$(comma)-dsp)
5dd614761   Paul Mundt   sh: Re-add suppor...
65
66
67
68
  endif
  
  cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= -mb
  cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -ml
da2f5f7bf   Paul Mundt   sh: Fix DSP opcod...
69

5dd614761   Paul Mundt   sh: Re-add suppor...
70
  cflags-y	+= $(call cc-option,-mno-fdpic)
da2f5f7bf   Paul Mundt   sh: Fix DSP opcod...
71
  cflags-y	+= $(isaflags-y) -ffreestanding
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
72

c2f1755be   Paul Mundt   sh: Tidy up KBUIL...
73
74
  OBJCOPYFLAGS	:= -O binary -R .note -R .note.gnu.build-id -R .comment \
  		   -R .stab -R .stabstr -S
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
75

c2f1755be   Paul Mundt   sh: Tidy up KBUIL...
76
  # Give the various platforms the opportunity to set default image types
1a3060323   Paul Mundt   sh: sh7785lcr: Se...
77
78
  defaultimage-$(CONFIG_SUPERH32)			:= zImage
  defaultimage-$(CONFIG_SH_SH7785LCR)		:= uImage
6f5cd2bd5   Paul Mundt   sh: mach-rsk: Use...
79
  defaultimage-$(CONFIG_SH_RSK)			:= uImage
ae68df563   Paul Mundt   sh: Generate uIma...
80
  defaultimage-$(CONFIG_SH_URQUELL)		:= uImage
8144a7dd5   Paul Mundt   sh: Add default u...
81
82
  defaultimage-$(CONFIG_SH_MIGOR)			:= uImage
  defaultimage-$(CONFIG_SH_AP325RXA)		:= uImage
e857bfd46   Nobuhiro Iwamatsu   sh: Add default u...
83
  defaultimage-$(CONFIG_SH_SH7757LCR)		:= uImage
8144a7dd5   Paul Mundt   sh: Add default u...
84
  defaultimage-$(CONFIG_SH_7724_SOLUTION_ENGINE)	:= uImage
709420dd4   Paul Mundt   sh: Specify sane ...
85
86
  defaultimage-$(CONFIG_SH_7206_SOLUTION_ENGINE)	:= vmlinux
  defaultimage-$(CONFIG_SH_7619_SOLUTION_ENGINE)	:= vmlinux
f36af7330   Paul Mundt   sh: set KBUILD_IM...
87

c2f1755be   Paul Mundt   sh: Tidy up KBUIL...
88
  # Set some sensible Kbuild defaults
c2f1755be   Paul Mundt   sh: Tidy up KBUIL...
89
  KBUILD_IMAGE		:= $(defaultimage-y)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
90
91
92
93
94
  
  #
  # Choosing incompatible machines durings configuration will result in
  # error messages during linking.
  #
b4db3aec8   Paul Mundt   sh: Fix up the _s...
95
  ifdef CONFIG_SUPERH32
f9e2b97dc   Paul Mundt   sh: Add a KBUILD_...
96
97
98
99
  UTS_MACHINE		:= sh
  BITS			:= 32
  LDFLAGS_vmlinux		+= -e _stext
  KBUILD_DEFCONFIG	:= shx3_defconfig
b4db3aec8   Paul Mundt   sh: Fix up the _s...
100
  else
f9e2b97dc   Paul Mundt   sh: Add a KBUILD_...
101
102
103
104
105
106
  UTS_MACHINE		:= sh64
  BITS			:= 64
  LDFLAGS_vmlinux		+= --defsym phys_stext=_stext-$(CONFIG_PAGE_OFFSET) \
  			   --defsym phys_stext_shmedia=phys_stext+1 \
  			   -e phys_stext_shmedia
  KBUILD_DEFCONFIG	:= cayman_defconfig
b4db3aec8   Paul Mundt   sh: Fix up the _s...
107
  endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
108

457daa2b6   Paul Mundt   sh: Hook up cc-cr...
109
110
111
112
113
  ifneq ($(SUBARCH),$(ARCH))
    ifeq ($(CROSS_COMPILE),)
      CROSS_COMPILE := $(call cc-cross-prefix, $(UTS_MACHINE)-linux-  $(UTS_MACHINE)-linux-gnu-  $(UTS_MACHINE)-unknown-linux-gnu-)
    endif
  endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
114
  ifdef CONFIG_CPU_LITTLE_ENDIAN
7b022d07a   Paul Mundt   sh: Tidy up the l...
115
116
  ld-bfd			:= elf32-$(UTS_MACHINE)-linux
  LDFLAGS_vmlinux		+= --defsym 'jiffies=jiffies_64' --oformat $(ld-bfd)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
117
118
  LDFLAGS			+= -EL
  else
7b022d07a   Paul Mundt   sh: Tidy up the l...
119
120
  ld-bfd			:= elf32-$(UTS_MACHINE)big-linux
  LDFLAGS_vmlinux		+= --defsym 'jiffies=jiffies_64+4' --oformat $(ld-bfd)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
121
122
  LDFLAGS			+= -EB
  endif
b20883562   Paul Mundt   sh: Provide a BIT...
123
  export ld-bfd BITS
7b022d07a   Paul Mundt   sh: Tidy up the l...
124

b20883562   Paul Mundt   sh: Provide a BIT...
125
  head-y	:= arch/sh/kernel/init_task.o arch/sh/kernel/head_$(BITS).o
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
126

c8b5d9dcb   Paul Mundt   sh: Move out indi...
127
  core-y				+= arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/
4b565680d   Takashi YOSHII   sh: math-emu support
128
  core-$(CONFIG_SH_FPU_EMU)	+= arch/sh/math-emu/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
129

c8b5d9dcb   Paul Mundt   sh: Move out indi...
130
  # Mach groups
939a24a6d   Paul Mundt   sh: Move out the ...
131
  machdir-$(CONFIG_SOLUTION_ENGINE)		+= mach-se
da2014a2b   Paul Mundt   sh: Shuffle the b...
132
133
134
  machdir-$(CONFIG_SH_HP6XX)			+= mach-hp6xx
  machdir-$(CONFIG_SH_DREAMCAST)			+= mach-dreamcast
  machdir-$(CONFIG_SH_SH03)			+= mach-sh03
da2014a2b   Paul Mundt   sh: Shuffle the b...
135
  machdir-$(CONFIG_SH_RTS7751R2D)			+= mach-r2d
da2014a2b   Paul Mundt   sh: Shuffle the b...
136
137
  machdir-$(CONFIG_SH_HIGHLANDER)			+= mach-highlander
  machdir-$(CONFIG_SH_MIGOR)			+= mach-migor
53528928d   Magnus Damm   sh: Move ap325rxa...
138
  machdir-$(CONFIG_SH_AP325RXA)			+= mach-ap325rxa
e7d165146   Magnus Damm   sh: kfr2r09 board...
139
  machdir-$(CONFIG_SH_KFR2R09)			+= mach-kfr2r09
4138b7406   Kuninori Morimoto   sh: Add EcoVec (S...
140
  machdir-$(CONFIG_SH_ECOVEC)			+= mach-ecovec24
da2014a2b   Paul Mundt   sh: Shuffle the b...
141
  machdir-$(CONFIG_SH_SDK7780)			+= mach-sdk7780
02bf6cc72   Paul Mundt   sh: Preliminary S...
142
  machdir-$(CONFIG_SH_SDK7786)			+= mach-sdk7786
da2014a2b   Paul Mundt   sh: Shuffle the b...
143
  machdir-$(CONFIG_SH_X3PROTO)			+= mach-x3proto
da2014a2b   Paul Mundt   sh: Shuffle the b...
144
  machdir-$(CONFIG_SH_SH7763RDP)			+= mach-sh7763rdp
da2014a2b   Paul Mundt   sh: Shuffle the b...
145
146
  machdir-$(CONFIG_SH_SH4202_MICRODEV)		+= mach-microdev
  machdir-$(CONFIG_SH_LANDISK)			+= mach-landisk
da2014a2b   Paul Mundt   sh: Shuffle the b...
147
  machdir-$(CONFIG_SH_LBOX_RE2)			+= mach-lboxre2
da2014a2b   Paul Mundt   sh: Shuffle the b...
148
  machdir-$(CONFIG_SH_CAYMAN)			+= mach-cayman
ea0aac1e1   Paul Mundt   sh: Consolidate r...
149
  machdir-$(CONFIG_SH_RSK)			+= mach-rsk
25f8151bd   Paul Mundt   sh: Get multiple ...
150

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
151
  ifneq ($(machdir-y),)
25f8151bd   Paul Mundt   sh: Get multiple ...
152
153
  core-y	+= $(addprefix arch/sh/boards/, \
  	     $(filter-out ., $(patsubst %,%/,$(machdir-y))))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
154
  endif
7639a4541   Paul Mundt   sh: Migrate commo...
155
156
  # Common machine type headers. Not part of the arch/sh/boards/ hierarchy.
  machdir-y	+= mach-common
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
157
  # Companion chips
4aafae27d   Kristoffer Ericson   sh: hd64461 tidying.
158
  core-$(CONFIG_HD6446X_SERIES)	+= arch/sh/cchips/hd6446x/
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
159

93dc544cf   Paul Mundt   sh: Provide commo...
160
161
162
163
164
165
166
167
168
169
170
171
172
  #
  # CPU header paths
  #
  # These are ordered by optimization level. A CPU family that is a subset
  # of another (ie, SH-2A / SH-2), is picked up first, with increasing
  # levels of genericness if nothing more suitable is situated in the
  # hierarchy.
  #
  # As an example, in order of preference, SH-2A > SH-2 > common definitions.
  #
  cpuincdir-$(CONFIG_CPU_SH2A)	+= cpu-sh2a
  cpuincdir-$(CONFIG_CPU_SH2)	+= cpu-sh2
  cpuincdir-$(CONFIG_CPU_SH3)	+= cpu-sh3
61a6976bf   Paul Mundt   serial: sh-sci: A...
173
  cpuincdir-$(CONFIG_CPU_SH4A)	+= cpu-sh4a
93dc544cf   Paul Mundt   sh: Provide commo...
174
175
176
  cpuincdir-$(CONFIG_CPU_SH4)	+= cpu-sh4
  cpuincdir-$(CONFIG_CPU_SH5)	+= cpu-sh5
  cpuincdir-y			+= cpu-common	# Must be last
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
177

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
178
179
180
181
  drivers-y			+= arch/sh/drivers/
  drivers-$(CONFIG_OPROFILE)	+= arch/sh/oprofile/
  
  boot := arch/sh/boot
93dc544cf   Paul Mundt   sh: Provide commo...
182
183
  cflags-y	+= $(foreach d, $(cpuincdir-y), -Iarch/sh/include/$(d)) \
  		   $(foreach d, $(machdir-y), -Iarch/sh/include/$(d))
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
184

f15cbe6f1   Paul Mundt   sh: migrate to ar...
185
186
187
  KBUILD_CFLAGS		+= -pipe $(cflags-y)
  KBUILD_CPPFLAGS		+= $(cflags-y)
  KBUILD_AFLAGS		+= $(cflags-y)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
188

473d1cf4e   Paul Mundt   sh: Decouple mcou...
189
190
191
  ifeq ($(CONFIG_MCOUNT),y)
    KBUILD_CFLAGS += -pg
  endif
bd353861c   Matt Fleming   sh: dwarf unwinde...
192
193
194
  ifeq ($(CONFIG_DWARF_UNWINDER),y)
    KBUILD_CFLAGS += -fasynchronous-unwind-tables
  endif
49de935c1   Adrian Bunk   sh: fix LIBGCC
195
  libs-$(CONFIG_SUPERH32)		:= arch/sh/lib/	$(libs-y)
180ae2037   Paul Mundt   sh: Provide sdivs...
196
  libs-$(CONFIG_SUPERH64)		:= arch/sh/lib64/ $(libs-y)
49de935c1   Adrian Bunk   sh: fix LIBGCC
197

50cfa79dc   Paul Mundt   sh: support XZ-co...
198
  BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.xz uImage.lzo \
eca50f14b   Paul Mundt   sh: Add a vmlinux...
199
200
  	       uImage.srec uImage.bin zImage vmlinux.bin vmlinux.srec \
  	       romImage
3252b11fc   Sam Ravnborg   sh: move machtype...
201
  PHONY += $(BOOT_TARGETS)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
202

c2f1755be   Paul Mundt   sh: Tidy up KBUIL...
203
  all: $(KBUILD_IMAGE)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
204

ef9b542fc   Paul Mundt   sh: bzip2/lzma uI...
205
  $(BOOT_TARGETS): vmlinux
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
206
207
208
  	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  
  compressed: zImage
3252b11fc   Sam Ravnborg   sh: move machtype...
209
210
  archprepare:
  	$(Q)$(MAKE) $(build)=arch/sh/tools include/generated/machtypes.h
d088f3235   Paul Mundt   sh: Consolidate s...
211

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
212
213
  archclean:
  	$(Q)$(MAKE) $(clean)=$(boot)
c1d0d32a6   Paul Mundt   sh: plug vsyscall...
214
  	$(Q)$(MAKE) $(clean)=arch/sh/kernel/vsyscall
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
215

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
216
  define archhelp
ef9b542fc   Paul Mundt   sh: bzip2/lzma uI...
217
  	@echo '  zImage 	           - Compressed kernel image'
fdeb076f2   Paul Mundt   sh: Add romImage ...
218
  	@echo '  romImage	           - Compressed ROM image, if supported'
cf00e2044   Paul Mundt   sh: Add uImage an...
219
  	@echo '  vmlinux.srec	           - Create an ELF S-record'
eca50f14b   Paul Mundt   sh: Add a vmlinux...
220
  	@echo '  vmlinux.bin	           - Create an uncompressed binary image'
ef9b542fc   Paul Mundt   sh: bzip2/lzma uI...
221
222
  	@echo '* uImage  	           - Alias to bootable U-Boot image'
  	@echo '  uImage.srec	           - Create an S-record for U-Boot'
a5c461bb3   Paul Mundt   sh: Document uIma...
223
  	@echo '  uImage.bin	           - Kernel-only image for U-Boot (bin)'
ef9b542fc   Paul Mundt   sh: bzip2/lzma uI...
224
225
226
  	@echo '* uImage.gz	           - Kernel-only image for U-Boot (gzip)'
  	@echo '  uImage.bz2	           - Kernel-only image for U-Boot (bzip2)'
  	@echo '  uImage.lzma	           - Kernel-only image for U-Boot (lzma)'
50cfa79dc   Paul Mundt   sh: support XZ-co...
227
  	@echo '  uImage.xz	           - Kernel-only image for U-Boot (xz)'
c7b16efb7   Paul Mundt   sh: Add support f...
228
  	@echo '  uImage.lzo	           - Kernel-only image for U-Boot (lzo)'
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
229
  endef