xref: /linux/arch/powerpc/Makefile (revision 14cf11af6cf608eb8c23e989ddb17a715ddce109)
1*14cf11afSPaul Mackerras# This file is included by the global makefile so that you can add your own
2*14cf11afSPaul Mackerras# architecture-specific flags and dependencies. Remember to do have actions
3*14cf11afSPaul Mackerras# for "archclean" and "archdep" for cleaning up and making dependencies for
4*14cf11afSPaul Mackerras# this architecture.
5*14cf11afSPaul Mackerras#
6*14cf11afSPaul Mackerras# This file is subject to the terms and conditions of the GNU General Public
7*14cf11afSPaul Mackerras# License.  See the file "COPYING" in the main directory of this archive
8*14cf11afSPaul Mackerras# for more details.
9*14cf11afSPaul Mackerras#
10*14cf11afSPaul Mackerras# Copyright (C) 1994 by Linus Torvalds
11*14cf11afSPaul Mackerras# Changes for PPC by Gary Thomas
12*14cf11afSPaul Mackerras# Rewritten by Cort Dougan and Paul Mackerras
13*14cf11afSPaul Mackerras#
14*14cf11afSPaul Mackerras
15*14cf11afSPaul Mackerras# This must match PAGE_OFFSET in include/asm-powerpc/page.h.
16*14cf11afSPaul MackerrasKERNELLOAD	:= $(CONFIG_KERNEL_START)
17*14cf11afSPaul Mackerras
18*14cf11afSPaul MackerrasHAS_BIARCH	:= $(call cc-option-yn, -m32)
19*14cf11afSPaul Mackerras
20*14cf11afSPaul Mackerrasifeq ($(CONFIG_PPC64),y)
21*14cf11afSPaul MackerrasSZ	:= 64
22*14cf11afSPaul Mackerras
23*14cf11afSPaul Mackerras# Set default 32 bits cross compilers for vdso and boot wrapper
24*14cf11afSPaul MackerrasCROSS32_COMPILE ?=
25*14cf11afSPaul Mackerras
26*14cf11afSPaul MackerrasCROSS32CC		:= $(CROSS32_COMPILE)gcc
27*14cf11afSPaul MackerrasCROSS32AS		:= $(CROSS32_COMPILE)as
28*14cf11afSPaul MackerrasCROSS32LD		:= $(CROSS32_COMPILE)ld
29*14cf11afSPaul MackerrasCROSS32OBJCOPY		:= $(CROSS32_COMPILE)objcopy
30*14cf11afSPaul Mackerras
31*14cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y)
32*14cf11afSPaul Mackerrasifeq ($(CROSS32_COMPILE),)
33*14cf11afSPaul MackerrasCROSS32CC	:= $(CC) -m32
34*14cf11afSPaul MackerrasCROSS32AS	:= $(AS) -a32
35*14cf11afSPaul MackerrasCROSS32LD	:= $(LD) -m elf32ppc
36*14cf11afSPaul MackerrasCROSS32OBJCOPY	:= $(OBJCOPY)
37*14cf11afSPaul Mackerrasendif
38*14cf11afSPaul Mackerrasendif
39*14cf11afSPaul Mackerras
40*14cf11afSPaul Mackerrasexport CROSS32CC CROSS32AS CROSS32LD CROSS32OBJCOPY
41*14cf11afSPaul Mackerras
42*14cf11afSPaul Mackerrasnew_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi)
43*14cf11afSPaul Mackerras
44*14cf11afSPaul Mackerrasifeq ($(new_nm),y)
45*14cf11afSPaul MackerrasNM		:= $(NM) --synthetic
46*14cf11afSPaul Mackerrasendif
47*14cf11afSPaul Mackerras
48*14cf11afSPaul Mackerraselse
49*14cf11afSPaul MackerrasSZ	:= 32
50*14cf11afSPaul Mackerrasendif
51*14cf11afSPaul Mackerras
52*14cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y)
53*14cf11afSPaul Mackerrasoverride AS	+= -a$(SZ)
54*14cf11afSPaul Mackerrasoverride LD	+= -m elf$(SZ)ppc
55*14cf11afSPaul Mackerrasoverride CC	+= -m$(SZ)
56*14cf11afSPaul Mackerrasendif
57*14cf11afSPaul Mackerras
58*14cf11afSPaul MackerrasLDFLAGS_vmlinux	:= -Ttext $(KERNELLOAD) -Bstatic -e $(KERNELLOAD)
59*14cf11afSPaul Mackerras
60*14cf11afSPaul Mackerras# The -Iarch/$(ARCH)/include is temporary while we are merging
61*14cf11afSPaul MackerrasCPPFLAGS	+= -Iarch/$(ARCH) -Iarch/$(ARCH)/include
62*14cf11afSPaul MackerrasAFLAGS		+= -Iarch/$(ARCH)
63*14cf11afSPaul MackerrasCFLAGS		+= -Iarch/$(ARCH) -msoft-float -pipe
64*14cf11afSPaul Mackerrasifeq ($(CONFIG_PPC64),y)
65*14cf11afSPaul MackerrasCFLAGS		+= -mminimal-toc -mtraceback=none  -mcall-aixdesc
66*14cf11afSPaul Mackerraselse
67*14cf11afSPaul MackerrasCFLAGS		+= -ffixed-r2 -mmultiple
68*14cf11afSPaul Mackerrasendif
69*14cf11afSPaul MackerrasCPP		= $(CC) -E $(CFLAGS)
70*14cf11afSPaul Mackerras# Temporary hack until we have migrated to asm-powerpc
71*14cf11afSPaul MackerrasLINUXINCLUDE    += -Iarch/$(ARCH)/include
72*14cf11afSPaul Mackerras
73*14cf11afSPaul MackerrasCHECKFLAGS	+= -m$(SZ) -D__powerpc__ -D__powerpc$(SZ)__
74*14cf11afSPaul Mackerras
75*14cf11afSPaul Mackerrasifeq ($(CONFIG_PPC64),y)
76*14cf11afSPaul MackerrasGCC_VERSION     := $(call cc-version)
77*14cf11afSPaul MackerrasGCC_BROKEN_VEC	:= $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi)
78*14cf11afSPaul Mackerras
79*14cf11afSPaul Mackerrasifeq ($(CONFIG_POWER4_ONLY),y)
80*14cf11afSPaul Mackerrasifeq ($(CONFIG_ALTIVEC),y)
81*14cf11afSPaul Mackerrasifeq ($(GCC_BROKEN_VEC),y)
82*14cf11afSPaul Mackerras	CFLAGS += $(call cc-option,-mcpu=970)
83*14cf11afSPaul Mackerraselse
84*14cf11afSPaul Mackerras	CFLAGS += $(call cc-option,-mcpu=power4)
85*14cf11afSPaul Mackerrasendif
86*14cf11afSPaul Mackerraselse
87*14cf11afSPaul Mackerras	CFLAGS += $(call cc-option,-mcpu=power4)
88*14cf11afSPaul Mackerrasendif
89*14cf11afSPaul Mackerraselse
90*14cf11afSPaul Mackerras	CFLAGS += $(call cc-option,-mtune=power4)
91*14cf11afSPaul Mackerrasendif
92*14cf11afSPaul Mackerrasendif
93*14cf11afSPaul Mackerras
94*14cf11afSPaul Mackerras# Enable unit-at-a-time mode when possible. It shrinks the
95*14cf11afSPaul Mackerras# kernel considerably.
96*14cf11afSPaul MackerrasCFLAGS += $(call cc-option,-funit-at-a-time)
97*14cf11afSPaul Mackerras
98*14cf11afSPaul Mackerrasifndef CONFIG_FSL_BOOKE
99*14cf11afSPaul MackerrasCFLAGS		+= -mstring
100*14cf11afSPaul Mackerrasendif
101*14cf11afSPaul Mackerras
102*14cf11afSPaul Mackerrascpu-as-$(CONFIG_PPC64BRIDGE)	+= -Wa,-mppc64bridge
103*14cf11afSPaul Mackerrascpu-as-$(CONFIG_4xx)		+= -Wa,-m405
104*14cf11afSPaul Mackerrascpu-as-$(CONFIG_6xx)		+= -Wa,-maltivec
105*14cf11afSPaul Mackerrascpu-as-$(CONFIG_POWER4)		+= -Wa,-maltivec
106*14cf11afSPaul Mackerrascpu-as-$(CONFIG_E500)		+= -Wa,-me500
107*14cf11afSPaul Mackerrascpu-as-$(CONFIG_E200)		+= -Wa,-me200
108*14cf11afSPaul Mackerras
109*14cf11afSPaul MackerrasAFLAGS += $(cpu-as-y)
110*14cf11afSPaul MackerrasCFLAGS += $(cpu-as-y)
111*14cf11afSPaul Mackerras
112*14cf11afSPaul Mackerras# Default to the common case.
113*14cf11afSPaul MackerrasKBUILD_DEFCONFIG := common_defconfig
114*14cf11afSPaul Mackerras
115*14cf11afSPaul Mackerrashead-y				:= arch/powerpc/kernel/head.o
116*14cf11afSPaul Mackerrashead-$(CONFIG_PPC64)		:= arch/powerpc/kernel/head_64.o
117*14cf11afSPaul Mackerrashead-$(CONFIG_8xx)		:= arch/powerpc/kernel/head_8xx.o
118*14cf11afSPaul Mackerrashead-$(CONFIG_4xx)		:= arch/powerpc/kernel/head_4xx.o
119*14cf11afSPaul Mackerrashead-$(CONFIG_44x)		:= arch/powerpc/kernel/head_44x.o
120*14cf11afSPaul Mackerrashead-$(CONFIG_FSL_BOOKE)	:= arch/powerpc/kernel/head_fsl_booke.o
121*14cf11afSPaul Mackerras
122*14cf11afSPaul Mackerrasifeq ($(CONFIG_PPC32),y)
123*14cf11afSPaul Mackerrashead-$(CONFIG_6xx)		+= arch/powerpc/kernel/idle_6xx.o
124*14cf11afSPaul Mackerrashead-$(CONFIG_POWER4)		+= arch/powerpc/kernel/idle_power4.o
125*14cf11afSPaul Mackerrashead-$(CONFIG_PPC_FPU)		+= arch/powerpc/kernel/fpu.o
126*14cf11afSPaul Mackerrasendif
127*14cf11afSPaul Mackerras
128*14cf11afSPaul Mackerrascore-y				+= arch/powerpc/kernel/ \
129*14cf11afSPaul Mackerras				   arch/powerpc/mm/ \
130*14cf11afSPaul Mackerras				   arch/powerpc/lib/ \
131*14cf11afSPaul Mackerras				   arch/powerpc/sysdev/
132*14cf11afSPaul Mackerrascore-$(CONFIG_PPC32)		+= arch/ppc/kernel/ \
133*14cf11afSPaul Mackerras				   arch/ppc/syslib/
134*14cf11afSPaul Mackerrascore-$(CONFIG_PPC64)		+= arch/ppc64/kernel/
135*14cf11afSPaul Mackerrascore-$(CONFIG_PPC_PMAC)		+= arch/powerpc/platforms/powermac/
136*14cf11afSPaul Mackerrascore-$(CONFIG_4xx)		+= arch/ppc/platforms/4xx/
137*14cf11afSPaul Mackerrascore-$(CONFIG_83xx)		+= arch/ppc/platforms/83xx/
138*14cf11afSPaul Mackerrascore-$(CONFIG_85xx)		+= arch/ppc/platforms/85xx/
139*14cf11afSPaul Mackerrascore-$(CONFIG_MATH_EMULATION)	+= arch/ppc/math-emu/
140*14cf11afSPaul Mackerrascore-$(CONFIG_XMON)		+= arch/powerpc/xmon/
141*14cf11afSPaul Mackerrascore-$(CONFIG_APUS)		+= arch/ppc/amiga/
142*14cf11afSPaul Mackerrasdrivers-$(CONFIG_8xx)		+= arch/ppc/8xx_io/
143*14cf11afSPaul Mackerrasdrivers-$(CONFIG_4xx)		+= arch/ppc/4xx_io/
144*14cf11afSPaul Mackerrasdrivers-$(CONFIG_CPM2)		+= arch/ppc/8260_io/
145*14cf11afSPaul Mackerras
146*14cf11afSPaul Mackerrasdrivers-$(CONFIG_OPROFILE)	+= arch/powerpc/oprofile/
147*14cf11afSPaul Mackerras
148*14cf11afSPaul MackerrasBOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm
149*14cf11afSPaul Mackerras
150*14cf11afSPaul Mackerras.PHONY: $(BOOT_TARGETS)
151*14cf11afSPaul Mackerras
152*14cf11afSPaul Mackerrasall: uImage zImage
153*14cf11afSPaul Mackerras
154*14cf11afSPaul MackerrasCPPFLAGS_vmlinux.lds	:= -Upowerpc
155*14cf11afSPaul Mackerras
156*14cf11afSPaul Mackerras# All the instructions talk about "make bzImage".
157*14cf11afSPaul MackerrasbzImage: zImage
158*14cf11afSPaul Mackerras
159*14cf11afSPaul Mackerrasboot := arch/$(ARCH)/boot
160*14cf11afSPaul Mackerras
161*14cf11afSPaul Mackerras$(BOOT_TARGETS): vmlinux
162*14cf11afSPaul Mackerras	$(Q)$(MAKE) $(build)=$(boot) $@
163*14cf11afSPaul Mackerras
164*14cf11afSPaul MackerrasuImage: vmlinux
165*14cf11afSPaul Mackerras	$(Q)$(MAKE) $(build)=$(boot)/images $(boot)/images/$@
166*14cf11afSPaul Mackerras
167*14cf11afSPaul Mackerrasdefine archhelp
168*14cf11afSPaul Mackerras  @echo '* zImage          - Compressed kernel image (arch/$(ARCH)/boot/images/zImage.*)'
169*14cf11afSPaul Mackerras  @echo '  uImage          - Create a bootable image for U-Boot / PPCBoot'
170*14cf11afSPaul Mackerras  @echo '  install         - Install kernel using'
171*14cf11afSPaul Mackerras  @echo '                    (your) ~/bin/installkernel or'
172*14cf11afSPaul Mackerras  @echo '                    (distribution) /sbin/installkernel or'
173*14cf11afSPaul Mackerras  @echo '                    install to $$(INSTALL_PATH) and run lilo'
174*14cf11afSPaul Mackerras  @echo '  *_defconfig     - Select default config from arch/$(ARCH)/ppc/configs'
175*14cf11afSPaul Mackerrasendef
176*14cf11afSPaul Mackerras
177*14cf11afSPaul Mackerrasarchclean:
178*14cf11afSPaul Mackerras	$(Q)$(MAKE) $(clean)=arch/ppc/boot
179*14cf11afSPaul Mackerras	# Temporary hack until we have migrated to asm-powerpc
180*14cf11afSPaul Mackerras	$(Q)rm -rf arch/$(ARCH)/include
181*14cf11afSPaul Mackerras
182*14cf11afSPaul Mackerrasarchprepare: checkbin
183*14cf11afSPaul Mackerras
184*14cf11afSPaul Mackerras# Temporary hack until we have migrated to asm-powerpc
185*14cf11afSPaul Mackerrasifeq ($(CONFIG_PPC64),y)
186*14cf11afSPaul Mackerrasinclude/asm: arch/$(ARCH)/include/asm
187*14cf11afSPaul Mackerrasarch/$(ARCH)/include/asm:
188*14cf11afSPaul Mackerras	$(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
189*14cf11afSPaul Mackerras	$(Q)ln -fsn $(srctree)/include/asm-ppc64 arch/$(ARCH)/include/asm
190*14cf11afSPaul Mackerraselse
191*14cf11afSPaul Mackerrasinclude/asm: arch/$(ARCH)/include/asm
192*14cf11afSPaul Mackerrasarch/$(ARCH)/include/asm:
193*14cf11afSPaul Mackerras	$(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
194*14cf11afSPaul Mackerras	$(Q)ln -fsn $(srctree)/include/asm-ppc arch/$(ARCH)/include/asm
195*14cf11afSPaul Mackerrasendif
196*14cf11afSPaul Mackerras
197*14cf11afSPaul Mackerras# Use the file '.tmp_gas_check' for binutils tests, as gas won't output
198*14cf11afSPaul Mackerras# to stdout and these checks are run even on install targets.
199*14cf11afSPaul MackerrasTOUT	:= .tmp_gas_check
200*14cf11afSPaul Mackerras# Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec
201*14cf11afSPaul Mackerras# instructions.
202*14cf11afSPaul Mackerras# gcc-3.4 and binutils-2.14 are a fatal combination.
203*14cf11afSPaul MackerrasGCC_VERSION	:= $(call cc-version)
204*14cf11afSPaul Mackerras
205*14cf11afSPaul Mackerrascheckbin:
206*14cf11afSPaul Mackerras	@if test "$(GCC_VERSION)" = "0304" ; then \
207*14cf11afSPaul Mackerras		if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
208*14cf11afSPaul Mackerras			echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \
209*14cf11afSPaul Mackerras			echo 'correctly with gcc-3.4 and your version of binutils.'; \
210*14cf11afSPaul Mackerras			echo '*** Please upgrade your binutils or downgrade your gcc'; \
211*14cf11afSPaul Mackerras			false; \
212*14cf11afSPaul Mackerras		fi ; \
213*14cf11afSPaul Mackerras	fi
214*14cf11afSPaul Mackerras	@if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \
215*14cf11afSPaul Mackerras		echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \
216*14cf11afSPaul Mackerras		echo 'correctly with old versions of binutils.' ; \
217*14cf11afSPaul Mackerras		echo '*** Please upgrade your binutils to 2.12.1 or newer' ; \
218*14cf11afSPaul Mackerras		false ; \
219*14cf11afSPaul Mackerras	fi
220*14cf11afSPaul Mackerras
221*14cf11afSPaul MackerrasCLEAN_FILES += $(TOUT)
222*14cf11afSPaul Mackerras
223