Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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__
  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. GCC_VERSION := $(call cc-version)
  48. GCC_BROKEN_VEC := $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi ;)
  49. ifeq ($(CONFIG_POWER4_ONLY),y)
  50. ifeq ($(CONFIG_ALTIVEC),y)
  51. ifeq ($(GCC_BROKEN_VEC),y)
  52. CFLAGS += $(call cc-option,-mcpu=970)
  53. else
  54. CFLAGS += $(call cc-option,-mcpu=power4)
  55. endif
  56. else
  57. CFLAGS += $(call cc-option,-mcpu=power4)
  58. endif
  59. else
  60. CFLAGS += $(call cc-option,-mtune=power4)
  61. endif
  62. # Enable unit-at-a-time mode when possible. It shrinks the
  63. # kernel considerably.
  64. CFLAGS += $(call cc-option,-funit-at-a-time)
  65. head-y := arch/ppc64/kernel/head.o
  66. libs-y += arch/ppc64/lib/
  67. core-y += arch/ppc64/kernel/
  68. core-y += arch/ppc64/mm/
  69. core-$(CONFIG_XMON) += arch/ppc64/xmon/
  70. drivers-$(CONFIG_OPROFILE) += arch/ppc64/oprofile/
  71. boot := arch/ppc64/boot
  72. boottarget-$(CONFIG_PPC_PSERIES) := zImage zImage.initrd
  73. boottarget-$(CONFIG_PPC_MAPLE) := zImage zImage.initrd
  74. boottarget-$(CONFIG_PPC_ISERIES) := vmlinux.sminitrd vmlinux.initrd vmlinux.sm
  75. boottarget-$(CONFIG_PPC_BPA) := zImage zImage.initrd
  76. $(boottarget-y): vmlinux
  77. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  78. bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage
  79. bootimage-$(CONFIG_PPC_PMAC) := vmlinux
  80. bootimage-$(CONFIG_PPC_MAPLE) := $(boot)/zImage
  81. bootimage-$(CONFIG_PPC_BPA) := zImage
  82. bootimage-$(CONFIG_PPC_ISERIES) := vmlinux
  83. BOOTIMAGE := $(bootimage-y)
  84. install: vmlinux
  85. $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@
  86. defaultimage-$(CONFIG_PPC_PSERIES) := zImage
  87. defaultimage-$(CONFIG_PPC_PMAC) := vmlinux
  88. defaultimage-$(CONFIG_PPC_MAPLE) := zImage
  89. defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
  90. KBUILD_IMAGE := $(defaultimage-y)
  91. all: $(KBUILD_IMAGE)
  92. archclean:
  93. $(Q)$(MAKE) $(clean)=$(boot)
  94. prepare: include/asm-ppc64/offsets.h
  95. arch/ppc64/kernel/asm-offsets.s: include/asm include/linux/version.h \
  96. include/config/MARKER
  97. include/asm-ppc64/offsets.h: arch/ppc64/kernel/asm-offsets.s
  98. $(call filechk,gen-asm-offsets)
  99. define archhelp
  100. echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
  101. echo ' zImage.initrd- Compressed kernel image with initrd attached,'
  102. echo ' sourced from arch/$(ARCH)/boot/ramdisk.image.gz'
  103. echo ' (arch/$(ARCH)/boot/zImage.initrd)'
  104. endef
  105. CLEAN_FILES += include/asm-ppc64/offsets.h