]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - arch/powerpc/Makefile
kbuild: change kbuild to not rely on incorrect GNU make behavior
[mirror_ubuntu-artful-kernel.git] / arch / powerpc / Makefile
index 99dbea8c5c50d63952a71187589fe673db42e35e..5787d55a20b61d3b94178e29de56c2afb1768d05 100644 (file)
@@ -33,6 +33,8 @@ endif
 
 export CROSS32CC CROSS32AS CROSS32LD CROSS32OBJCOPY
 
+KBUILD_DEFCONFIG := $(shell uname -m)_defconfig
+
 ifeq ($(CONFIG_PPC64),y)
 OLDARCH        := ppc64
 SZ     := 64
@@ -59,21 +61,22 @@ endif
 LDFLAGS_vmlinux        := -Bstatic
 
 # The -Iarch/$(ARCH)/include is temporary while we are merging
-CPPFLAGS       += -Iarch/$(ARCH) -Iarch/$(ARCH)/include
-AFLAGS         += -Iarch/$(ARCH)
-CFLAGS         += -Iarch/$(ARCH) -msoft-float -pipe
+CPPFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -Iarch/$(ARCH)/include
+AFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH)
 CFLAGS-$(CONFIG_PPC64) := -mminimal-toc -mtraceback=none  -mcall-aixdesc
-CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple
-CFLAGS         += $(CFLAGS-y)
+CFLAGS-$(CONFIG_PPC32) := -Iarch/$(ARCH) -ffixed-r2 -mmultiple
+CPPFLAGS       += $(CPPFLAGS-y)
+AFLAGS         += $(AFLAGS-y)
+CFLAGS         += -msoft-float -pipe $(CFLAGS-y)
 CPP            = $(CC) -E $(CFLAGS)
 # Temporary hack until we have migrated to asm-powerpc
-LINUXINCLUDE    += -Iarch/$(ARCH)/include
+LINUXINCLUDE-$(CONFIG_PPC32)   := -Iarch/$(ARCH)/include
+LINUXINCLUDE    += $(LINUXINCLUDE-y)
 
 CHECKFLAGS     += -m$(SZ) -D__powerpc__ -D__powerpc$(SZ)__
 
 ifeq ($(CONFIG_PPC64),y)
-GCC_VERSION     := $(call cc-version)
-GCC_BROKEN_VEC := $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi)
+GCC_BROKEN_VEC := $(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y"; fi)
 
 ifeq ($(CONFIG_POWER4_ONLY),y)
 ifeq ($(CONFIG_ALTIVEC),y)
@@ -111,9 +114,6 @@ cpu-as-$(CONFIG_E200)               += -Wa,-me200
 AFLAGS += $(cpu-as-y)
 CFLAGS += $(cpu-as-y)
 
-# Default to the common case.
-KBUILD_DEFCONFIG := common_defconfig
-
 head-y                         := arch/powerpc/kernel/head_32.o
 head-$(CONFIG_PPC64)           := arch/powerpc/kernel/head_64.o
 head-$(CONFIG_8xx)             := arch/powerpc/kernel/head_8xx.o
@@ -125,11 +125,11 @@ head-$(CONFIG_PPC64)              += arch/powerpc/kernel/entry_64.o
 head-$(CONFIG_PPC_FPU)         += arch/powerpc/kernel/fpu.o
 
 core-y                         += arch/powerpc/kernel/ \
-                                  arch/$(OLDARCH)/kernel/ \
                                   arch/powerpc/mm/ \
                                   arch/powerpc/lib/ \
                                   arch/powerpc/sysdev/ \
                                   arch/powerpc/platforms/
+core-$(CONFIG_PPC32)           += arch/ppc/kernel/
 core-$(CONFIG_MATH_EMULATION)  += arch/ppc/math-emu/
 core-$(CONFIG_XMON)            += arch/powerpc/xmon/
 core-$(CONFIG_APUS)            += arch/ppc/amiga/
@@ -139,20 +139,18 @@ drivers-$(CONFIG_CPM2)            += arch/ppc/8260_io/
 
 drivers-$(CONFIG_OPROFILE)     += arch/powerpc/oprofile/
 
-defaultimage-$(CONFIG_PPC32)   := zImage
+# Default to zImage, override when needed
+defaultimage-y                 := zImage
 defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
-defaultimage-$(CONFIG_PPC_PSERIES) := zImage
+defaultimage-$(CONFIG_DEFAULT_UIMAGE) := uImage
 KBUILD_IMAGE := $(defaultimage-y)
 all: $(KBUILD_IMAGE)
 
 CPPFLAGS_vmlinux.lds   := -Upowerpc
 
-# All the instructions talk about "make bzImage".
-bzImage: zImage
-
-BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm
+BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm uImage
 
-.PHONY: $(BOOT_TARGETS)
+PHONY += $(BOOT_TARGETS)
 
 boot := arch/$(ARCH)/boot
 
@@ -165,20 +163,24 @@ define archhelp
   @echo '                    (your) ~/bin/installkernel or'
   @echo '                    (distribution) /sbin/installkernel or'
   @echo '                    install to $$(INSTALL_PATH) and run lilo'
-  @echo '  *_defconfig     - Select default config from arch/$(ARCH)/ppc/configs'
+  @echo '  *_defconfig     - Select default config from arch/$(ARCH)/configs'
 endef
 
 archclean:
        $(Q)$(MAKE) $(clean)=$(boot)
+
+archmrproper:
        $(Q)rm -rf arch/$(ARCH)/include
 
 archprepare: checkbin
 
+ifeq ($(CONFIG_PPC32),y)
 # Temporary hack until we have migrated to asm-powerpc
 include/asm: arch/$(ARCH)/include/asm
 arch/$(ARCH)/include/asm: FORCE
        $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
        $(Q)ln -fsn $(srctree)/include/asm-$(OLDARCH) arch/$(ARCH)/include/asm
+endif
 
 # Use the file '.tmp_gas_check' for binutils tests, as gas won't output
 # to stdout and these checks are run even on install targets.
@@ -186,10 +188,9 @@ TOUT       := .tmp_gas_check
 # Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec
 # instructions.
 # gcc-3.4 and binutils-2.14 are a fatal combination.
-GCC_VERSION    := $(call cc-version)
 
 checkbin:
-       @if test "$(GCC_VERSION)" = "0304" ; then \
+       @if test "$(call cc-version)" = "0304" ; then \
                if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
                        echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \
                        echo 'correctly with gcc-3.4 and your version of binutils.'; \