Blame view

arch/sh/Makefile 7.7 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
709420dd4   Paul Mundt   sh: Specify sane ...
81
82
  defaultimage-$(CONFIG_SH_7206_SOLUTION_ENGINE)	:= vmlinux
  defaultimage-$(CONFIG_SH_7619_SOLUTION_ENGINE)	:= vmlinux
f36af7330   Paul Mundt   sh: set KBUILD_IM...
83

c2f1755be   Paul Mundt   sh: Tidy up KBUIL...
84
  # Set some sensible Kbuild defaults
c2f1755be   Paul Mundt   sh: Tidy up KBUIL...
85
  KBUILD_IMAGE		:= $(defaultimage-y)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
86
87
88
89
90
  
  #
  # Choosing incompatible machines durings configuration will result in
  # error messages during linking.
  #
b4db3aec8   Paul Mundt   sh: Fix up the _s...
91
  ifdef CONFIG_SUPERH32
f9e2b97dc   Paul Mundt   sh: Add a KBUILD_...
92
93
94
95
  UTS_MACHINE		:= sh
  BITS			:= 32
  LDFLAGS_vmlinux		+= -e _stext
  KBUILD_DEFCONFIG	:= shx3_defconfig
b4db3aec8   Paul Mundt   sh: Fix up the _s...
96
  else
f9e2b97dc   Paul Mundt   sh: Add a KBUILD_...
97
98
99
100
101
102
  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...
103
  endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
104

457daa2b6   Paul Mundt   sh: Hook up cc-cr...
105
106
107
108
109
  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
110
  ifdef CONFIG_CPU_LITTLE_ENDIAN
7b022d07a   Paul Mundt   sh: Tidy up the l...
111
112
  ld-bfd			:= elf32-$(UTS_MACHINE)-linux
  LDFLAGS_vmlinux		+= --defsym 'jiffies=jiffies_64' --oformat $(ld-bfd)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
113
114
  LDFLAGS			+= -EL
  else
7b022d07a   Paul Mundt   sh: Tidy up the l...
115
116
  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
117
118
  LDFLAGS			+= -EB
  endif
b20883562   Paul Mundt   sh: Provide a BIT...
119
  export ld-bfd BITS
7b022d07a   Paul Mundt   sh: Tidy up the l...
120

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

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

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

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

93dc544cf   Paul Mundt   sh: Provide commo...
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
  #
  # 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
  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
174

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
175
176
177
178
  drivers-y			+= arch/sh/drivers/
  drivers-$(CONFIG_OPROFILE)	+= arch/sh/oprofile/
  
  boot := arch/sh/boot
93dc544cf   Paul Mundt   sh: Provide commo...
179
180
  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
181

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

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

9e24c7e2a   Magnus Damm   sh: add uImage.bi...
195
  BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.srec uImage.bin \
3c928320b   Magnus Damm   sh: romImage supp...
196
  	       zImage vmlinux.srec romImage
ef9b542fc   Paul Mundt   sh: bzip2/lzma uI...
197
  PHONY += maketools $(BOOT_TARGETS) FORCE
d088f3235   Paul Mundt   sh: Consolidate s...
198

cca6e6f5f   Sam Ravnborg   kbuild: h8300,m68...
199
  maketools:  include/linux/version.h FORCE
4385e12b2   Paul Mundt   sh: Revert the lo...
200
  	$(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
201

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

ef9b542fc   Paul Mundt   sh: bzip2/lzma uI...
204
  $(BOOT_TARGETS): vmlinux
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
205
206
207
  	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  
  compressed: zImage
cb3a86c89   Paul Mundt   sh: Kill off sh64...
208
  archprepare: maketools
d088f3235   Paul Mundt   sh: Consolidate s...
209

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

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
214
  define archhelp
ef9b542fc   Paul Mundt   sh: bzip2/lzma uI...
215
  	@echo '  zImage 	           - Compressed kernel image'
fdeb076f2   Paul Mundt   sh: Add romImage ...
216
  	@echo '  romImage	           - Compressed ROM image, if supported'
cf00e2044   Paul Mundt   sh: Add uImage an...
217
  	@echo '  vmlinux.srec	           - Create an ELF S-record'
ef9b542fc   Paul Mundt   sh: bzip2/lzma uI...
218
219
  	@echo '* uImage  	           - Alias to bootable U-Boot image'
  	@echo '  uImage.srec	           - Create an S-record for U-Boot'
a5c461bb3   Paul Mundt   sh: Document uIma...
220
  	@echo '  uImage.bin	           - Kernel-only image for U-Boot (bin)'
ef9b542fc   Paul Mundt   sh: bzip2/lzma uI...
221
222
223
  	@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)'
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
224
  endef
d088f3235   Paul Mundt   sh: Consolidate s...
225

cb3a86c89   Paul Mundt   sh: Kill off sh64...
226
  CLEAN_FILES += include/asm-sh/machtypes.h