xref: /linux/arch/powerpc/Makefile (revision 4bf4f42a2febb449a5cc5d79e7c58e5b168942d7)
114cf11afSPaul Mackerras# This file is included by the global makefile so that you can add your own
214cf11afSPaul Mackerras# architecture-specific flags and dependencies. Remember to do have actions
314cf11afSPaul Mackerras# for "archclean" and "archdep" for cleaning up and making dependencies for
414cf11afSPaul Mackerras# this architecture.
514cf11afSPaul Mackerras#
614cf11afSPaul Mackerras# This file is subject to the terms and conditions of the GNU General Public
714cf11afSPaul Mackerras# License.  See the file "COPYING" in the main directory of this archive
814cf11afSPaul Mackerras# for more details.
914cf11afSPaul Mackerras#
1014cf11afSPaul Mackerras# Copyright (C) 1994 by Linus Torvalds
1114cf11afSPaul Mackerras# Changes for PPC by Gary Thomas
1214cf11afSPaul Mackerras# Rewritten by Cort Dougan and Paul Mackerras
1314cf11afSPaul Mackerras#
1414cf11afSPaul Mackerras
1514cf11afSPaul MackerrasHAS_BIARCH	:= $(call cc-option-yn, -m32)
1614cf11afSPaul Mackerras
1714cf11afSPaul Mackerras# Set default 32 bits cross compilers for vdso and boot wrapper
1814cf11afSPaul MackerrasCROSS32_COMPILE ?=
1914cf11afSPaul Mackerras
2014cf11afSPaul MackerrasCROSS32CC		:= $(CROSS32_COMPILE)gcc
212bf11819SPaul MackerrasCROSS32AR		:= $(CROSS32_COMPILE)ar
2214cf11afSPaul Mackerras
2314cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y)
2414cf11afSPaul Mackerrasifeq ($(CROSS32_COMPILE),)
2514cf11afSPaul MackerrasCROSS32CC	:= $(CC) -m32
2643c9127dSNicholas PigginKBUILD_ARFLAGS	+= --target=elf32-powerpc
27*4bf4f42aSNicholas Pigginifdef CONFIG_PPC32
28*4bf4f42aSNicholas Piggin# These options will be overridden by any -mcpu option that the CPU
29*4bf4f42aSNicholas Piggin# or platform code sets later on the command line, but they are needed
30*4bf4f42aSNicholas Piggin# to set a sane 32-bit cpu target for the 64-bit cross compiler which
31*4bf4f42aSNicholas Piggin# may default to the wrong ISA.
32*4bf4f42aSNicholas PigginKBUILD_CFLAGS		+= -mcpu=powerpc
33*4bf4f42aSNicholas PigginKBUILD_AFLAGS		+= -mcpu=powerpc
34*4bf4f42aSNicholas Pigginendif
3514cf11afSPaul Mackerrasendif
3614cf11afSPaul Mackerrasendif
3714cf11afSPaul Mackerras
381976aef9SSegher Boessenkoolexport CROSS32CC CROSS32AR
3914cf11afSPaul Mackerras
40ca786f83SAdrian Bunkifeq ($(CROSS_COMPILE),)
418a5abdf8SPaul MackerrasKBUILD_DEFCONFIG := $(shell uname -m)_defconfig
42ca786f83SAdrian Bunkelse
43ca786f83SAdrian BunkKBUILD_DEFCONFIG := ppc64_defconfig
44ca786f83SAdrian Bunkendif
458a5abdf8SPaul Mackerras
4694b212c2SPaul Mackerrasifeq ($(CONFIG_PPC64),y)
4714cf11afSPaul Mackerrasnew_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi)
4814cf11afSPaul Mackerras
4914cf11afSPaul Mackerrasifeq ($(new_nm),y)
5014cf11afSPaul MackerrasNM		:= $(NM) --synthetic
5114cf11afSPaul Mackerrasendif
52a0588015SAnton Blanchardendif
5314cf11afSPaul Mackerras
5468201fbbSMichael Ellerman# BITS is used as extension for files which are available in a 32 bit
5568201fbbSMichael Ellerman# and a 64 bit version to simplify shared Makefiles.
5668201fbbSMichael Ellerman# e.g.: obj-y += foo_$(BITS).o
5768201fbbSMichael Ellermanexport BITS
5868201fbbSMichael Ellerman
5968201fbbSMichael Ellermanifdef CONFIG_PPC64
6068201fbbSMichael Ellerman        BITS := 64
6168201fbbSMichael Ellermanelse
6268201fbbSMichael Ellerman        BITS := 32
6314cf11afSPaul Mackerrasendif
6414cf11afSPaul Mackerras
6557073e27SMichael Ellermanmachine-y = ppc
6657073e27SMichael Ellermanmachine-$(CONFIG_PPC64) += 64
6757073e27SMichael Ellermanmachine-$(CONFIG_CPU_LITTLE_ENDIAN) += le
6857073e27SMichael EllermanUTS_MACHINE := $(subst $(space),,$(machine-y))
69190554dbSStephen Rothwell
70b40b2386SMichael Ellerman# XXX This needs to be before we override LD below
71b40b2386SMichael Ellermanifdef CONFIG_PPC32
72b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
73b40b2386SMichael Ellermanelse
745c45b528SAlan ModraKBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/powerpc/kernel/module.lds
75b40b2386SMichael Ellermanifeq ($(call ld-ifversion, -ge, 225000000, y),y)
76b40b2386SMichael Ellerman# Have the linker provide sfpr if possible.
77b40b2386SMichael Ellerman# There is a corresponding test in arch/powerpc/lib/Makefile
78b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += --save-restore-funcs
79b40b2386SMichael Ellermanelse
80b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
81b40b2386SMichael Ellermanendif
82b40b2386SMichael Ellermanendif
83b40b2386SMichael Ellerman
84d72b0801SIan Munsieifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
85d72b0801SIan Munsieoverride LD	+= -EL
86d72b0801SIan MunsieLDEMULATION	:= lppc
87d72b0801SIan MunsieGNUTARGET	:= powerpcle
88d72b0801SIan MunsieMULTIPLEWORD	:= -mno-multiple
89d3d35d95STony BreedsKBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect)
90d72b0801SIan Munsieelse
91d72b0801SIan Munsieoverride LD	+= -EB
92d72b0801SIan MunsieLDEMULATION	:= ppc
93d72b0801SIan MunsieGNUTARGET	:= powerpc
94d72b0801SIan MunsieMULTIPLEWORD	:= -mmultiple
95d72b0801SIan Munsieendif
96d72b0801SIan Munsie
974dc831aaSNicholas Pigginifdef CONFIG_PPC64
984dc831aaSNicholas Piggincflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
994dc831aaSNicholas Piggincflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mcall-aixdesc)
1004dc831aaSNicholas Pigginaflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
1014dc831aaSNicholas Pigginaflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mabi=elfv2
1024dc831aaSNicholas Pigginendif
1034dc831aaSNicholas Piggin
104164af597SMichael Ellermancflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
1054dc831aaSNicholas Piggincflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
106164af597SMichael Ellermanifneq ($(cc-name),clang)
107164af597SMichael Ellerman  cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mno-strict-align
108164af597SMichael Ellermanendif
109164af597SMichael Ellerman
110164af597SMichael Ellermanaflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
111164af597SMichael Ellermanaflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
112164af597SMichael Ellerman
11314cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y)
11468201fbbSMichael Ellermanoverride AS	+= -a$(BITS)
11568201fbbSMichael Ellermanoverride LD	+= -m elf$(BITS)$(LDEMULATION)
11668201fbbSMichael Ellermanoverride CC	+= -m$(BITS)
11743c9127dSNicholas PigginKBUILD_ARFLAGS	+= --target=elf$(BITS)-$(GNUTARGET)
11814cf11afSPaul Mackerrasendif
11914cf11afSPaul Mackerras
1209c5f7d39SSuzuki PouloseLDFLAGS_vmlinux-y := -Bstatic
1219c5f7d39SSuzuki PouloseLDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
1229c5f7d39SSuzuki PouloseLDFLAGS_vmlinux	:= $(LDFLAGS_vmlinux-y)
12383a092cfSNicholas PigginLDFLAGS_vmlinux += $(call ld-option,--orphan-handling=warn)
12414cf11afSPaul Mackerras
1251fbe9cf2SAnton Blanchardifeq ($(CONFIG_PPC64),y)
1261fbe9cf2SAnton Blanchardifeq ($(call cc-option-yn,-mcmodel=medium),y)
1271fbe9cf2SAnton Blanchard	# -mcmodel=medium breaks modules because it uses 32bit offsets from
1281fbe9cf2SAnton Blanchard	# the TOC pointer to create pointers where possible. Pointers into the
1291fbe9cf2SAnton Blanchard	# percpu data area are created by this method.
1301fbe9cf2SAnton Blanchard	#
1311fbe9cf2SAnton Blanchard	# The kernel module loader relocates the percpu data section from the
1321fbe9cf2SAnton Blanchard	# original location (starting with 0xd...) to somewhere in the base
1331fbe9cf2SAnton Blanchard	# kernel percpu data space (starting with 0xc...). We need a full
1341fbe9cf2SAnton Blanchard	# 64bit relocation for this to work, hence -mcmodel=large.
1351fbe9cf2SAnton Blanchard	KBUILD_CFLAGS_MODULE += -mcmodel=large
1361fbe9cf2SAnton Blanchardelse
1371fbe9cf2SAnton Blanchard	export NO_MINIMAL_TOC := -mno-minimal-toc
1381fbe9cf2SAnton Blanchardendif
1391fbe9cf2SAnton Blanchardendif
1401fbe9cf2SAnton Blanchard
141a50a862eSAnton BlanchardCFLAGS-$(CONFIG_PPC64)	:= $(call cc-option,-mtraceback=no)
142721aeaa9SAnton Blanchardifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
143238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc))
144721aeaa9SAnton BlanchardAFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2)
145721aeaa9SAnton Blanchardelse
1464dc831aaSNicholas PigginCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv1)
147238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcall-aixdesc)
1484dc831aaSNicholas PigginAFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv1)
149721aeaa9SAnton Blanchardendif
150238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc))
15198679fb0SAnton BlanchardCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mno-pointers-to-nested-functions)
15251d42f0fSSegher Boessenkool
153d72b0801SIan MunsieCFLAGS-$(CONFIG_PPC32)	:= -ffixed-r2 $(MULTIPLEWORD)
15451d42f0fSSegher BoessenkoolCFLAGS-$(CONFIG_PPC32)	+= $(call cc-option,-mno-readonly-in-sdata)
155d23c6fb4SAnton Blanchard
15601718ba6SScott Woodifeq ($(CONFIG_PPC_BOOK3S_64),y)
157a73657eaSNicholas Pigginifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
158a73657eaSNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8
1594b7e5532SNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power9,-mtune=power8)
160a73657eaSNicholas Pigginelse
161471d7ff8SNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5))
162471d7ff8SNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4)
163a73657eaSNicholas Pigginendif
16401718ba6SScott Woodelse
16501718ba6SScott WoodCFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
16601718ba6SScott Woodendif
16701718ba6SScott Wood
1688c50b72aSTorsten Duweifdef CONFIG_MPROFILE_KERNEL
169b71c9ffbSNicholas Piggin    ifeq ($(shell $(srctree)/arch/powerpc/tools/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__),OK)
1708c50b72aSTorsten Duwe        CC_FLAGS_FTRACE := -pg -mprofile-kernel
1718c50b72aSTorsten Duwe        KBUILD_CPPFLAGS += -DCC_USING_MPROFILE_KERNEL
1728c50b72aSTorsten Duwe    else
1738c50b72aSTorsten Duwe        # If the user asked for mprofile-kernel but the toolchain doesn't
1748c50b72aSTorsten Duwe        # support it, emit a warning and deliberately break the build later
1758c50b72aSTorsten Duwe        # with mprofile-kernel-not-supported. We would prefer to make this an
1768c50b72aSTorsten Duwe        # error right here, but then the user would never be able to run
1778c50b72aSTorsten Duwe        # oldconfig to change their configuration.
1788c50b72aSTorsten Duwe        $(warning Compiler does not support mprofile-kernel, set CONFIG_DISABLE_MPROFILE_KERNEL)
1798c50b72aSTorsten Duwe        CC_FLAGS_FTRACE := -mprofile-kernel-not-supported
1808c50b72aSTorsten Duwe    endif
1818c50b72aSTorsten Duweendif
1828c50b72aSTorsten Duwe
183d23c6fb4SAnton BlanchardCFLAGS-$(CONFIG_CELL_CPU) += $(call cc-option,-mcpu=cell)
184d23c6fb4SAnton BlanchardCFLAGS-$(CONFIG_POWER5_CPU) += $(call cc-option,-mcpu=power5)
185d23c6fb4SAnton BlanchardCFLAGS-$(CONFIG_POWER6_CPU) += $(call cc-option,-mcpu=power6)
186d23c6fb4SAnton BlanchardCFLAGS-$(CONFIG_POWER7_CPU) += $(call cc-option,-mcpu=power7)
187ff2e466aSAnton BlanchardCFLAGS-$(CONFIG_POWER8_CPU) += $(call cc-option,-mcpu=power8)
1884b7e5532SNicholas PigginCFLAGS-$(CONFIG_POWER9_CPU) += $(call cc-option,-mcpu=power9)
189d23c6fb4SAnton Blanchard
190cbf8a358STiejun Chen# Altivec option not allowed with e500mc64 in GCC.
191cbf8a358STiejun Chenifeq ($(CONFIG_ALTIVEC),y)
192cbf8a358STiejun ChenE5500_CPU := -mcpu=powerpc64
193cbf8a358STiejun Chenelse
19401718ba6SScott WoodE5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
195cbf8a358STiejun Chenendif
19601718ba6SScott WoodCFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
19701718ba6SScott WoodCFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
19801718ba6SScott Wood
199847f56b0SScott Woodifeq ($(CONFIG_PPC32),y)
200847f56b0SScott Woodifeq ($(CONFIG_PPC_E500MC),y)
201847f56b0SScott WoodCFLAGS-y += $(call cc-option,-mcpu=e500mc,-mcpu=powerpc)
202847f56b0SScott Woodelse
203847f56b0SScott WoodCFLAGS-$(CONFIG_E500) += $(call cc-option,-mcpu=8540 -msoft-float,-mcpu=powerpc)
204847f56b0SScott Woodendif
205847f56b0SScott Woodendif
206847f56b0SScott Wood
2077998eb3dSGuenter Roeckasinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
2087998eb3dSGuenter Roeck
2097998eb3dSGuenter RoeckKBUILD_CPPFLAGS	+= -Iarch/$(ARCH) $(asinstr)
21058aedccbSAnton BlanchardKBUILD_AFLAGS	+= -Iarch/$(ARCH) $(AFLAGS-y)
211a50a862eSAnton BlanchardKBUILD_CFLAGS	+= $(call cc-option,-msoft-float)
212a50a862eSAnton BlanchardKBUILD_CFLAGS	+= -pipe -Iarch/$(ARCH) $(CFLAGS-y)
213a0f97e06SSam RavnborgCPP		= $(CC) -E $(KBUILD_CFLAGS)
21414cf11afSPaul Mackerras
21568201fbbSMichael EllermanCHECKFLAGS	+= -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__
21662c2c5cfSDaniel Axtensifdef CONFIG_CPU_BIG_ENDIAN
21762c2c5cfSDaniel AxtensCHECKFLAGS	+= -D__BIG_ENDIAN__
21862c2c5cfSDaniel Axtenselse
21962c2c5cfSDaniel AxtensCHECKFLAGS	+= -D__LITTLE_ENDIAN__
22062c2c5cfSDaniel Axtensendif
22114cf11afSPaul Mackerras
222d5b35cffSAlistair Poppleifeq ($(CONFIG_476FPE_ERR46),y)
223d5b35cffSAlistair Popple	KBUILD_LDFLAGS_MODULE += --ppc476-workaround \
224d5b35cffSAlistair Popple		-T $(srctree)/arch/powerpc/platforms/44x/ppc476_modules.lds
225d5b35cffSAlistair Poppleendif
226d5b35cffSAlistair Popple
227d23c6fb4SAnton Blanchard# No AltiVec or VSX instructions when building kernel
228a0f97e06SSam RavnborgKBUILD_CFLAGS += $(call cc-option,-mno-altivec)
229d23c6fb4SAnton BlanchardKBUILD_CFLAGS += $(call cc-option,-mno-vsx)
230d3f67fbbSPaul Mackerras
2310197cd2eSKumar Gala# No SPE instruction when building kernel
232ce400c01SThiemo Seufer# (We use all available options to help semi-broken compilers)
2330197cd2eSKumar GalaKBUILD_CFLAGS += $(call cc-option,-mno-spe)
234ce400c01SThiemo SeuferKBUILD_CFLAGS += $(call cc-option,-mspe=no)
2350197cd2eSKumar Gala
23614cf11afSPaul Mackerras# Enable unit-at-a-time mode when possible. It shrinks the
23714cf11afSPaul Mackerras# kernel considerably.
238a0f97e06SSam RavnborgKBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)
23914cf11afSPaul Mackerras
240d0679c73SAndi Kleen# FIXME: the module load should be taught about the additional relocs
241d0679c73SAndi Kleen# generated by this.
242d0679c73SAndi Kleen# revert to pre-gcc-4.4 behaviour of .eh_frame
243d0679c73SAndi KleenKBUILD_CFLAGS	+= $(call cc-option,-fno-dwarf2-cfi-asm)
244d0679c73SAndi Kleen
24557647a4dSBenjamin Herrenschmidt# Never use string load/store instructions as they are
24657647a4dSBenjamin Herrenschmidt# often slow when they are implemented at all
247a50a862eSAnton BlanchardKBUILD_CFLAGS		+= $(call cc-option,-mno-string)
24814cf11afSPaul Mackerras
249f48b8296SOlaf Heringifeq ($(CONFIG_6xx),y)
250a0f97e06SSam RavnborgKBUILD_CFLAGS		+= -mcpu=powerpc
251f48b8296SOlaf Heringendif
252f48b8296SOlaf Hering
2537563dc64STony Breeds# Work around a gcc code-gen bug with -fno-omit-frame-pointer.
254606576ceSSteven Rostedtifeq ($(CONFIG_FUNCTION_TRACER),y)
2557563dc64STony BreedsKBUILD_CFLAGS		+= -mno-sched-epilog
2567563dc64STony Breedsendif
2577563dc64STony Breeds
25814cf11afSPaul Mackerrascpu-as-$(CONFIG_4xx)		+= -Wa,-m405
2599ddf0075SAnton Blanchardcpu-as-$(CONFIG_ALTIVEC)	+= $(call as-option,-Wa$(comma)-maltivec)
26014cf11afSPaul Mackerrascpu-as-$(CONFIG_E200)		+= -Wa,-me200
26115a3204dSNicholas Piggincpu-as-$(CONFIG_PPC_BOOK3S_64)	+= -Wa,-mpower4
26214cf11afSPaul Mackerras
263222d394dSSam RavnborgKBUILD_AFLAGS += $(cpu-as-y)
264a0f97e06SSam RavnborgKBUILD_CFLAGS += $(cpu-as-y)
26514cf11afSPaul Mackerras
266164af597SMichael EllermanKBUILD_AFLAGS += $(aflags-y)
267164af597SMichael EllermanKBUILD_CFLAGS += $(cflags-y)
268164af597SMichael Ellerman
26968201fbbSMichael Ellermanhead-y				:= arch/powerpc/kernel/head_$(BITS).o
270968159c0SChristophe Leroyhead-$(CONFIG_PPC_8xx)		:= arch/powerpc/kernel/head_8xx.o
27115f6527eSJosh Boyerhead-$(CONFIG_40x)		:= arch/powerpc/kernel/head_40x.o
27214cf11afSPaul Mackerrashead-$(CONFIG_44x)		:= arch/powerpc/kernel/head_44x.o
27314cf11afSPaul Mackerrashead-$(CONFIG_FSL_BOOKE)	:= arch/powerpc/kernel/head_fsl_booke.o
27414cf11afSPaul Mackerras
2759994a338SPaul Mackerrashead-$(CONFIG_PPC64)		+= arch/powerpc/kernel/entry_64.o
27614cf11afSPaul Mackerrashead-$(CONFIG_PPC_FPU)		+= arch/powerpc/kernel/fpu.o
277e821ea70SBenjamin Herrenschmidthead-$(CONFIG_ALTIVEC)		+= arch/powerpc/kernel/vector.o
2785ac47f7aSAnton Blanchardhead-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE)  += arch/powerpc/kernel/prom_init.o
27914cf11afSPaul Mackerras
280daec962eSPaul Mackerrascore-y				+= arch/powerpc/kernel/ \
281daec962eSPaul Mackerras				   arch/powerpc/mm/ \
282daec962eSPaul Mackerras				   arch/powerpc/lib/ \
283daec962eSPaul Mackerras				   arch/powerpc/sysdev/ \
2841a3d1fc2SLiu Yu				   arch/powerpc/platforms/ \
2850ca87f05SMatt Evans				   arch/powerpc/math-emu/ \
286323a6bf1SMichael Ellerman				   arch/powerpc/crypto/ \
2870ca87f05SMatt Evans				   arch/powerpc/net/
288f78541dcSPaul Mackerrascore-$(CONFIG_XMON)		+= arch/powerpc/xmon/
289bbf45ba5SHollis Blanchardcore-$(CONFIG_KVM) 		+= arch/powerpc/kvm/
290f2699491SMichael Ellermancore-$(CONFIG_PERF_EVENTS)	+= arch/powerpc/perf/
2910d976313SThiago Jung Bauermanncore-$(CONFIG_KEXEC_FILE)	+= arch/powerpc/purgatory/
29214cf11afSPaul Mackerras
29314cf11afSPaul Mackerrasdrivers-$(CONFIG_OPROFILE)	+= arch/powerpc/oprofile/
29414cf11afSPaul Mackerras
295135f0b17STom Rini# Default to zImage, override when needed
29625431333SGrant Likelyall: zImage
29714cf11afSPaul Mackerras
298e32e78c5SSam Ravnborg# With make 3.82 we cannot mix normal and wildcard targets
299c686ecf5SAnatolij GustschinBOOT_TARGETS1 := zImage zImage.initrd uImage
30011eab297SBenjamin HerrenschmidtBOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.% uImage.%
301cabb5587SStephen Rothwell
302e32e78c5SSam RavnborgPHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2)
303cabb5587SStephen Rothwell
30494b212c2SPaul Mackerrasboot := arch/$(ARCH)/boot
30514cf11afSPaul Mackerras
306e32e78c5SSam Ravnborg$(BOOT_TARGETS1): vmlinux
3071196d7aaSMichael Ellerman	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
308e32e78c5SSam Ravnborg$(BOOT_TARGETS2): vmlinux
3091196d7aaSMichael Ellerman	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
31014cf11afSPaul Mackerras
311e32e78c5SSam Ravnborg
312e32e78c5SSam Ravnborgbootwrapper_install:
3131196d7aaSMichael Ellerman	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
314e32e78c5SSam Ravnborg
3158662d0bcSMatthew McClintock%.dtb: scripts
3161196d7aaSMichael Ellerman	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
317773f76b1SDavid Woodhouse
318ea4d1a87SCyril Bur# Used to create 'merged defconfigs'
319ea4d1a87SCyril Bur# To use it $(call) it with the first argument as the base defconfig
320ea4d1a87SCyril Bur# and the second argument as a space separated list of .config files to merge,
321ea4d1a87SCyril Bur# without the .config suffix.
322ea4d1a87SCyril Burdefine merge_into_defconfig
323ea4d1a87SCyril Bur	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
324ea4d1a87SCyril Bur		-m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \
325ea4d1a87SCyril Bur		$(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config)
326ea4d1a87SCyril Bur	+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
327ea4d1a87SCyril Burendef
328ea4d1a87SCyril Bur
329ea4d1a87SCyril BurPHONY += pseries_le_defconfig
330ea4d1a87SCyril Burpseries_le_defconfig:
331ea4d1a87SCyril Bur	$(call merge_into_defconfig,pseries_defconfig,le)
332ea4d1a87SCyril Bur
3332adc48a6SMichael EllermanPHONY += ppc64le_defconfig
3342adc48a6SMichael Ellermanppc64le_defconfig:
3352adc48a6SMichael Ellerman	$(call merge_into_defconfig,ppc64_defconfig,le)
3362adc48a6SMichael Ellerman
3373603c52fSMichael EllermanPHONY += powernv_be_defconfig
3383603c52fSMichael Ellermanpowernv_be_defconfig:
3393603c52fSMichael Ellerman	$(call merge_into_defconfig,powernv_defconfig,be)
3403603c52fSMichael Ellerman
34144d54014SScott WoodPHONY += mpc85xx_defconfig
34244d54014SScott Woodmpc85xx_defconfig:
34344d54014SScott Wood	$(call merge_into_defconfig,mpc85xx_basic_defconfig,\
34444d54014SScott Wood		85xx-32bit 85xx-hw fsl-emb-nonhw)
34544d54014SScott Wood
34644d54014SScott WoodPHONY += mpc85xx_smp_defconfig
34744d54014SScott Woodmpc85xx_smp_defconfig:
34844d54014SScott Wood	$(call merge_into_defconfig,mpc85xx_basic_defconfig,\
34944d54014SScott Wood		85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw)
35044d54014SScott Wood
35144d54014SScott WoodPHONY += corenet32_smp_defconfig
35244d54014SScott Woodcorenet32_smp_defconfig:
35344d54014SScott Wood	$(call merge_into_defconfig,corenet_basic_defconfig,\
354e0b80f00SClaudiu Manoil		85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw dpaa)
35544d54014SScott Wood
35644d54014SScott WoodPHONY += corenet64_smp_defconfig
35744d54014SScott Woodcorenet64_smp_defconfig:
35844d54014SScott Wood	$(call merge_into_defconfig,corenet_basic_defconfig,\
359e0b80f00SClaudiu Manoil		85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw dpaa)
36044d54014SScott Wood
36143de32c5SAlessio Igor BoganiPHONY += mpc86xx_defconfig
36243de32c5SAlessio Igor Boganimpc86xx_defconfig:
36343de32c5SAlessio Igor Bogani	$(call merge_into_defconfig,mpc86xx_basic_defconfig,\
36443de32c5SAlessio Igor Bogani		86xx-hw fsl-emb-nonhw)
36543de32c5SAlessio Igor Bogani
36643de32c5SAlessio Igor BoganiPHONY += mpc86xx_smp_defconfig
36743de32c5SAlessio Igor Boganimpc86xx_smp_defconfig:
36843de32c5SAlessio Igor Bogani	$(call merge_into_defconfig,mpc86xx_basic_defconfig,\
36943de32c5SAlessio Igor Bogani		86xx-smp 86xx-hw fsl-emb-nonhw)
37043de32c5SAlessio Igor Bogani
37114cf11afSPaul Mackerrasdefine archhelp
37270bf0333SGrant Likely  @echo '* zImage          - Build default images selected by kernel config'
37370bf0333SGrant Likely  @echo '  zImage.*        - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)'
37470bf0333SGrant Likely  @echo '  uImage          - U-Boot native image format'
37570bf0333SGrant Likely  @echo '  cuImage.<dt>    - Backwards compatible U-Boot image for older'
37670bf0333SGrant Likely  @echo '                    versions which do not support device trees'
37770bf0333SGrant Likely  @echo '  dtbImage.<dt>   - zImage with an embedded device tree blob'
37870bf0333SGrant Likely  @echo '  simpleImage.<dt> - Firmware independent image.'
37970bf0333SGrant Likely  @echo '  treeImage.<dt>  - Support for older IBM 4xx firmware (not U-Boot)'
38014cf11afSPaul Mackerras  @echo '  install         - Install kernel using'
381caa27b66SSam Ravnborg  @echo '                    (your) ~/bin/$(INSTALLKERNEL) or'
382caa27b66SSam Ravnborg  @echo '                    (distribution) /sbin/$(INSTALLKERNEL) or'
38314cf11afSPaul Mackerras  @echo '                    install to $$(INSTALL_PATH) and run lilo'
384437a58dbSPaul Mackerras  @echo '  *_defconfig     - Select default config from arch/$(ARCH)/configs'
38570bf0333SGrant Likely  @echo ''
38670bf0333SGrant Likely  @echo '  Targets with <dt> embed a device tree blob inside the image'
38770bf0333SGrant Likely  @echo '  These targets support board with firmware that does not'
38870bf0333SGrant Likely  @echo '  support passing a device tree directly.  Replace <dt> with the'
38970bf0333SGrant Likely  @echo '  name of a dts file from the arch/$(ARCH)/boot/dts/ directory'
39070bf0333SGrant Likely  @echo '  (minus the .dts extension).'
39114cf11afSPaul Mackerrasendef
39214cf11afSPaul Mackerras
3933f85d63eSSam Ravnborginstall:
39425431333SGrant Likely	$(Q)$(MAKE) $(build)=$(boot) install
395928370c6SAkinobu Mita
3968150caadSRoland McGrathvdso_install:
3978150caadSRoland McGrathifeq ($(CONFIG_PPC64),y)
3988150caadSRoland McGrath	$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@
3998150caadSRoland McGrathendif
4008150caadSRoland McGrath	$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@
4018150caadSRoland McGrath
40214cf11afSPaul Mackerrasarchclean:
403a3a9e99eSPaul Mackerras	$(Q)$(MAKE) $(clean)=$(boot)
40470567293SAndreas Gruenbacher
40514cf11afSPaul Mackerrasarchprepare: checkbin
40614cf11afSPaul Mackerras
40714cf11afSPaul Mackerras# Use the file '.tmp_gas_check' for binutils tests, as gas won't output
40814cf11afSPaul Mackerras# to stdout and these checks are run even on install targets.
40914cf11afSPaul MackerrasTOUT	:= .tmp_gas_check
41014cf11afSPaul Mackerras
41182a85084SAnton Blanchard# Check gcc and binutils versions:
41282a85084SAnton Blanchard# - gcc-3.4 and binutils-2.14 are a fatal combination
41382a85084SAnton Blanchard# - Require gcc 4.0 or above on 64-bit
41482a85084SAnton Blanchard# - gcc-4.2.0 has issues compiling modules on 64-bit
41514cf11afSPaul Mackerrascheckbin:
4165631d9c4SMichal Marek	@if test "$(cc-name)" != "clang" \
417e79c8385SMichael Ellerman	    && test "$(cc-version)" = "0304" ; then \
41814cf11afSPaul Mackerras		if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
41914cf11afSPaul Mackerras			echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \
42014cf11afSPaul Mackerras			echo 'correctly with gcc-3.4 and your version of binutils.'; \
42114cf11afSPaul Mackerras			echo '*** Please upgrade your binutils or downgrade your gcc'; \
42214cf11afSPaul Mackerras			false; \
42314cf11afSPaul Mackerras		fi ; \
42414cf11afSPaul Mackerras	fi
4255631d9c4SMichal Marek	@if test "$(cc-name)" != "clang" \
426e79c8385SMichael Ellerman	    && test "$(cc-version)" -lt "0400" \
42782a85084SAnton Blanchard	    && test "x${CONFIG_PPC64}" = "xy" ; then \
42882a85084SAnton Blanchard                echo -n "Sorry, GCC v4.0 or above is required to build " ; \
42982a85084SAnton Blanchard                echo "the 64-bit powerpc kernel." ; \
43082a85084SAnton Blanchard                false ; \
43182a85084SAnton Blanchard        fi
4325631d9c4SMichal Marek	@if test "$(cc-name)" != "clang" \
433e79c8385SMichael Ellerman	    && test "$(cc-fullversion)" = "040200" \
434f5e83fa4SSegher Boessenkool	    && test "x${CONFIG_MODULES}${CONFIG_PPC64}" = "xyy" ; then \
435f5e83fa4SSegher Boessenkool		echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \
436f5e83fa4SSegher Boessenkool		echo 'kernel with modules enabled.' ; \
437f5e83fa4SSegher Boessenkool		echo -n '*** Please use a different GCC version or ' ; \
438f5e83fa4SSegher Boessenkool		echo 'disable kernel modules' ; \
439f5e83fa4SSegher Boessenkool		false ; \
440f5e83fa4SSegher Boessenkool	fi
44160e065f7SMichael Ellerman	@if test "x${CONFIG_CPU_LITTLE_ENDIAN}" = "xy" \
44260e065f7SMichael Ellerman	    && $(LD) --version | head -1 | grep ' 2\.24$$' >/dev/null ; then \
44360e065f7SMichael Ellerman		echo -n '*** binutils 2.24 miscompiles weak symbols ' ; \
44460e065f7SMichael Ellerman		echo 'in some circumstances.' ; \
44560e065f7SMichael Ellerman		echo -n '*** Please use a different binutils version.' ; \
44660e065f7SMichael Ellerman		false ; \
44760e065f7SMichael Ellerman	fi
44860e065f7SMichael Ellerman
44914cf11afSPaul Mackerras
45014cf11afSPaul MackerrasCLEAN_FILES += $(TOUT)
45114cf11afSPaul Mackerras
452