blob: a55a82d145d4c14a8a0f5c5d30a92e218b26d4fd [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001# This file is included by the global makefile so that you can add your own
2# architecture-specific flags and dependencies. Remember to do have actions
3# for "archclean" and "archdep" for cleaning up and making dependencies for
4# this architecture
5#
6# This file is subject to the terms and conditions of the GNU General Public
7# License. See the file "COPYING" in the main directory of this archive
8# for more details.
9#
10# Copyright (C) 1994 by Linus Torvalds
11# Changes for PPC by Gary Thomas
12# Rewritten by Cort Dougan and Paul Mackerras
13# Adjusted for PPC64 by Tom Gall
14#
15
16KERNELLOAD := 0xc000000000000000
17
18# Set default 32 bits cross compilers for vdso and boot wrapper
19CROSS32_COMPILE ?=
20
21CROSS32CC := $(CROSS32_COMPILE)gcc
22CROSS32AS := $(CROSS32_COMPILE)as
23CROSS32LD := $(CROSS32_COMPILE)ld
24CROSS32OBJCOPY := $(CROSS32_COMPILE)objcopy
25
26# If we have a biarch compiler, use it for 32 bits cross compile if
27# CROSS32_COMPILE wasn't explicitely defined, and add proper explicit
28# target type to target compilers
29
30HAS_BIARCH := $(call cc-option-yn, -m64)
31ifeq ($(HAS_BIARCH),y)
32ifeq ($(CROSS32_COMPILE),)
33CROSS32CC := $(CC) -m32
34CROSS32AS := $(AS) -a32
35CROSS32LD := $(LD) -m elf32ppc
36CROSS32OBJCOPY := $(OBJCOPY)
37endif
Sven Luther723e2b32005-06-21 17:15:32 -070038override AS += -a64
39override LD += -m elf64ppc
40override CC += -m64
Linus Torvalds1da177e2005-04-16 15:20:36 -070041endif
42
43export CROSS32CC CROSS32AS CROSS32LD CROSS32OBJCOPY
44
45new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi)
46
47ifeq ($(new_nm),y)
48NM := $(NM) --synthetic
49
50endif
51
viro@ZenIV.linux.org.uk3352ae52005-09-07 23:28:32 +010052CHECKFLAGS += -m64 -D__powerpc__ -D__powerpc64__
Linus Torvalds1da177e2005-04-16 15:20:36 -070053
54LDFLAGS := -m elf64ppc
55LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
56CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none \
57 -mcall-aixdesc
Stephen Rothwell45e2a6e2005-08-29 13:15:50 +100058# Temporary hack until we have migrated to asm-powerpc
Stephen Rothwellb35b7072005-09-11 00:00:14 +100059CPPFLAGS += -Iarch/$(ARCH)/include
Linus Torvalds1da177e2005-04-16 15:20:36 -070060
Benjamin Herrenschmidt52292c92005-05-03 15:34:58 +100061GCC_VERSION := $(call cc-version)
62GCC_BROKEN_VEC := $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi ;)
63
Linus Torvalds1da177e2005-04-16 15:20:36 -070064ifeq ($(CONFIG_POWER4_ONLY),y)
65ifeq ($(CONFIG_ALTIVEC),y)
Benjamin Herrenschmidt52292c92005-05-03 15:34:58 +100066ifeq ($(GCC_BROKEN_VEC),y)
Linus Torvalds1da177e2005-04-16 15:20:36 -070067 CFLAGS += $(call cc-option,-mcpu=970)
68else
69 CFLAGS += $(call cc-option,-mcpu=power4)
70endif
71else
Benjamin Herrenschmidt52292c92005-05-03 15:34:58 +100072 CFLAGS += $(call cc-option,-mcpu=power4)
73endif
74else
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 CFLAGS += $(call cc-option,-mtune=power4)
76endif
77
Lee Nicks9e3699e2005-10-28 17:46:09 -070078# No AltiVec instruction when building kernel
79CFLAGS += $(call cc-option, -mno-altivec)
80
Linus Torvalds1da177e2005-04-16 15:20:36 -070081# Enable unit-at-a-time mode when possible. It shrinks the
82# kernel considerably.
83CFLAGS += $(call cc-option,-funit-at-a-time)
84
85head-y := arch/ppc64/kernel/head.o
David Gibson25c8a782005-10-27 16:27:25 +100086head-y += arch/powerpc/kernel/fpu.o
Stephen Rothwell640768e2005-10-28 12:51:45 +100087head-y += arch/powerpc/kernel/entry_64.o
Linus Torvalds1da177e2005-04-16 15:20:36 -070088
Stephen Rothwellbd142b72005-09-30 13:51:25 +100089core-y += arch/ppc64/kernel/ arch/powerpc/kernel/
Paul Mackerrasab1f9da2005-10-10 21:58:35 +100090core-y += arch/powerpc/mm/
Paul Mackerrasd85b5252005-10-20 21:06:44 +100091core-y += arch/powerpc/sysdev/
Stephen Rothwellba0dd612005-09-23 13:15:51 +100092core-y += arch/powerpc/platforms/
Stephen Rothwell1a3c0612005-10-27 16:25:05 +100093core-y += arch/powerpc/lib/
Paul Mackerrasf78541d2005-10-28 22:53:37 +100094core-$(CONFIG_XMON) += arch/powerpc/xmon/
Stephen Rothwell86a5cdd2005-09-19 23:24:08 +100095drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
Linus Torvalds1da177e2005-04-16 15:20:36 -070096
97boot := arch/ppc64/boot
98
Geoff Levanda24c8482005-08-15 13:59:13 -070099boottargets-$(CONFIG_PPC_PSERIES) += zImage zImage.initrd
100boottargets-$(CONFIG_PPC_PMAC) += zImage.vmode zImage.initrd.vmode
101boottargets-$(CONFIG_PPC_MAPLE) += zImage zImage.initrd
102boottargets-$(CONFIG_PPC_ISERIES) += vmlinux.sminitrd vmlinux.initrd vmlinux.sm
103boottargets-$(CONFIG_PPC_BPA) += zImage zImage.initrd
104$(boottargets-y): vmlinux
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
106
107bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage
108bootimage-$(CONFIG_PPC_PMAC) := vmlinux
109bootimage-$(CONFIG_PPC_MAPLE) := $(boot)/zImage
Olaf Hering1eee4da2005-10-28 17:46:55 -0700110bootimage-$(CONFIG_PPC_BPA) := $(boot)/zImage
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111bootimage-$(CONFIG_PPC_ISERIES) := vmlinux
112BOOTIMAGE := $(bootimage-y)
113install: vmlinux
114 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@
115
116defaultimage-$(CONFIG_PPC_PSERIES) := zImage
Benjamin Herrenschmidt40da47e2005-09-21 09:55:34 -0700117defaultimage-$(CONFIG_PPC_PMAC) := zImage.vmode
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118defaultimage-$(CONFIG_PPC_MAPLE) := zImage
119defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
120KBUILD_IMAGE := $(defaultimage-y)
121all: $(KBUILD_IMAGE)
122
123archclean:
124 $(Q)$(MAKE) $(clean)=$(boot)
Stephen Rothwellb35b7072005-09-11 00:00:14 +1000125 # Temporary hack until we have migrated to asm-powerpc
126 $(Q)rm -rf arch/$(ARCH)/include
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128
Stephen Rothwell45e2a6e2005-08-29 13:15:50 +1000129# Temporary hack until we have migrated to asm-powerpc
Stephen Rothwellb35b7072005-09-11 00:00:14 +1000130include/asm: arch/$(ARCH)/include/asm
131arch/$(ARCH)/include/asm:
132 $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
133 $(Q)ln -fsn $(srctree)/include/asm-powerpc arch/$(ARCH)/include/asm
Stephen Rothwell45e2a6e2005-08-29 13:15:50 +1000134
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135define archhelp
Geoff Levanda24c8482005-08-15 13:59:13 -0700136 echo ' zImage.vmode - Compressed kernel image (arch/$(ARCH)/boot/zImage.vmode)'
137 echo ' zImage.initrd.vmode - Compressed kernel image with initrd attached,'
138 echo ' sourced from arch/$(ARCH)/boot/ramdisk.image.gz'
139 echo ' (arch/$(ARCH)/boot/zImage.initrd.vmode)'
140 echo ' zImage - zImage for pSeries machines'
141 echo ' zImage.initrd - zImage with initrd for pSeries machines'
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142endef