114cf11afSPaul Mackerras# This file is included by the global makefile so that you can add your own 214cf11afSPaul Mackerras# architecture-specific flags and dependencies. Remember to do have actions 314cf11afSPaul Mackerras# for "archclean" and "archdep" for cleaning up and making dependencies for 414cf11afSPaul Mackerras# this architecture. 514cf11afSPaul Mackerras# 614cf11afSPaul Mackerras# This file is subject to the terms and conditions of the GNU General Public 714cf11afSPaul Mackerras# License. See the file "COPYING" in the main directory of this archive 814cf11afSPaul Mackerras# for more details. 914cf11afSPaul Mackerras# 1014cf11afSPaul Mackerras# Copyright (C) 1994 by Linus Torvalds 1114cf11afSPaul Mackerras# Changes for PPC by Gary Thomas 1214cf11afSPaul Mackerras# Rewritten by Cort Dougan and Paul Mackerras 1314cf11afSPaul Mackerras# 1414cf11afSPaul Mackerras 1514cf11afSPaul MackerrasHAS_BIARCH := $(call cc-option-yn, -m32) 1614cf11afSPaul Mackerras 1714cf11afSPaul Mackerras# Set default 32 bits cross compilers for vdso and boot wrapper 1814cf11afSPaul MackerrasCROSS32_COMPILE ?= 1914cf11afSPaul Mackerras 2014cf11afSPaul MackerrasCROSS32CC := $(CROSS32_COMPILE)gcc 2114cf11afSPaul MackerrasCROSS32AS := $(CROSS32_COMPILE)as 2214cf11afSPaul MackerrasCROSS32LD := $(CROSS32_COMPILE)ld 23*2bf11819SPaul MackerrasCROSS32AR := $(CROSS32_COMPILE)ar 2414cf11afSPaul MackerrasCROSS32OBJCOPY := $(CROSS32_COMPILE)objcopy 2514cf11afSPaul Mackerras 2614cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y) 2714cf11afSPaul Mackerrasifeq ($(CROSS32_COMPILE),) 2814cf11afSPaul MackerrasCROSS32CC := $(CC) -m32 2914cf11afSPaul MackerrasCROSS32AS := $(AS) -a32 3014cf11afSPaul MackerrasCROSS32LD := $(LD) -m elf32ppc 3114cf11afSPaul MackerrasCROSS32OBJCOPY := $(OBJCOPY) 32*2bf11819SPaul MackerrasCROSS32AR := $(AR) 3314cf11afSPaul Mackerrasendif 3414cf11afSPaul Mackerrasendif 3514cf11afSPaul Mackerras 36*2bf11819SPaul Mackerrasexport CROSS32CC CROSS32AS CROSS32LD CROSS32AR CROSS32OBJCOPY 3714cf11afSPaul Mackerras 388a5abdf8SPaul MackerrasKBUILD_DEFCONFIG := $(shell uname -m)_defconfig 398a5abdf8SPaul Mackerras 4094b212c2SPaul Mackerrasifeq ($(CONFIG_PPC64),y) 4194b212c2SPaul MackerrasOLDARCH := ppc64 4294b212c2SPaul MackerrasSZ := 64 4394b212c2SPaul Mackerras 4414cf11afSPaul Mackerrasnew_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) 4514cf11afSPaul Mackerras 4614cf11afSPaul Mackerrasifeq ($(new_nm),y) 4714cf11afSPaul MackerrasNM := $(NM) --synthetic 4814cf11afSPaul Mackerrasendif 4914cf11afSPaul Mackerras 5014cf11afSPaul Mackerraselse 51bbeb3f4cSStephen RothwellOLDARCH := ppc 5214cf11afSPaul MackerrasSZ := 32 5314cf11afSPaul Mackerrasendif 5414cf11afSPaul Mackerras 55190554dbSStephen RothwellUTS_MACHINE := $(OLDARCH) 56190554dbSStephen Rothwell 5714cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y) 5814cf11afSPaul Mackerrasoverride AS += -a$(SZ) 5914cf11afSPaul Mackerrasoverride LD += -m elf$(SZ)ppc 6014cf11afSPaul Mackerrasoverride CC += -m$(SZ) 6114cf11afSPaul Mackerrasendif 6214cf11afSPaul Mackerras 63e19e4ab4SMichael EllermanLDFLAGS_vmlinux := -Bstatic 6414cf11afSPaul Mackerras 6514cf11afSPaul Mackerras# The -Iarch/$(ARCH)/include is temporary while we are merging 6655bb239eSStephen RothwellCPPFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -Iarch/$(ARCH)/include 6755bb239eSStephen RothwellAFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) 68bbeb3f4cSStephen RothwellCFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none -mcall-aixdesc 6955bb239eSStephen RothwellCFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2 -mmultiple 7055bb239eSStephen RothwellCPPFLAGS += $(CPPFLAGS-y) 7155bb239eSStephen RothwellAFLAGS += $(AFLAGS-y) 7255bb239eSStephen RothwellCFLAGS += -msoft-float -pipe $(CFLAGS-y) 7314cf11afSPaul MackerrasCPP = $(CC) -E $(CFLAGS) 7414cf11afSPaul Mackerras# Temporary hack until we have migrated to asm-powerpc 7555bb239eSStephen RothwellLINUXINCLUDE-$(CONFIG_PPC32) := -Iarch/$(ARCH)/include 7655bb239eSStephen RothwellLINUXINCLUDE += $(LINUXINCLUDE-y) 7714cf11afSPaul Mackerras 7814cf11afSPaul MackerrasCHECKFLAGS += -m$(SZ) -D__powerpc__ -D__powerpc$(SZ)__ 7914cf11afSPaul Mackerras 8014cf11afSPaul Mackerrasifeq ($(CONFIG_PPC64),y) 81ad14336dSSam RavnborgGCC_BROKEN_VEC := $(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y"; fi) 8214cf11afSPaul Mackerras 8314cf11afSPaul Mackerrasifeq ($(CONFIG_POWER4_ONLY),y) 8414cf11afSPaul Mackerrasifeq ($(CONFIG_ALTIVEC),y) 8514cf11afSPaul Mackerrasifeq ($(GCC_BROKEN_VEC),y) 8614cf11afSPaul Mackerras CFLAGS += $(call cc-option,-mcpu=970) 8714cf11afSPaul Mackerraselse 8814cf11afSPaul Mackerras CFLAGS += $(call cc-option,-mcpu=power4) 8914cf11afSPaul Mackerrasendif 9014cf11afSPaul Mackerraselse 9114cf11afSPaul Mackerras CFLAGS += $(call cc-option,-mcpu=power4) 9214cf11afSPaul Mackerrasendif 9314cf11afSPaul Mackerraselse 9414cf11afSPaul Mackerras CFLAGS += $(call cc-option,-mtune=power4) 9514cf11afSPaul Mackerrasendif 9614cf11afSPaul Mackerrasendif 9714cf11afSPaul Mackerras 98d3f67fbbSPaul Mackerras# No AltiVec instruction when building kernel 99d3f67fbbSPaul MackerrasCFLAGS += $(call cc-option,-mno-altivec) 100d3f67fbbSPaul Mackerras 10114cf11afSPaul Mackerras# Enable unit-at-a-time mode when possible. It shrinks the 10214cf11afSPaul Mackerras# kernel considerably. 10314cf11afSPaul MackerrasCFLAGS += $(call cc-option,-funit-at-a-time) 10414cf11afSPaul Mackerras 10514cf11afSPaul Mackerrasifndef CONFIG_FSL_BOOKE 10614cf11afSPaul MackerrasCFLAGS += -mstring 10714cf11afSPaul Mackerrasendif 10814cf11afSPaul Mackerras 109f48b8296SOlaf Heringifeq ($(CONFIG_6xx),y) 110f48b8296SOlaf HeringCFLAGS += -mcpu=powerpc 111f48b8296SOlaf Heringendif 112f48b8296SOlaf Hering 11314cf11afSPaul Mackerrascpu-as-$(CONFIG_4xx) += -Wa,-m405 11414cf11afSPaul Mackerrascpu-as-$(CONFIG_6xx) += -Wa,-maltivec 11514cf11afSPaul Mackerrascpu-as-$(CONFIG_POWER4) += -Wa,-maltivec 11614cf11afSPaul Mackerrascpu-as-$(CONFIG_E500) += -Wa,-me500 11714cf11afSPaul Mackerrascpu-as-$(CONFIG_E200) += -Wa,-me200 11814cf11afSPaul Mackerras 11914cf11afSPaul MackerrasAFLAGS += $(cpu-as-y) 12014cf11afSPaul MackerrasCFLAGS += $(cpu-as-y) 12114cf11afSPaul Mackerras 12270d64ceaSPaul Mackerrashead-y := arch/powerpc/kernel/head_32.o 12314cf11afSPaul Mackerrashead-$(CONFIG_PPC64) := arch/powerpc/kernel/head_64.o 12414cf11afSPaul Mackerrashead-$(CONFIG_8xx) := arch/powerpc/kernel/head_8xx.o 12514cf11afSPaul Mackerrashead-$(CONFIG_4xx) := arch/powerpc/kernel/head_4xx.o 12614cf11afSPaul Mackerrashead-$(CONFIG_44x) := arch/powerpc/kernel/head_44x.o 12714cf11afSPaul Mackerrashead-$(CONFIG_FSL_BOOKE) := arch/powerpc/kernel/head_fsl_booke.o 12814cf11afSPaul Mackerras 1299994a338SPaul Mackerrashead-$(CONFIG_PPC64) += arch/powerpc/kernel/entry_64.o 13014cf11afSPaul Mackerrashead-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o 13114cf11afSPaul Mackerras 132daec962eSPaul Mackerrascore-y += arch/powerpc/kernel/ \ 133daec962eSPaul Mackerras arch/powerpc/mm/ \ 134daec962eSPaul Mackerras arch/powerpc/lib/ \ 135daec962eSPaul Mackerras arch/powerpc/sysdev/ \ 136daec962eSPaul Mackerras arch/powerpc/platforms/ 1375cd27208SKumar Galacore-$(CONFIG_MATH_EMULATION) += arch/powerpc/math-emu/ 138f78541dcSPaul Mackerrascore-$(CONFIG_XMON) += arch/powerpc/xmon/ 13914cf11afSPaul Mackerras 14014cf11afSPaul Mackerrasdrivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ 14114cf11afSPaul Mackerras 142135f0b17STom Rini# Default to zImage, override when needed 143135f0b17STom Rinidefaultimage-y := zImage 144cabb5587SStephen Rothwelldefaultimage-$(CONFIG_PPC_ISERIES) := vmlinux 145f4fc4a5bSKumar Galadefaultimage-$(CONFIG_DEFAULT_UIMAGE) := uImage 146cabb5587SStephen RothwellKBUILD_IMAGE := $(defaultimage-y) 147cabb5587SStephen Rothwellall: $(KBUILD_IMAGE) 14814cf11afSPaul Mackerras 14914cf11afSPaul MackerrasCPPFLAGS_vmlinux.lds := -Upowerpc 15014cf11afSPaul Mackerras 151*2bf11819SPaul MackerrasBOOT_TARGETS = zImage zImage.initrd uImage 152cabb5587SStephen Rothwell 1534f193362SPaul SmithPHONY += $(BOOT_TARGETS) 154cabb5587SStephen Rothwell 15594b212c2SPaul Mackerrasboot := arch/$(ARCH)/boot 15614cf11afSPaul Mackerras 15714cf11afSPaul Mackerras$(BOOT_TARGETS): vmlinux 15820f62954SPaul Mackerras $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 15914cf11afSPaul Mackerras 16014cf11afSPaul Mackerrasdefine archhelp 16194b212c2SPaul Mackerras @echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)' 16214cf11afSPaul Mackerras @echo ' install - Install kernel using' 16314cf11afSPaul Mackerras @echo ' (your) ~/bin/installkernel or' 16414cf11afSPaul Mackerras @echo ' (distribution) /sbin/installkernel or' 16514cf11afSPaul Mackerras @echo ' install to $$(INSTALL_PATH) and run lilo' 166437a58dbSPaul Mackerras @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs' 16714cf11afSPaul Mackerrasendef 16814cf11afSPaul Mackerras 16914cf11afSPaul Mackerrasarchclean: 170a3a9e99eSPaul Mackerras $(Q)$(MAKE) $(clean)=$(boot) 17170567293SAndreas Gruenbacher 17270567293SAndreas Gruenbacherarchmrproper: 17314cf11afSPaul Mackerras $(Q)rm -rf arch/$(ARCH)/include 17414cf11afSPaul Mackerras 17514cf11afSPaul Mackerrasarchprepare: checkbin 17614cf11afSPaul Mackerras 17755bb239eSStephen Rothwellifeq ($(CONFIG_PPC32),y) 17814cf11afSPaul Mackerras# Temporary hack until we have migrated to asm-powerpc 17914cf11afSPaul Mackerrasinclude/asm: arch/$(ARCH)/include/asm 18050092b23SBenjamin Herrenschmidtarch/$(ARCH)/include/asm: FORCE 18114cf11afSPaul Mackerras $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi 182bbeb3f4cSStephen Rothwell $(Q)ln -fsn $(srctree)/include/asm-$(OLDARCH) arch/$(ARCH)/include/asm 18355bb239eSStephen Rothwellendif 18414cf11afSPaul Mackerras 18514cf11afSPaul Mackerras# Use the file '.tmp_gas_check' for binutils tests, as gas won't output 18614cf11afSPaul Mackerras# to stdout and these checks are run even on install targets. 18714cf11afSPaul MackerrasTOUT := .tmp_gas_check 18814cf11afSPaul Mackerras# Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec 18914cf11afSPaul Mackerras# instructions. 19014cf11afSPaul Mackerras# gcc-3.4 and binutils-2.14 are a fatal combination. 19114cf11afSPaul Mackerras 19214cf11afSPaul Mackerrascheckbin: 193ad14336dSSam Ravnborg @if test "$(call cc-version)" = "0304" ; then \ 19414cf11afSPaul Mackerras if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \ 19514cf11afSPaul Mackerras echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \ 19614cf11afSPaul Mackerras echo 'correctly with gcc-3.4 and your version of binutils.'; \ 19714cf11afSPaul Mackerras echo '*** Please upgrade your binutils or downgrade your gcc'; \ 19814cf11afSPaul Mackerras false; \ 19914cf11afSPaul Mackerras fi ; \ 20014cf11afSPaul Mackerras fi 20114cf11afSPaul Mackerras @if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \ 20214cf11afSPaul Mackerras echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \ 20314cf11afSPaul Mackerras echo 'correctly with old versions of binutils.' ; \ 20414cf11afSPaul Mackerras echo '*** Please upgrade your binutils to 2.12.1 or newer' ; \ 20514cf11afSPaul Mackerras false ; \ 20614cf11afSPaul Mackerras fi 20714cf11afSPaul Mackerras 20814cf11afSPaul MackerrasCLEAN_FILES += $(TOUT) 20914cf11afSPaul Mackerras 210