Makefile 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #
  2. # Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License version 2 as
  6. # published by the Free Software Foundation.
  7. #
  8. UTS_MACHINE := arc
  9. KBUILD_DEFCONFIG := fpga_defconfig
  10. cflags-y += -mA7 -fno-common -pipe -fno-builtin -D__linux__
  11. LINUXINCLUDE += -include ${src}/arch/arc/include/asm/defines.h
  12. ifdef CONFIG_ARC_CURR_IN_REG
  13. # For a global register defintion, make sure it gets passed to every file
  14. # We had a customer reported bug where some code built in kernel was NOT using
  15. # any kernel headers, and missing the r25 global register
  16. # Can't do unconditionally (like above) because of recursive include issues
  17. # due to <linux/thread_info.h>
  18. LINUXINCLUDE += -include ${src}/arch/arc/include/asm/current.h
  19. endif
  20. atleast_gcc44 := $(call cc-ifversion, -gt, 0402, y)
  21. cflags-$(atleast_gcc44) += -fsection-anchors
  22. cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock
  23. cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
  24. cflags-$(CONFIG_ARC_HAS_RTSC) += -mrtsc
  25. cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables
  26. ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
  27. # Generic build system uses -O2, we want -O3
  28. cflags-y += -O3
  29. endif
  30. # small data is default for elf32 tool-chain. If not usable, disable it
  31. # This also allows repurposing GP as scratch reg to gcc reg allocator
  32. disable_small_data := y
  33. cflags-$(disable_small_data) += -mno-sdata -fcall-used-gp
  34. cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian
  35. ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
  36. # STAR 9000518362:
  37. # arc-linux-uclibc-ld (buildroot) or arceb-elf32-ld (EZChip) don't accept
  38. # --build-id w/o "-marclinux".
  39. # Default arc-elf32-ld is OK
  40. ldflags-y += -marclinux
  41. ARC_LIBGCC := -mA7
  42. cflags-$(CONFIG_ARC_HAS_HW_MPY) += -multcost=16
  43. ifndef CONFIG_ARC_HAS_HW_MPY
  44. cflags-y += -mno-mpy
  45. # newlib for ARC700 assumes MPY to be always present, which is generally true
  46. # However, if someone really doesn't want MPY, we need to use the 600 ver
  47. # which coupled with -mno-mpy will use mpy emulation
  48. # With gcc 4.4.7, -mno-mpy is enough to make any other related adjustments,
  49. # e.g. increased cost of MPY. With gcc 4.2.1 this had to be explicitly hinted
  50. ARC_LIBGCC := -marc600
  51. ifneq ($(atleast_gcc44),y)
  52. cflags-y += -multcost=30
  53. endif
  54. endif
  55. LIBGCC := $(shell $(CC) $(ARC_LIBGCC) $(cflags-y) --print-libgcc-file-name)
  56. # Modules with short calls might break for calls into builtin-kernel
  57. KBUILD_CFLAGS_MODULE += -mlong-calls
  58. # Finally dump eveything into kernel build system
  59. KBUILD_CFLAGS += $(cflags-y)
  60. KBUILD_AFLAGS += $(KBUILD_CFLAGS)
  61. LDFLAGS += $(ldflags-y)
  62. head-y := arch/arc/kernel/head.o
  63. # See arch/arc/Kbuild for content of core part of the kernel
  64. core-y += arch/arc/
  65. # w/o this dtb won't embed into kernel binary
  66. core-y += arch/arc/boot/dts/
  67. core-$(CONFIG_ARC_PLAT_FPGA_LEGACY) += arch/arc/plat-arcfpga/
  68. drivers-$(CONFIG_OPROFILE) += arch/arc/oprofile/
  69. libs-y += arch/arc/lib/ $(LIBGCC)
  70. #default target for make without any arguements.
  71. KBUILD_IMAGE := bootpImage
  72. all: $(KBUILD_IMAGE)
  73. boot := arch/arc/boot
  74. bootpImage: vmlinux
  75. uImage: vmlinux
  76. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  77. %.dtb %.dtb.S %.dtb.o: scripts
  78. $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
  79. dtbs: scripts
  80. $(Q)$(MAKE) $(build)=$(boot)/dts dtbs
  81. archclean:
  82. $(Q)$(MAKE) $(clean)=$(boot)
  83. # Hacks to enable final link due to absence of link-time branch relexation
  84. # and gcc choosing optimal(shorter) branches at -O3
  85. #
  86. # vineetg Feb 2010: -mlong-calls switched off for overall kernel build
  87. # However lib/decompress_inflate.o (.init.text) calls
  88. # zlib_inflate_workspacesize (.text) causing relocation errors.
  89. # Thus forcing all exten calls in this file to be long calls
  90. export CFLAGS_decompress_inflate.o = -mmedium-calls
  91. export CFLAGS_initramfs.o = -mmedium-calls
  92. ifdef CONFIG_SMP
  93. export CFLAGS_core.o = -mmedium-calls
  94. endif