Makefile 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #
  2. # x86_64/Makefile
  3. #
  4. # This file is included by the global makefile so that you can add your own
  5. # architecture-specific flags and dependencies. Remember to do have actions
  6. # for "archclean" and "archdep" for cleaning up and making dependencies for
  7. # this architecture
  8. #
  9. # This file is subject to the terms and conditions of the GNU General Public
  10. # License. See the file "COPYING" in the main directory of this archive
  11. # for more details.
  12. #
  13. # Copyright (C) 1994 by Linus Torvalds
  14. #
  15. # 19990713 Artur Skawina <skawina@geocities.com>
  16. # Added '-march' and '-mpreferred-stack-boundary' support
  17. # 20000913 Pavel Machek <pavel@suse.cz>
  18. # Converted for x86_64 architecture
  19. # 20010105 Andi Kleen, add IA32 compiler.
  20. # ....and later removed it again....
  21. #
  22. # $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $
  23. # Fill in SRCARCH
  24. SRCARCH := x86
  25. # BITS is used as extension for files which are available in a 32 bit
  26. # and a 64 bit version to simplify shared Makefiles.
  27. # e.g.: obj-y += foo_$(BITS).o
  28. BITS := 64
  29. export BITS
  30. LDFLAGS := -m elf_x86_64
  31. OBJCOPYFLAGS := -O binary -R .note -R .comment -S
  32. LDFLAGS_vmlinux :=
  33. CHECKFLAGS += -D__x86_64__ -m64
  34. cflags-y :=
  35. cflags-kernel-y :=
  36. cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)
  37. cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
  38. # gcc doesn't support -march=core2 yet as of gcc 4.3, but I hope it
  39. # will eventually. Use -mtune=generic as fallback
  40. cflags-$(CONFIG_MCORE2) += \
  41. $(call cc-option,-march=core2,$(call cc-option,-mtune=generic))
  42. cflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=generic)
  43. cflags-y += -m64
  44. cflags-y += -mno-red-zone
  45. cflags-y += -mcmodel=kernel
  46. cflags-y += -pipe
  47. cflags-y += -Wno-sign-compare
  48. cflags-y += -fno-asynchronous-unwind-tables
  49. ifneq ($(CONFIG_DEBUG_INFO),y)
  50. # -fweb shrinks the kernel a bit, but the difference is very small
  51. # it also messes up debugging, so don't use it for now.
  52. #cflags-y += $(call cc-option,-fweb)
  53. endif
  54. # -funit-at-a-time shrinks the kernel .text considerably
  55. # unfortunately it makes reading oopses harder.
  56. cflags-y += $(call cc-option,-funit-at-a-time)
  57. # prevent gcc from generating any FP code by mistake
  58. cflags-y += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
  59. # this works around some issues with generating unwind tables in older gccs
  60. # newer gccs do it by default
  61. cflags-y += -maccumulate-outgoing-args
  62. # do binutils support CFI?
  63. cflags-y += $(call as-instr,.cfi_startproc\n.cfi_rel_offset rsp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
  64. KBUILD_AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_rel_offset rsp${comma}0\n.cfi_endproc,-DCONFIG_AS_CFI=1,)
  65. # is .cfi_signal_frame supported too?
  66. cflags-y += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,)
  67. KBUILD_AFLAGS += $(call as-instr,.cfi_startproc\n.cfi_signal_frame\n.cfi_endproc,-DCONFIG_AS_CFI_SIGNAL_FRAME=1,)
  68. cflags-$(CONFIG_CC_STACKPROTECTOR) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector )
  69. cflags-$(CONFIG_CC_STACKPROTECTOR_ALL) += $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-x86_64-has-stack-protector.sh "$(CC)" -fstack-protector-all )
  70. KBUILD_CFLAGS += $(cflags-y)
  71. CFLAGS_KERNEL += $(cflags-kernel-y)
  72. KBUILD_AFLAGS += -m64
  73. head-y := arch/x86/kernel/head_64.o arch/x86/kernel/head64.o arch/x86/kernel/init_task.o
  74. libs-y += arch/x86/lib/
  75. core-y += arch/x86/kernel/ \
  76. arch/x86/mm/ \
  77. arch/x86/crypto/ \
  78. arch/x86/vdso/
  79. core-$(CONFIG_IA32_EMULATION) += arch/x86/ia32/
  80. drivers-$(CONFIG_PCI) += arch/x86/pci/
  81. drivers-$(CONFIG_OPROFILE) += arch/x86/oprofile/
  82. boot := arch/x86/boot
  83. PHONY += bzImage bzlilo install archmrproper \
  84. fdimage fdimage144 fdimage288 isoimage archclean
  85. #Default target when executing "make"
  86. all: bzImage
  87. BOOTIMAGE := arch/x86/boot/bzImage
  88. KBUILD_IMAGE := $(BOOTIMAGE)
  89. bzImage: vmlinux
  90. $(Q)$(MAKE) $(build)=$(boot) $(BOOTIMAGE)
  91. $(Q)mkdir -p $(objtree)/arch/x86_64/boot
  92. $(Q)ln -fsn ../../x86/boot/bzImage $(objtree)/arch/x86_64/boot/bzImage
  93. bzlilo: vmlinux
  94. $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zlilo
  95. bzdisk: vmlinux
  96. $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zdisk
  97. fdimage fdimage144 fdimage288 isoimage: vmlinux
  98. $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@
  99. install: vdso_install
  100. $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@
  101. vdso_install:
  102. ifeq ($(CONFIG_IA32_EMULATION),y)
  103. $(Q)$(MAKE) $(build)=arch/x86/ia32 $@
  104. endif
  105. $(Q)$(MAKE) $(build)=arch/x86/vdso $@
  106. archclean:
  107. $(Q)rm -rf $(objtree)/arch/x86_64/boot
  108. $(Q)$(MAKE) $(clean)=$(boot)
  109. define archhelp
  110. echo '* bzImage - Compressed kernel image (arch/$(ARCH)/boot/bzImage)'
  111. echo ' install - Install kernel using'
  112. echo ' (your) ~/bin/installkernel or'
  113. echo ' (distribution) /sbin/installkernel or'
  114. echo ' install to $$(INSTALL_PATH) and run lilo'
  115. echo ' bzdisk - Create a boot floppy in /dev/fd0'
  116. echo ' fdimage - Create a boot floppy image'
  117. echo ' isoimage - Create a boot CD-ROM image'
  118. endef
  119. CLEAN_FILES += arch/$(ARCH)/boot/fdimage \
  120. arch/$(ARCH)/boot/image.iso \
  121. arch/$(ARCH)/boot/mtools.conf