1# This file is included by the global makefile so that you can add your own
2# architecture-specific flags and dependencies.
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License.  See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8# Copyright (C) 1994 by Linus Torvalds
9# Changes for PPC by Gary Thomas
10# Rewritten by Cort Dougan and Paul Mackerras
11#
12
13# This must match PAGE_OFFSET in include/asm-ppc/page.h.
14KERNELLOAD	:= $(CONFIG_KERNEL_START)
15
16HAS_BIARCH	:= $(call cc-option-yn, -m32)
17ifeq ($(HAS_BIARCH),y)
18AS		:= $(AS) -a32
19LD		:= $(LD) -m elf32ppc
20CC		:= $(CC) -m32
21endif
22
23LDFLAGS_vmlinux	:= -Ttext $(KERNELLOAD) -Bstatic
24# The -Iarch/$(ARCH)/include is temporary while we are merging
25CPPFLAGS	+= -Iarch/$(ARCH) -Iarch/$(ARCH)/include
26AFLAGS		+= -Iarch/$(ARCH)
27CFLAGS		+= -Iarch/$(ARCH) -msoft-float -pipe \
28		-ffixed-r2 -mmultiple
29
30# No AltiVec instruction when building kernel
31CFLAGS		+= $(call cc-option, -mno-altivec)
32
33CPP		= $(CC) -E $(CFLAGS)
34# Temporary hack until we have migrated to asm-powerpc
35LINUXINCLUDE    += -Iarch/$(ARCH)/include
36
37CHECKFLAGS	+= -D__powerpc__
38
39ifndef CONFIG_FSL_BOOKE
40CFLAGS		+= -mstring
41endif
42
43cpu-as-$(CONFIG_4xx)		+= -Wa,-m405
44cpu-as-$(CONFIG_6xx)		+= -Wa,-maltivec
45cpu-as-$(CONFIG_E500)		+= -Wa,-me500
46cpu-as-$(CONFIG_E200)		+= -Wa,-me200
47
48AFLAGS += $(cpu-as-y)
49CFLAGS += $(cpu-as-y)
50
51# Default to the common case.
52KBUILD_DEFCONFIG := common_defconfig
53
54head-y				:= arch/ppc/kernel/head.o
55head-$(CONFIG_8xx)		:= arch/ppc/kernel/head_8xx.o
56head-$(CONFIG_4xx)		:= arch/ppc/kernel/head_4xx.o
57head-$(CONFIG_44x)		:= arch/ppc/kernel/head_44x.o
58head-$(CONFIG_FSL_BOOKE)	:= arch/ppc/kernel/head_fsl_booke.o
59
60head-$(CONFIG_PPC_FPU)		+= arch/powerpc/kernel/fpu.o
61
62core-y				+= arch/ppc/kernel/ arch/powerpc/kernel/ \
63				   arch/ppc/platforms/ \
64				   arch/ppc/mm/ arch/ppc/lib/ \
65				   arch/ppc/syslib/ arch/powerpc/sysdev/ \
66				   arch/powerpc/lib/
67core-$(CONFIG_4xx)		+= arch/ppc/platforms/4xx/
68core-$(CONFIG_83xx)		+= arch/ppc/platforms/83xx/
69core-$(CONFIG_85xx)		+= arch/ppc/platforms/85xx/
70core-$(CONFIG_MATH_EMULATION)	+= arch/powerpc/math-emu/
71core-$(CONFIG_XMON)		+= arch/ppc/xmon/
72core-$(CONFIG_APUS)		+= arch/ppc/amiga/
73drivers-$(CONFIG_8xx)		+= arch/ppc/8xx_io/
74drivers-$(CONFIG_4xx)		+= arch/ppc/4xx_io/
75drivers-$(CONFIG_CPM2)		+= arch/ppc/8260_io/
76
77drivers-$(CONFIG_OPROFILE)	+= arch/powerpc/oprofile/
78
79BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm
80
81PHONY += $(BOOT_TARGETS)
82
83all: uImage zImage
84
85CPPFLAGS_vmlinux.lds	:= -Upowerpc
86
87# All the instructions talk about "make bzImage".
88bzImage: zImage
89
90boot := arch/$(ARCH)/boot
91
92$(BOOT_TARGETS): vmlinux
93	$(Q)$(MAKE) $(build)=$(boot) $@
94
95uImage: vmlinux
96	$(Q)$(MAKE) $(build)=$(boot)/images $(boot)/images/$@
97
98define archhelp
99  @echo '* zImage          - Compressed kernel image (arch/$(ARCH)/boot/images/zImage.*)'
100  @echo '  uImage          - Create a bootable image for U-Boot / PPCBoot'
101  @echo '  install         - Install kernel using'
102  @echo '                    (your) ~/bin/installkernel or'
103  @echo '                    (distribution) /sbin/installkernel or'
104  @echo '                    install to $$(INSTALL_PATH) and run lilo'
105  @echo '  *_defconfig     - Select default config from arch/$(ARCH)/ppc/configs'
106endef
107
108archclean:
109	$(Q)$(MAKE) $(clean)=arch/ppc/boot
110	# Temporary hack until we have migrated to asm-powerpc
111	$(Q)rm -rf arch/$(ARCH)/include
112
113archprepare: checkbin
114
115# Temporary hack until we have migrated to asm-powerpc
116include/asm: arch/$(ARCH)/include/asm
117arch/$(ARCH)/include/asm:
118	$(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
119	$(Q)ln -fsn $(srctree)/include/asm-powerpc arch/$(ARCH)/include/asm
120
121# Use the file '.tmp_gas_check' for binutils tests, as gas won't output
122# to stdout and these checks are run even on install targets.
123TOUT	:= .tmp_gas_check
124# Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec
125# instructions.
126# gcc-3.4 and binutils-2.14 are a fatal combination.
127
128checkbin:
129	@if test "$(call cc-version)" = "0304" ; then \
130		if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
131			echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \
132			echo 'correctly with gcc-3.4 and your version of binutils.'; \
133			echo '*** Please upgrade your binutils or downgrade your gcc'; \
134			false; \
135		fi ; \
136	fi
137	@if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \
138		echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \
139		echo 'correctly with old versions of binutils.' ; \
140		echo '*** Please upgrade your binutils to 2.12.1 or newer' ; \
141		false ; \
142	fi
143
144CLEAN_FILES += $(TOUT)
145