Makefile 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. KERNELLOAD := 0xc000000000000000
  16. # Set default 32 bits cross compilers for vdso and boot wrapper
  17. CROSS32_COMPILE ?=
  18. CROSS32CC := $(CROSS32_COMPILE)gcc
  19. CROSS32AS := $(CROSS32_COMPILE)as
  20. CROSS32LD := $(CROSS32_COMPILE)ld
  21. CROSS32OBJCOPY := $(CROSS32_COMPILE)objcopy
  22. # If we have a biarch compiler, use it for 32 bits cross compile if
  23. # CROSS32_COMPILE wasn't explicitely defined, and add proper explicit
  24. # target type to target compilers
  25. HAS_BIARCH := $(call cc-option-yn, -m64)
  26. ifeq ($(HAS_BIARCH),y)
  27. ifeq ($(CROSS32_COMPILE),)
  28. CROSS32CC := $(CC) -m32
  29. CROSS32AS := $(AS) -a32
  30. CROSS32LD := $(LD) -m elf32ppc
  31. CROSS32OBJCOPY := $(OBJCOPY)
  32. endif
  33. override AS += -a64
  34. override LD += -m elf64ppc
  35. override CC += -m64
  36. endif
  37. export CROSS32CC CROSS32AS CROSS32LD CROSS32OBJCOPY
  38. new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi)
  39. ifeq ($(new_nm),y)
  40. NM := $(NM) --synthetic
  41. endif
  42. CHECKFLAGS += -m64 -D__powerpc__ -D__powerpc64__
  43. LDFLAGS := -m elf64ppc
  44. LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
  45. CFLAGS += -msoft-float -pipe -mminimal-toc -mtraceback=none \
  46. -mcall-aixdesc
  47. # Temporary hack until we have migrated to asm-powerpc
  48. CPPFLAGS += -Iarch/$(ARCH)/include
  49. GCC_VERSION := $(call cc-version)
  50. GCC_BROKEN_VEC := $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi ;)
  51. ifeq ($(CONFIG_POWER4_ONLY),y)
  52. ifeq ($(CONFIG_ALTIVEC),y)
  53. ifeq ($(GCC_BROKEN_VEC),y)
  54. CFLAGS += $(call cc-option,-mcpu=970)
  55. else
  56. CFLAGS += $(call cc-option,-mcpu=power4)
  57. endif
  58. else
  59. CFLAGS += $(call cc-option,-mcpu=power4)
  60. endif
  61. else
  62. CFLAGS += $(call cc-option,-mtune=power4)
  63. endif
  64. # No AltiVec instruction when building kernel
  65. CFLAGS += $(call cc-option, -mno-altivec)
  66. # Enable unit-at-a-time mode when possible. It shrinks the
  67. # kernel considerably.
  68. CFLAGS += $(call cc-option,-funit-at-a-time)
  69. head-y := arch/ppc64/kernel/head.o
  70. head-y += arch/powerpc/kernel/fpu.o
  71. head-y += arch/powerpc/kernel/entry_64.o
  72. core-y += arch/ppc64/kernel/ arch/powerpc/kernel/
  73. core-y += arch/powerpc/mm/
  74. core-y += arch/powerpc/sysdev/
  75. core-y += arch/powerpc/platforms/
  76. core-y += arch/powerpc/lib/
  77. core-$(CONFIG_XMON) += arch/powerpc/xmon/
  78. drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
  79. boot := arch/ppc64/boot
  80. boottargets-$(CONFIG_PPC_PSERIES) += zImage zImage.initrd
  81. boottargets-$(CONFIG_PPC_PMAC) += zImage.vmode zImage.initrd.vmode
  82. boottargets-$(CONFIG_PPC_MAPLE) += zImage zImage.initrd
  83. boottargets-$(CONFIG_PPC_ISERIES) += vmlinux.sminitrd vmlinux.initrd vmlinux.sm
  84. boottargets-$(CONFIG_PPC_BPA) += zImage zImage.initrd
  85. $(boottargets-y): vmlinux
  86. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  87. bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage
  88. bootimage-$(CONFIG_PPC_PMAC) := vmlinux
  89. bootimage-$(CONFIG_PPC_MAPLE) := $(boot)/zImage
  90. bootimage-$(CONFIG_PPC_BPA) := $(boot)/zImage
  91. bootimage-$(CONFIG_PPC_ISERIES) := vmlinux
  92. BOOTIMAGE := $(bootimage-y)
  93. install: vmlinux
  94. $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@
  95. defaultimage-$(CONFIG_PPC_PSERIES) := zImage
  96. defaultimage-$(CONFIG_PPC_PMAC) := zImage.vmode
  97. defaultimage-$(CONFIG_PPC_MAPLE) := zImage
  98. defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
  99. KBUILD_IMAGE := $(defaultimage-y)
  100. all: $(KBUILD_IMAGE)
  101. archclean:
  102. $(Q)$(MAKE) $(clean)=$(boot)
  103. # Temporary hack until we have migrated to asm-powerpc
  104. $(Q)rm -rf arch/$(ARCH)/include
  105. # Temporary hack until we have migrated to asm-powerpc
  106. include/asm: arch/$(ARCH)/include/asm
  107. arch/$(ARCH)/include/asm:
  108. $(Q)if [ ! -d arch/$(ARCH)/include ]; then mkdir -p arch/$(ARCH)/include; fi
  109. $(Q)ln -fsn $(srctree)/include/asm-powerpc arch/$(ARCH)/include/asm
  110. define archhelp
  111. echo ' zImage.vmode - Compressed kernel image (arch/$(ARCH)/boot/zImage.vmode)'
  112. echo ' zImage.initrd.vmode - Compressed kernel image with initrd attached,'
  113. echo ' sourced from arch/$(ARCH)/boot/ramdisk.image.gz'
  114. echo ' (arch/$(ARCH)/boot/zImage.initrd.vmode)'
  115. echo ' zImage - zImage for pSeries machines'
  116. echo ' zImage.initrd - zImage with initrd for pSeries machines'
  117. endef