Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | # 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 | |
| 16 | KERNELLOAD := 0xc000000000000000 |
| 17 | |
| 18 | # Set default 32 bits cross compilers for vdso and boot wrapper |
| 19 | CROSS32_COMPILE ?= |
| 20 | |
| 21 | CROSS32CC := $(CROSS32_COMPILE)gcc |
| 22 | CROSS32AS := $(CROSS32_COMPILE)as |
| 23 | CROSS32LD := $(CROSS32_COMPILE)ld |
| 24 | CROSS32OBJCOPY := $(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 | |
| 30 | HAS_BIARCH := $(call cc-option-yn, -m64) |
| 31 | ifeq ($(HAS_BIARCH),y) |
| 32 | ifeq ($(CROSS32_COMPILE),) |
| 33 | CROSS32CC := $(CC) -m32 |
| 34 | CROSS32AS := $(AS) -a32 |
| 35 | CROSS32LD := $(LD) -m elf32ppc |
| 36 | CROSS32OBJCOPY := $(OBJCOPY) |
| 37 | endif |
Sven Luther | 723e2b3 | 2005-06-21 17:15:32 -0700 | [diff] [blame] | 38 | override AS += -a64 |
| 39 | override LD += -m elf64ppc |
| 40 | override CC += -m64 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | endif |
| 42 | |
| 43 | export CROSS32CC CROSS32AS CROSS32LD CROSS32OBJCOPY |
| 44 | |
| 45 | new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) |
| 46 | |
| 47 | ifeq ($(new_nm),y) |
| 48 | NM := $(NM) --synthetic |
| 49 | |
| 50 | endif |
| 51 | |
viro@ZenIV.linux.org.uk | 3352ae5 | 2005-09-07 23:28:32 +0100 | [diff] [blame] | 52 | CHECKFLAGS += -m64 -D__powerpc__ -D__powerpc64__ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
| 54 | LDFLAGS := -m elf64ppc |
| 55 | LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD) |
| 56 | CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none \ |
| 57 | -mcall-aixdesc |
Stephen Rothwell | 45e2a6e | 2005-08-29 13:15:50 +1000 | [diff] [blame] | 58 | # Temporary hack until we have migrated to asm-powerpc |
Stephen Rothwell | b35b707 | 2005-09-11 00:00:14 +1000 | [diff] [blame^] | 59 | CPPFLAGS += -Iarch/$(ARCH)/include |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | |
Benjamin Herrenschmidt | 52292c9 | 2005-05-03 15:34:58 +1000 | [diff] [blame] | 61 | GCC_VERSION := $(call cc-version) |
| 62 | GCC_BROKEN_VEC := $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi ;) |
| 63 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | ifeq ($(CONFIG_POWER4_ONLY),y) |
| 65 | ifeq ($(CONFIG_ALTIVEC),y) |
Benjamin Herrenschmidt | 52292c9 | 2005-05-03 15:34:58 +1000 | [diff] [blame] | 66 | ifeq ($(GCC_BROKEN_VEC),y) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | CFLAGS += $(call cc-option,-mcpu=970) |
| 68 | else |
| 69 | CFLAGS += $(call cc-option,-mcpu=power4) |
| 70 | endif |
| 71 | else |
Benjamin Herrenschmidt | 52292c9 | 2005-05-03 15:34:58 +1000 | [diff] [blame] | 72 | CFLAGS += $(call cc-option,-mcpu=power4) |
| 73 | endif |
| 74 | else |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | CFLAGS += $(call cc-option,-mtune=power4) |
| 76 | endif |
| 77 | |
| 78 | # Enable unit-at-a-time mode when possible. It shrinks the |
| 79 | # kernel considerably. |
| 80 | CFLAGS += $(call cc-option,-funit-at-a-time) |
| 81 | |
| 82 | head-y := arch/ppc64/kernel/head.o |
| 83 | |
| 84 | libs-y += arch/ppc64/lib/ |
| 85 | core-y += arch/ppc64/kernel/ |
| 86 | core-y += arch/ppc64/mm/ |
| 87 | core-$(CONFIG_XMON) += arch/ppc64/xmon/ |
| 88 | drivers-$(CONFIG_OPROFILE) += arch/ppc64/oprofile/ |
| 89 | |
| 90 | boot := arch/ppc64/boot |
| 91 | |
Geoff Levand | a24c848 | 2005-08-15 13:59:13 -0700 | [diff] [blame] | 92 | boottargets-$(CONFIG_PPC_PSERIES) += zImage zImage.initrd |
| 93 | boottargets-$(CONFIG_PPC_PMAC) += zImage.vmode zImage.initrd.vmode |
| 94 | boottargets-$(CONFIG_PPC_MAPLE) += zImage zImage.initrd |
| 95 | boottargets-$(CONFIG_PPC_ISERIES) += vmlinux.sminitrd vmlinux.initrd vmlinux.sm |
| 96 | boottargets-$(CONFIG_PPC_BPA) += zImage zImage.initrd |
| 97 | $(boottargets-y): vmlinux |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
| 99 | |
| 100 | bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage |
| 101 | bootimage-$(CONFIG_PPC_PMAC) := vmlinux |
| 102 | bootimage-$(CONFIG_PPC_MAPLE) := $(boot)/zImage |
Arnd Bergmann | fef1c77 | 2005-06-23 09:43:37 +1000 | [diff] [blame] | 103 | bootimage-$(CONFIG_PPC_BPA) := zImage |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | bootimage-$(CONFIG_PPC_ISERIES) := vmlinux |
| 105 | BOOTIMAGE := $(bootimage-y) |
| 106 | install: vmlinux |
| 107 | $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@ |
| 108 | |
| 109 | defaultimage-$(CONFIG_PPC_PSERIES) := zImage |
| 110 | defaultimage-$(CONFIG_PPC_PMAC) := vmlinux |
| 111 | defaultimage-$(CONFIG_PPC_MAPLE) := zImage |
| 112 | defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux |
| 113 | KBUILD_IMAGE := $(defaultimage-y) |
| 114 | all: $(KBUILD_IMAGE) |
| 115 | |
| 116 | archclean: |
| 117 | $(Q)$(MAKE) $(clean)=$(boot) |
Stephen Rothwell | b35b707 | 2005-09-11 00:00:14 +1000 | [diff] [blame^] | 118 | # Temporary hack until we have migrated to asm-powerpc |
| 119 | $(Q)rm -rf arch/$(ARCH)/include |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 120 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | |
Stephen Rothwell | 45e2a6e | 2005-08-29 13:15:50 +1000 | [diff] [blame] | 122 | # Temporary hack until we have migrated to asm-powerpc |
Stephen Rothwell | b35b707 | 2005-09-11 00:00:14 +1000 | [diff] [blame^] | 123 | include/asm: arch/$(ARCH)/include/asm |
| 124 | arch/$(ARCH)/include/asm: |
| 125 | $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi |
| 126 | $(Q)ln -fsn $(srctree)/include/asm-powerpc arch/$(ARCH)/include/asm |
Stephen Rothwell | 45e2a6e | 2005-08-29 13:15:50 +1000 | [diff] [blame] | 127 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | define archhelp |
Geoff Levand | a24c848 | 2005-08-15 13:59:13 -0700 | [diff] [blame] | 129 | echo ' zImage.vmode - Compressed kernel image (arch/$(ARCH)/boot/zImage.vmode)' |
| 130 | echo ' zImage.initrd.vmode - Compressed kernel image with initrd attached,' |
| 131 | echo ' sourced from arch/$(ARCH)/boot/ramdisk.image.gz' |
| 132 | echo ' (arch/$(ARCH)/boot/zImage.initrd.vmode)' |
| 133 | echo ' zImage - zImage for pSeries machines' |
| 134 | echo ' zImage.initrd - zImage with initrd for pSeries machines' |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | endef |