blob: 731b84758331bfc5fc790554265b8bf9a4eb8557 [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
52CHECKFLAGS += -m64 -D__powerpc__
53
54LDFLAGS := -m elf64ppc
55LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
56CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none \
57 -mcall-aixdesc
58
Benjamin Herrenschmidt52292c92005-05-03 15:34:58 +100059GCC_VERSION := $(call cc-version)
60GCC_BROKEN_VEC := $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi ;)
61
Linus Torvalds1da177e2005-04-16 15:20:36 -070062ifeq ($(CONFIG_POWER4_ONLY),y)
63ifeq ($(CONFIG_ALTIVEC),y)
Benjamin Herrenschmidt52292c92005-05-03 15:34:58 +100064ifeq ($(GCC_BROKEN_VEC),y)
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 CFLAGS += $(call cc-option,-mcpu=970)
66else
67 CFLAGS += $(call cc-option,-mcpu=power4)
68endif
69else
Benjamin Herrenschmidt52292c92005-05-03 15:34:58 +100070 CFLAGS += $(call cc-option,-mcpu=power4)
71endif
72else
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 CFLAGS += $(call cc-option,-mtune=power4)
74endif
75
76# Enable unit-at-a-time mode when possible. It shrinks the
77# kernel considerably.
78CFLAGS += $(call cc-option,-funit-at-a-time)
79
80head-y := arch/ppc64/kernel/head.o
81
82libs-y += arch/ppc64/lib/
83core-y += arch/ppc64/kernel/
84core-y += arch/ppc64/mm/
85core-$(CONFIG_XMON) += arch/ppc64/xmon/
86drivers-$(CONFIG_OPROFILE) += arch/ppc64/oprofile/
87
88boot := arch/ppc64/boot
89
90boottarget-$(CONFIG_PPC_PSERIES) := zImage zImage.initrd
91boottarget-$(CONFIG_PPC_MAPLE) := zImage zImage.initrd
92boottarget-$(CONFIG_PPC_ISERIES) := vmlinux.sminitrd vmlinux.initrd vmlinux.sm
Arnd Bergmannfef1c772005-06-23 09:43:37 +100093boottarget-$(CONFIG_PPC_BPA) := zImage zImage.initrd
Linus Torvalds1da177e2005-04-16 15:20:36 -070094$(boottarget-y): vmlinux
95 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
96
97bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage
98bootimage-$(CONFIG_PPC_PMAC) := vmlinux
99bootimage-$(CONFIG_PPC_MAPLE) := $(boot)/zImage
Arnd Bergmannfef1c772005-06-23 09:43:37 +1000100bootimage-$(CONFIG_PPC_BPA) := zImage
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101bootimage-$(CONFIG_PPC_ISERIES) := vmlinux
102BOOTIMAGE := $(bootimage-y)
103install: vmlinux
104 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@
105
106defaultimage-$(CONFIG_PPC_PSERIES) := zImage
107defaultimage-$(CONFIG_PPC_PMAC) := vmlinux
108defaultimage-$(CONFIG_PPC_MAPLE) := zImage
109defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
110KBUILD_IMAGE := $(defaultimage-y)
111all: $(KBUILD_IMAGE)
112
113archclean:
114 $(Q)$(MAKE) $(clean)=$(boot)
115
116prepare: include/asm-ppc64/offsets.h
117
118arch/ppc64/kernel/asm-offsets.s: include/asm include/linux/version.h \
119 include/config/MARKER
120
121include/asm-ppc64/offsets.h: arch/ppc64/kernel/asm-offsets.s
122 $(call filechk,gen-asm-offsets)
123
124define archhelp
125 echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
126 echo ' zImage.initrd- Compressed kernel image with initrd attached,'
127 echo ' sourced from arch/$(ARCH)/boot/ramdisk.image.gz'
128 echo ' (arch/$(ARCH)/boot/zImage.initrd)'
129endef
130
131CLEAN_FILES += include/asm-ppc64/offsets.h