xref: /linux/arch/powerpc/Makefile (revision 43c9127d94d62a232ed33ed2eab8a08657ce5472)
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
26*43c9127dSNicholas PigginKBUILD_ARFLAGS	+= --target=elf32-powerpc
2714cf11afSPaul Mackerrasendif
2814cf11afSPaul Mackerrasendif
2914cf11afSPaul Mackerras
301976aef9SSegher Boessenkoolexport CROSS32CC CROSS32AR
3114cf11afSPaul Mackerras
32ca786f83SAdrian Bunkifeq ($(CROSS_COMPILE),)
338a5abdf8SPaul MackerrasKBUILD_DEFCONFIG := $(shell uname -m)_defconfig
34ca786f83SAdrian Bunkelse
35ca786f83SAdrian BunkKBUILD_DEFCONFIG := ppc64_defconfig
36ca786f83SAdrian Bunkendif
378a5abdf8SPaul Mackerras
3894b212c2SPaul Mackerrasifeq ($(CONFIG_PPC64),y)
3914cf11afSPaul Mackerrasnew_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi)
4014cf11afSPaul Mackerras
4114cf11afSPaul Mackerrasifeq ($(new_nm),y)
4214cf11afSPaul MackerrasNM		:= $(NM) --synthetic
4314cf11afSPaul Mackerrasendif
44a0588015SAnton Blanchardendif
4514cf11afSPaul Mackerras
4668201fbbSMichael Ellerman# BITS is used as extension for files which are available in a 32 bit
4768201fbbSMichael Ellerman# and a 64 bit version to simplify shared Makefiles.
4868201fbbSMichael Ellerman# e.g.: obj-y += foo_$(BITS).o
4968201fbbSMichael Ellermanexport BITS
5068201fbbSMichael Ellerman
5168201fbbSMichael Ellermanifdef CONFIG_PPC64
5268201fbbSMichael Ellerman        BITS := 64
5368201fbbSMichael Ellermanelse
5468201fbbSMichael Ellerman        BITS := 32
5514cf11afSPaul Mackerrasendif
5614cf11afSPaul Mackerras
5757073e27SMichael Ellermanmachine-y = ppc
5857073e27SMichael Ellermanmachine-$(CONFIG_PPC64) += 64
5957073e27SMichael Ellermanmachine-$(CONFIG_CPU_LITTLE_ENDIAN) += le
6057073e27SMichael EllermanUTS_MACHINE := $(subst $(space),,$(machine-y))
61190554dbSStephen Rothwell
62d72b0801SIan Munsieifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
63d72b0801SIan Munsieoverride LD	+= -EL
64d72b0801SIan MunsieLDEMULATION	:= lppc
65d72b0801SIan MunsieGNUTARGET	:= powerpcle
66d72b0801SIan MunsieMULTIPLEWORD	:= -mno-multiple
67d3d35d95STony BreedsKBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect)
68d72b0801SIan Munsieelse
69d72b0801SIan Munsieoverride LD	+= -EB
70d72b0801SIan MunsieLDEMULATION	:= ppc
71d72b0801SIan MunsieGNUTARGET	:= powerpc
72d72b0801SIan MunsieMULTIPLEWORD	:= -mmultiple
73d72b0801SIan Munsieendif
74d72b0801SIan Munsie
75164af597SMichael Ellermancflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
76164af597SMichael Ellermancflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
77164af597SMichael Ellermanifneq ($(cc-name),clang)
78164af597SMichael Ellerman  cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mno-strict-align
79164af597SMichael Ellermanendif
80164af597SMichael Ellerman
81164af597SMichael Ellermanaflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
82164af597SMichael Ellermanaflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
83164af597SMichael Ellerman
8414cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y)
8568201fbbSMichael Ellermanoverride AS	+= -a$(BITS)
8668201fbbSMichael Ellermanoverride LD	+= -m elf$(BITS)$(LDEMULATION)
8768201fbbSMichael Ellermanoverride CC	+= -m$(BITS)
88*43c9127dSNicholas PigginKBUILD_ARFLAGS	+= --target=elf$(BITS)-$(GNUTARGET)
8914cf11afSPaul Mackerrasendif
9014cf11afSPaul Mackerras
919c5f7d39SSuzuki PouloseLDFLAGS_vmlinux-y := -Bstatic
929c5f7d39SSuzuki PouloseLDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
939c5f7d39SSuzuki PouloseLDFLAGS_vmlinux	:= $(LDFLAGS_vmlinux-y)
9414cf11afSPaul Mackerras
951fbe9cf2SAnton Blanchardifeq ($(CONFIG_PPC64),y)
961fbe9cf2SAnton Blanchardifeq ($(call cc-option-yn,-mcmodel=medium),y)
971fbe9cf2SAnton Blanchard	# -mcmodel=medium breaks modules because it uses 32bit offsets from
981fbe9cf2SAnton Blanchard	# the TOC pointer to create pointers where possible. Pointers into the
991fbe9cf2SAnton Blanchard	# percpu data area are created by this method.
1001fbe9cf2SAnton Blanchard	#
1011fbe9cf2SAnton Blanchard	# The kernel module loader relocates the percpu data section from the
1021fbe9cf2SAnton Blanchard	# original location (starting with 0xd...) to somewhere in the base
1031fbe9cf2SAnton Blanchard	# kernel percpu data space (starting with 0xc...). We need a full
1041fbe9cf2SAnton Blanchard	# 64bit relocation for this to work, hence -mcmodel=large.
1051fbe9cf2SAnton Blanchard	KBUILD_CFLAGS_MODULE += -mcmodel=large
1061fbe9cf2SAnton Blanchardelse
1071fbe9cf2SAnton Blanchard	export NO_MINIMAL_TOC := -mno-minimal-toc
1081fbe9cf2SAnton Blanchardendif
1091fbe9cf2SAnton Blanchardendif
1101fbe9cf2SAnton Blanchard
111a50a862eSAnton BlanchardCFLAGS-$(CONFIG_PPC64)	:= $(call cc-option,-mtraceback=no)
112721aeaa9SAnton Blanchardifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
113238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc))
114721aeaa9SAnton BlanchardAFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2)
115721aeaa9SAnton Blanchardelse
116238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcall-aixdesc)
117721aeaa9SAnton Blanchardendif
118238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc))
11998679fb0SAnton BlanchardCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mno-pointers-to-nested-functions)
120d72b0801SIan MunsieCFLAGS-$(CONFIG_PPC32)	:= -ffixed-r2 $(MULTIPLEWORD)
121d23c6fb4SAnton Blanchard
12201718ba6SScott Woodifeq ($(CONFIG_PPC_BOOK3S_64),y)
123d23c6fb4SAnton BlanchardCFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,-mtune=power4)
1243a849815SMichael EllermanCFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power4
12501718ba6SScott Woodelse
12601718ba6SScott WoodCFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
12701718ba6SScott Woodendif
12801718ba6SScott Wood
1298c50b72aSTorsten Duweifdef CONFIG_MPROFILE_KERNEL
1308c50b72aSTorsten Duwe    ifeq ($(shell $(srctree)/arch/powerpc/scripts/gcc-check-mprofile-kernel.sh $(CC) -I$(srctree)/include -D__KERNEL__),OK)
1318c50b72aSTorsten Duwe        CC_FLAGS_FTRACE := -pg -mprofile-kernel
1328c50b72aSTorsten Duwe        KBUILD_CPPFLAGS += -DCC_USING_MPROFILE_KERNEL
1338c50b72aSTorsten Duwe    else
1348c50b72aSTorsten Duwe        # If the user asked for mprofile-kernel but the toolchain doesn't
1358c50b72aSTorsten Duwe        # support it, emit a warning and deliberately break the build later
1368c50b72aSTorsten Duwe        # with mprofile-kernel-not-supported. We would prefer to make this an
1378c50b72aSTorsten Duwe        # error right here, but then the user would never be able to run
1388c50b72aSTorsten Duwe        # oldconfig to change their configuration.
1398c50b72aSTorsten Duwe        $(warning Compiler does not support mprofile-kernel, set CONFIG_DISABLE_MPROFILE_KERNEL)
1408c50b72aSTorsten Duwe        CC_FLAGS_FTRACE := -mprofile-kernel-not-supported
1418c50b72aSTorsten Duwe    endif
1428c50b72aSTorsten Duweendif
1438c50b72aSTorsten Duwe
144d23c6fb4SAnton BlanchardCFLAGS-$(CONFIG_CELL_CPU) += $(call cc-option,-mcpu=cell)
145d23c6fb4SAnton BlanchardCFLAGS-$(CONFIG_POWER4_CPU) += $(call cc-option,-mcpu=power4)
146d23c6fb4SAnton BlanchardCFLAGS-$(CONFIG_POWER5_CPU) += $(call cc-option,-mcpu=power5)
147d23c6fb4SAnton BlanchardCFLAGS-$(CONFIG_POWER6_CPU) += $(call cc-option,-mcpu=power6)
148d23c6fb4SAnton BlanchardCFLAGS-$(CONFIG_POWER7_CPU) += $(call cc-option,-mcpu=power7)
149ff2e466aSAnton BlanchardCFLAGS-$(CONFIG_POWER8_CPU) += $(call cc-option,-mcpu=power8)
150d23c6fb4SAnton Blanchard
151cbf8a358STiejun Chen# Altivec option not allowed with e500mc64 in GCC.
152cbf8a358STiejun Chenifeq ($(CONFIG_ALTIVEC),y)
153cbf8a358STiejun ChenE5500_CPU := -mcpu=powerpc64
154cbf8a358STiejun Chenelse
15501718ba6SScott WoodE5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
156cbf8a358STiejun Chenendif
15701718ba6SScott WoodCFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
15801718ba6SScott WoodCFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
15901718ba6SScott Wood
160847f56b0SScott Woodifeq ($(CONFIG_PPC32),y)
161847f56b0SScott Woodifeq ($(CONFIG_PPC_E500MC),y)
162847f56b0SScott WoodCFLAGS-y += $(call cc-option,-mcpu=e500mc,-mcpu=powerpc)
163847f56b0SScott Woodelse
164847f56b0SScott WoodCFLAGS-$(CONFIG_E500) += $(call cc-option,-mcpu=8540 -msoft-float,-mcpu=powerpc)
165847f56b0SScott Woodendif
166847f56b0SScott Woodendif
167847f56b0SScott Wood
1687998eb3dSGuenter Roeckasinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
1697998eb3dSGuenter Roeck
1707998eb3dSGuenter RoeckKBUILD_CPPFLAGS	+= -Iarch/$(ARCH) $(asinstr)
17158aedccbSAnton BlanchardKBUILD_AFLAGS	+= -Iarch/$(ARCH) $(AFLAGS-y)
172a50a862eSAnton BlanchardKBUILD_CFLAGS	+= $(call cc-option,-msoft-float)
173a50a862eSAnton BlanchardKBUILD_CFLAGS	+= -pipe -Iarch/$(ARCH) $(CFLAGS-y)
174a0f97e06SSam RavnborgCPP		= $(CC) -E $(KBUILD_CFLAGS)
17514cf11afSPaul Mackerras
17668201fbbSMichael EllermanCHECKFLAGS	+= -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__
17762c2c5cfSDaniel Axtensifdef CONFIG_CPU_BIG_ENDIAN
17862c2c5cfSDaniel AxtensCHECKFLAGS	+= -D__BIG_ENDIAN__
17962c2c5cfSDaniel Axtenselse
18062c2c5cfSDaniel AxtensCHECKFLAGS	+= -D__LITTLE_ENDIAN__
18162c2c5cfSDaniel Axtensendif
18214cf11afSPaul Mackerras
183772320e8SMichal MarekKBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
1847fca5dc8SStephen Rothwell
185d5b35cffSAlistair Poppleifeq ($(CONFIG_476FPE_ERR46),y)
186d5b35cffSAlistair Popple	KBUILD_LDFLAGS_MODULE += --ppc476-workaround \
187d5b35cffSAlistair Popple		-T $(srctree)/arch/powerpc/platforms/44x/ppc476_modules.lds
188d5b35cffSAlistair Poppleendif
189d5b35cffSAlistair Popple
190d23c6fb4SAnton Blanchard# No AltiVec or VSX instructions when building kernel
191a0f97e06SSam RavnborgKBUILD_CFLAGS += $(call cc-option,-mno-altivec)
192d23c6fb4SAnton BlanchardKBUILD_CFLAGS += $(call cc-option,-mno-vsx)
193d3f67fbbSPaul Mackerras
1940197cd2eSKumar Gala# No SPE instruction when building kernel
195ce400c01SThiemo Seufer# (We use all available options to help semi-broken compilers)
1960197cd2eSKumar GalaKBUILD_CFLAGS += $(call cc-option,-mno-spe)
197ce400c01SThiemo SeuferKBUILD_CFLAGS += $(call cc-option,-mspe=no)
1980197cd2eSKumar Gala
19914cf11afSPaul Mackerras# Enable unit-at-a-time mode when possible. It shrinks the
20014cf11afSPaul Mackerras# kernel considerably.
201a0f97e06SSam RavnborgKBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)
20214cf11afSPaul Mackerras
203d0679c73SAndi Kleen# FIXME: the module load should be taught about the additional relocs
204d0679c73SAndi Kleen# generated by this.
205d0679c73SAndi Kleen# revert to pre-gcc-4.4 behaviour of .eh_frame
206d0679c73SAndi KleenKBUILD_CFLAGS	+= $(call cc-option,-fno-dwarf2-cfi-asm)
207d0679c73SAndi Kleen
20857647a4dSBenjamin Herrenschmidt# Never use string load/store instructions as they are
20957647a4dSBenjamin Herrenschmidt# often slow when they are implemented at all
210a50a862eSAnton BlanchardKBUILD_CFLAGS		+= $(call cc-option,-mno-string)
21114cf11afSPaul Mackerras
212f48b8296SOlaf Heringifeq ($(CONFIG_6xx),y)
213a0f97e06SSam RavnborgKBUILD_CFLAGS		+= -mcpu=powerpc
214f48b8296SOlaf Heringendif
215f48b8296SOlaf Hering
2167563dc64STony Breeds# Work around a gcc code-gen bug with -fno-omit-frame-pointer.
217606576ceSSteven Rostedtifeq ($(CONFIG_FUNCTION_TRACER),y)
2187563dc64STony BreedsKBUILD_CFLAGS		+= -mno-sched-epilog
2197563dc64STony Breedsendif
2207563dc64STony Breeds
22114cf11afSPaul Mackerrascpu-as-$(CONFIG_4xx)		+= -Wa,-m405
2229ddf0075SAnton Blanchardcpu-as-$(CONFIG_ALTIVEC)	+= $(call as-option,-Wa$(comma)-maltivec)
22314cf11afSPaul Mackerrascpu-as-$(CONFIG_E200)		+= -Wa,-me200
22414cf11afSPaul Mackerras
225222d394dSSam RavnborgKBUILD_AFLAGS += $(cpu-as-y)
226a0f97e06SSam RavnborgKBUILD_CFLAGS += $(cpu-as-y)
22714cf11afSPaul Mackerras
228164af597SMichael EllermanKBUILD_AFLAGS += $(aflags-y)
229164af597SMichael EllermanKBUILD_CFLAGS += $(cflags-y)
230164af597SMichael Ellerman
23168201fbbSMichael Ellermanhead-y				:= arch/powerpc/kernel/head_$(BITS).o
23214cf11afSPaul Mackerrashead-$(CONFIG_8xx)		:= arch/powerpc/kernel/head_8xx.o
23315f6527eSJosh Boyerhead-$(CONFIG_40x)		:= arch/powerpc/kernel/head_40x.o
23414cf11afSPaul Mackerrashead-$(CONFIG_44x)		:= arch/powerpc/kernel/head_44x.o
23514cf11afSPaul Mackerrashead-$(CONFIG_FSL_BOOKE)	:= arch/powerpc/kernel/head_fsl_booke.o
23614cf11afSPaul Mackerras
2379994a338SPaul Mackerrashead-$(CONFIG_PPC64)		+= arch/powerpc/kernel/entry_64.o
23814cf11afSPaul Mackerrashead-$(CONFIG_PPC_FPU)		+= arch/powerpc/kernel/fpu.o
239e821ea70SBenjamin Herrenschmidthead-$(CONFIG_ALTIVEC)		+= arch/powerpc/kernel/vector.o
2405ac47f7aSAnton Blanchardhead-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE)  += arch/powerpc/kernel/prom_init.o
24114cf11afSPaul Mackerras
242daec962eSPaul Mackerrascore-y				+= arch/powerpc/kernel/ \
243daec962eSPaul Mackerras				   arch/powerpc/mm/ \
244daec962eSPaul Mackerras				   arch/powerpc/lib/ \
245daec962eSPaul Mackerras				   arch/powerpc/sysdev/ \
2461a3d1fc2SLiu Yu				   arch/powerpc/platforms/ \
2470ca87f05SMatt Evans				   arch/powerpc/math-emu/ \
248323a6bf1SMichael Ellerman				   arch/powerpc/crypto/ \
2490ca87f05SMatt Evans				   arch/powerpc/net/
250f78541dcSPaul Mackerrascore-$(CONFIG_XMON)		+= arch/powerpc/xmon/
251bbf45ba5SHollis Blanchardcore-$(CONFIG_KVM) 		+= arch/powerpc/kvm/
252f2699491SMichael Ellermancore-$(CONFIG_PERF_EVENTS)	+= arch/powerpc/perf/
25314cf11afSPaul Mackerras
25414cf11afSPaul Mackerrasdrivers-$(CONFIG_OPROFILE)	+= arch/powerpc/oprofile/
25514cf11afSPaul Mackerras
256135f0b17STom Rini# Default to zImage, override when needed
25725431333SGrant Likelyall: zImage
25814cf11afSPaul Mackerras
259e32e78c5SSam Ravnborg# With make 3.82 we cannot mix normal and wildcard targets
260c686ecf5SAnatolij GustschinBOOT_TARGETS1 := zImage zImage.initrd uImage
26111eab297SBenjamin HerrenschmidtBOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.% uImage.%
262cabb5587SStephen Rothwell
263e32e78c5SSam RavnborgPHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2)
264cabb5587SStephen Rothwell
26594b212c2SPaul Mackerrasboot := arch/$(ARCH)/boot
26614cf11afSPaul Mackerras
267144ef909STony Breedsifeq ($(CONFIG_RELOCATABLE),y)
268144ef909STony Breedsquiet_cmd_relocs_check = CALL    $<
269a71aa05eSStephen Rothwell      cmd_relocs_check = $(CONFIG_SHELL) $< "$(OBJDUMP)" "$(obj)/vmlinux"
270144ef909STony Breeds
271144ef909STony BreedsPHONY += relocs_check
272a71aa05eSStephen Rothwellrelocs_check: arch/powerpc/relocs_check.sh vmlinux
273144ef909STony Breeds	$(call cmd,relocs_check)
274144ef909STony Breeds
275144ef909STony BreedszImage: relocs_check
276144ef909STony Breedsendif
277144ef909STony Breeds
278e32e78c5SSam Ravnborg$(BOOT_TARGETS1): vmlinux
279e32e78c5SSam Ravnborg	$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
280e32e78c5SSam Ravnborg$(BOOT_TARGETS2): vmlinux
28120f62954SPaul Mackerras	$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
28214cf11afSPaul Mackerras
283e32e78c5SSam Ravnborg
284e32e78c5SSam Ravnborgbootwrapper_install:
285e32e78c5SSam Ravnborg	$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
286e32e78c5SSam Ravnborg
2878662d0bcSMatthew McClintock%.dtb: scripts
288773f76b1SDavid Woodhouse	$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
289773f76b1SDavid Woodhouse
290ea4d1a87SCyril Bur# Used to create 'merged defconfigs'
291ea4d1a87SCyril Bur# To use it $(call) it with the first argument as the base defconfig
292ea4d1a87SCyril Bur# and the second argument as a space separated list of .config files to merge,
293ea4d1a87SCyril Bur# without the .config suffix.
294ea4d1a87SCyril Burdefine merge_into_defconfig
295ea4d1a87SCyril Bur	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
296ea4d1a87SCyril Bur		-m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \
297ea4d1a87SCyril Bur		$(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config)
298ea4d1a87SCyril Bur	+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
299ea4d1a87SCyril Burendef
300ea4d1a87SCyril Bur
301ea4d1a87SCyril BurPHONY += pseries_le_defconfig
302ea4d1a87SCyril Burpseries_le_defconfig:
303ea4d1a87SCyril Bur	$(call merge_into_defconfig,pseries_defconfig,le)
304ea4d1a87SCyril Bur
3052adc48a6SMichael EllermanPHONY += ppc64le_defconfig
3062adc48a6SMichael Ellermanppc64le_defconfig:
3072adc48a6SMichael Ellerman	$(call merge_into_defconfig,ppc64_defconfig,le)
3082adc48a6SMichael Ellerman
30944d54014SScott WoodPHONY += mpc85xx_defconfig
31044d54014SScott Woodmpc85xx_defconfig:
31144d54014SScott Wood	$(call merge_into_defconfig,mpc85xx_basic_defconfig,\
31244d54014SScott Wood		85xx-32bit 85xx-hw fsl-emb-nonhw)
31344d54014SScott Wood
31444d54014SScott WoodPHONY += mpc85xx_smp_defconfig
31544d54014SScott Woodmpc85xx_smp_defconfig:
31644d54014SScott Wood	$(call merge_into_defconfig,mpc85xx_basic_defconfig,\
31744d54014SScott Wood		85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw)
31844d54014SScott Wood
31944d54014SScott WoodPHONY += corenet32_smp_defconfig
32044d54014SScott Woodcorenet32_smp_defconfig:
32144d54014SScott Wood	$(call merge_into_defconfig,corenet_basic_defconfig,\
322e0b80f00SClaudiu Manoil		85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw dpaa)
32344d54014SScott Wood
32444d54014SScott WoodPHONY += corenet64_smp_defconfig
32544d54014SScott Woodcorenet64_smp_defconfig:
32644d54014SScott Wood	$(call merge_into_defconfig,corenet_basic_defconfig,\
327e0b80f00SClaudiu Manoil		85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw dpaa)
32844d54014SScott Wood
32943de32c5SAlessio Igor BoganiPHONY += mpc86xx_defconfig
33043de32c5SAlessio Igor Boganimpc86xx_defconfig:
33143de32c5SAlessio Igor Bogani	$(call merge_into_defconfig,mpc86xx_basic_defconfig,\
33243de32c5SAlessio Igor Bogani		86xx-hw fsl-emb-nonhw)
33343de32c5SAlessio Igor Bogani
33443de32c5SAlessio Igor BoganiPHONY += mpc86xx_smp_defconfig
33543de32c5SAlessio Igor Boganimpc86xx_smp_defconfig:
33643de32c5SAlessio Igor Bogani	$(call merge_into_defconfig,mpc86xx_basic_defconfig,\
33743de32c5SAlessio Igor Bogani		86xx-smp 86xx-hw fsl-emb-nonhw)
33843de32c5SAlessio Igor Bogani
33914cf11afSPaul Mackerrasdefine archhelp
34070bf0333SGrant Likely  @echo '* zImage          - Build default images selected by kernel config'
34170bf0333SGrant Likely  @echo '  zImage.*        - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)'
34270bf0333SGrant Likely  @echo '  uImage          - U-Boot native image format'
34370bf0333SGrant Likely  @echo '  cuImage.<dt>    - Backwards compatible U-Boot image for older'
34470bf0333SGrant Likely  @echo '                    versions which do not support device trees'
34570bf0333SGrant Likely  @echo '  dtbImage.<dt>   - zImage with an embedded device tree blob'
34670bf0333SGrant Likely  @echo '  simpleImage.<dt> - Firmware independent image.'
34770bf0333SGrant Likely  @echo '  treeImage.<dt>  - Support for older IBM 4xx firmware (not U-Boot)'
34814cf11afSPaul Mackerras  @echo '  install         - Install kernel using'
349caa27b66SSam Ravnborg  @echo '                    (your) ~/bin/$(INSTALLKERNEL) or'
350caa27b66SSam Ravnborg  @echo '                    (distribution) /sbin/$(INSTALLKERNEL) or'
35114cf11afSPaul Mackerras  @echo '                    install to $$(INSTALL_PATH) and run lilo'
352437a58dbSPaul Mackerras  @echo '  *_defconfig     - Select default config from arch/$(ARCH)/configs'
35370bf0333SGrant Likely  @echo ''
35470bf0333SGrant Likely  @echo '  Targets with <dt> embed a device tree blob inside the image'
35570bf0333SGrant Likely  @echo '  These targets support board with firmware that does not'
35670bf0333SGrant Likely  @echo '  support passing a device tree directly.  Replace <dt> with the'
35770bf0333SGrant Likely  @echo '  name of a dts file from the arch/$(ARCH)/boot/dts/ directory'
35870bf0333SGrant Likely  @echo '  (minus the .dts extension).'
35914cf11afSPaul Mackerrasendef
36014cf11afSPaul Mackerras
3613f85d63eSSam Ravnborginstall:
36225431333SGrant Likely	$(Q)$(MAKE) $(build)=$(boot) install
363928370c6SAkinobu Mita
3648150caadSRoland McGrathvdso_install:
3658150caadSRoland McGrathifeq ($(CONFIG_PPC64),y)
3668150caadSRoland McGrath	$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@
3678150caadSRoland McGrathendif
3688150caadSRoland McGrath	$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@
3698150caadSRoland McGrath
37014cf11afSPaul Mackerrasarchclean:
371a3a9e99eSPaul Mackerras	$(Q)$(MAKE) $(clean)=$(boot)
37270567293SAndreas Gruenbacher
37314cf11afSPaul Mackerrasarchprepare: checkbin
37414cf11afSPaul Mackerras
37514cf11afSPaul Mackerras# Use the file '.tmp_gas_check' for binutils tests, as gas won't output
37614cf11afSPaul Mackerras# to stdout and these checks are run even on install targets.
37714cf11afSPaul MackerrasTOUT	:= .tmp_gas_check
37814cf11afSPaul Mackerras
37982a85084SAnton Blanchard# Check gcc and binutils versions:
38082a85084SAnton Blanchard# - gcc-3.4 and binutils-2.14 are a fatal combination
38182a85084SAnton Blanchard# - Require gcc 4.0 or above on 64-bit
38282a85084SAnton Blanchard# - gcc-4.2.0 has issues compiling modules on 64-bit
38314cf11afSPaul Mackerrascheckbin:
3845631d9c4SMichal Marek	@if test "$(cc-name)" != "clang" \
385e79c8385SMichael Ellerman	    && test "$(cc-version)" = "0304" ; then \
38614cf11afSPaul Mackerras		if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
38714cf11afSPaul Mackerras			echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \
38814cf11afSPaul Mackerras			echo 'correctly with gcc-3.4 and your version of binutils.'; \
38914cf11afSPaul Mackerras			echo '*** Please upgrade your binutils or downgrade your gcc'; \
39014cf11afSPaul Mackerras			false; \
39114cf11afSPaul Mackerras		fi ; \
39214cf11afSPaul Mackerras	fi
3935631d9c4SMichal Marek	@if test "$(cc-name)" != "clang" \
394e79c8385SMichael Ellerman	    && test "$(cc-version)" -lt "0400" \
39582a85084SAnton Blanchard	    && test "x${CONFIG_PPC64}" = "xy" ; then \
39682a85084SAnton Blanchard                echo -n "Sorry, GCC v4.0 or above is required to build " ; \
39782a85084SAnton Blanchard                echo "the 64-bit powerpc kernel." ; \
39882a85084SAnton Blanchard                false ; \
39982a85084SAnton Blanchard        fi
4005631d9c4SMichal Marek	@if test "$(cc-name)" != "clang" \
401e79c8385SMichael Ellerman	    && test "$(cc-fullversion)" = "040200" \
402f5e83fa4SSegher Boessenkool	    && test "x${CONFIG_MODULES}${CONFIG_PPC64}" = "xyy" ; then \
403f5e83fa4SSegher Boessenkool		echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \
404f5e83fa4SSegher Boessenkool		echo 'kernel with modules enabled.' ; \
405f5e83fa4SSegher Boessenkool		echo -n '*** Please use a different GCC version or ' ; \
406f5e83fa4SSegher Boessenkool		echo 'disable kernel modules' ; \
407f5e83fa4SSegher Boessenkool		false ; \
408f5e83fa4SSegher Boessenkool	fi
40960e065f7SMichael Ellerman	@if test "x${CONFIG_CPU_LITTLE_ENDIAN}" = "xy" \
41060e065f7SMichael Ellerman	    && $(LD) --version | head -1 | grep ' 2\.24$$' >/dev/null ; then \
41160e065f7SMichael Ellerman		echo -n '*** binutils 2.24 miscompiles weak symbols ' ; \
41260e065f7SMichael Ellerman		echo 'in some circumstances.' ; \
41360e065f7SMichael Ellerman		echo -n '*** Please use a different binutils version.' ; \
41460e065f7SMichael Ellerman		false ; \
41560e065f7SMichael Ellerman	fi
41660e065f7SMichael Ellerman
41714cf11afSPaul Mackerras
41814cf11afSPaul MackerrasCLEAN_FILES += $(TOUT)
41914cf11afSPaul Mackerras
420