Makefile 4.6 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
# This file is included by the global makefile so that you can add your own
# architecture-specific flags and dependencies. Remember to do have actions
# for "archclean" and "archdep" for cleaning up and making dependencies for
# this architecture
#
# This file is subject to the terms and conditions of the GNU General Public
# License.  See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 1994 by Linus Torvalds
# Changes for PPC by Gary Thomas
# Rewritten by Cort Dougan and Paul Mackerras
# Adjusted for PPC64 by Tom Gall
#

KERNELLOAD	:= 0xc000000000000000

# Set default 32 bits cross compilers for vdso and boot wrapper
CROSS32_COMPILE ?=

CROSS32CC		:= $(CROSS32_COMPILE)gcc
CROSS32AS		:= $(CROSS32_COMPILE)as
CROSS32LD		:= $(CROSS32_COMPILE)ld
CROSS32OBJCOPY		:= $(CROSS32_COMPILE)objcopy

# If we have a biarch compiler, use it for 32 bits cross compile if
# CROSS32_COMPILE wasn't explicitely defined, and add proper explicit
# target type to target compilers

HAS_BIARCH      := $(call cc-option-yn, -m64)
ifeq ($(HAS_BIARCH),y)
ifeq ($(CROSS32_COMPILE),)
CROSS32CC	:= $(CC) -m32
CROSS32AS	:= $(AS) -a32
CROSS32LD	:= $(LD) -m elf32ppc
CROSS32OBJCOPY	:= $(OBJCOPY)
endif
38 39 40
override AS	+= -a64
override LD	+= -m elf64ppc
override CC	+= -m64
L
Linus Torvalds 已提交
41 42 43 44 45 46 47 48 49 50 51
endif

export CROSS32CC CROSS32AS CROSS32LD CROSS32OBJCOPY

new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi)

ifeq ($(new_nm),y)
NM		:= $(NM) --synthetic

endif

52
CHECKFLAGS	+= -m64 -D__powerpc__ -D__powerpc64__
L
Linus Torvalds 已提交
53 54 55 56 57

LDFLAGS		:= -m elf64ppc
LDFLAGS_vmlinux	:= -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
CFLAGS		+= -msoft-float -pipe -mminimal-toc -mtraceback=none \
		   -mcall-aixdesc
58
# Temporary hack until we have migrated to asm-powerpc
59
CPPFLAGS	+= -Iarch/$(ARCH)/include
L
Linus Torvalds 已提交
60

61 62 63
GCC_VERSION     := $(call cc-version)
GCC_BROKEN_VEC	:= $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi ;)

L
Linus Torvalds 已提交
64 65
ifeq ($(CONFIG_POWER4_ONLY),y)
ifeq ($(CONFIG_ALTIVEC),y)
66
ifeq ($(GCC_BROKEN_VEC),y)
L
Linus Torvalds 已提交
67 68 69 70
	CFLAGS += $(call cc-option,-mcpu=970)
else
	CFLAGS += $(call cc-option,-mcpu=power4)
endif
71 72 73
else
	CFLAGS += $(call cc-option,-mcpu=power4)
endif
L
Linus Torvalds 已提交
74 75 76 77
else
	CFLAGS += $(call cc-option,-mtune=power4)
endif

78 79 80
# No AltiVec instruction when building kernel
CFLAGS	+= $(call cc-option, -mno-altivec)

L
Linus Torvalds 已提交
81 82 83 84 85
# Enable unit-at-a-time mode when possible. It shrinks the
# kernel considerably.
CFLAGS += $(call cc-option,-funit-at-a-time)

head-y := arch/ppc64/kernel/head.o
86
head-y += arch/powerpc/kernel/fpu.o
87
head-y += arch/powerpc/kernel/entry_64.o
L
Linus Torvalds 已提交
88

89
core-y				+= arch/ppc64/kernel/ arch/powerpc/kernel/
90
core-y				+= arch/powerpc/mm/
P
Paul Mackerras 已提交
91
core-y				+= arch/powerpc/sysdev/
92
core-y				+= arch/powerpc/platforms/
93
core-y				+= arch/powerpc/lib/
P
Paul Mackerras 已提交
94
core-$(CONFIG_XMON)		+= arch/powerpc/xmon/
95
drivers-$(CONFIG_OPROFILE)	+= arch/powerpc/oprofile/
L
Linus Torvalds 已提交
96 97 98

boot := arch/ppc64/boot

G
Geoff Levand 已提交
99 100 101 102 103 104
boottargets-$(CONFIG_PPC_PSERIES) += zImage zImage.initrd
boottargets-$(CONFIG_PPC_PMAC) += zImage.vmode zImage.initrd.vmode
boottargets-$(CONFIG_PPC_MAPLE) += zImage zImage.initrd
boottargets-$(CONFIG_PPC_ISERIES) += vmlinux.sminitrd vmlinux.initrd vmlinux.sm
boottargets-$(CONFIG_PPC_BPA) += zImage zImage.initrd
$(boottargets-y): vmlinux
L
Linus Torvalds 已提交
105 106 107 108 109
	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage
bootimage-$(CONFIG_PPC_PMAC) := vmlinux
bootimage-$(CONFIG_PPC_MAPLE) := $(boot)/zImage
110
bootimage-$(CONFIG_PPC_BPA) := $(boot)/zImage
L
Linus Torvalds 已提交
111 112 113 114 115 116
bootimage-$(CONFIG_PPC_ISERIES) := vmlinux
BOOTIMAGE := $(bootimage-y)
install: vmlinux
	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@

defaultimage-$(CONFIG_PPC_PSERIES) := zImage
117
defaultimage-$(CONFIG_PPC_PMAC) := zImage.vmode
L
Linus Torvalds 已提交
118 119 120 121 122 123 124
defaultimage-$(CONFIG_PPC_MAPLE) := zImage
defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
KBUILD_IMAGE := $(defaultimage-y)
all: $(KBUILD_IMAGE)

archclean:
	$(Q)$(MAKE) $(clean)=$(boot)
125 126
	# Temporary hack until we have migrated to asm-powerpc
	$(Q)rm -rf arch/$(ARCH)/include
L
Linus Torvalds 已提交
127 128


129
# Temporary hack until we have migrated to asm-powerpc
130 131 132 133
include/asm: arch/$(ARCH)/include/asm
arch/$(ARCH)/include/asm:
	$(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
	$(Q)ln -fsn $(srctree)/include/asm-powerpc arch/$(ARCH)/include/asm
134

L
Linus Torvalds 已提交
135
define archhelp
G
Geoff Levand 已提交
136 137 138 139 140 141
  echo  '  zImage.vmode        - Compressed kernel image (arch/$(ARCH)/boot/zImage.vmode)'
  echo  '  zImage.initrd.vmode - Compressed kernel image with initrd attached,'
  echo  '                        sourced from arch/$(ARCH)/boot/ramdisk.image.gz'
  echo  '                        (arch/$(ARCH)/boot/zImage.initrd.vmode)'
  echo  '  zImage              - zImage for pSeries machines'
  echo  '  zImage.initrd       - zImage with initrd for pSeries machines'
L
Linus Torvalds 已提交
142
endef