Makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. # For ARC FPGA Platforms
  11. platform-$(CONFIG_ARC_PLAT_FPGA_LEGACY) := arcfpga
  12. #New platform adds here
  13. PLATFORM := $(platform-y)
  14. export PLATFORM
  15. cflags-y += -Iarch/arc/plat-$(PLATFORM)/include
  16. cflags-y += -mA7 -fno-common -pipe -fno-builtin -D__linux__
  17. atleast_gcc44 := $(call cc-ifversion, -gt, 0402, y)
  18. cflags-$(atleast_gcc44) += -fsection-anchors
  19. cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock
  20. cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
  21. cflags-$(CONFIG_ARC_HAS_RTSC) += -mrtsc
  22. cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables
  23. ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
  24. # Generic build system uses -O2, we want -O3
  25. cflags-y += -O3
  26. endif
  27. # small data is default for elf32 tool-chain. If not usable, disable it
  28. # This also allows repurposing GP as scratch reg to gcc reg allocator
  29. disable_small_data := y
  30. cflags-$(disable_small_data) += -mno-sdata -fcall-used-gp
  31. cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian
  32. ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
  33. # STAR 9000518362:
  34. # arc-linux-uclibc-ld (buildroot) or arceb-elf32-ld (EZChip) don't accept
  35. # --build-id w/o "-marclinux".
  36. # Default arc-elf32-ld is OK
  37. ldflags-y += -marclinux
  38. ARC_LIBGCC := -mA7
  39. cflags-$(CONFIG_ARC_HAS_HW_MPY) += -multcost=16
  40. ifndef CONFIG_ARC_HAS_HW_MPY
  41. cflags-y += -mno-mpy
  42. # newlib for ARC700 assumes MPY to be always present, which is generally true
  43. # However, if someone really doesn't want MPY, we need to use the 600 ver
  44. # which coupled with -mno-mpy will use mpy emulation
  45. # With gcc 4.4.7, -mno-mpy is enough to make any other related adjustments,
  46. # e.g. increased cost of MPY. With gcc 4.2.1 this had to be explicitly hinted
  47. ARC_LIBGCC := -marc600
  48. ifneq ($(atleast_gcc44),y)
  49. cflags-y += -multcost=30
  50. endif
  51. endif
  52. LIBGCC := $(shell $(CC) $(ARC_LIBGCC) $(cflags-y) --print-libgcc-file-name)
  53. # Modules with short calls might break for calls into builtin-kernel
  54. KBUILD_CFLAGS_MODULE += -mlong-calls
  55. # Finally dump eveything into kernel build system
  56. KBUILD_CFLAGS += $(cflags-y)
  57. KBUILD_AFLAGS += $(KBUILD_CFLAGS)
  58. LDFLAGS += $(ldflags-y)
  59. # Needed for Linker script preprocessing
  60. KBUILD_CPPFLAGS += -Iarch/arc/plat-$(PLATFORM)/include
  61. head-y := arch/arc/kernel/head.o
  62. # See arch/arc/Kbuild for content of core part of the kernel
  63. core-y += arch/arc/
  64. # w/o this dtb won't embed into kernel binary
  65. core-y += arch/arc/boot/dts/
  66. # w/o this ifneq, make ARCH=arc clean was crapping out
  67. ifneq ($(platform-y),)
  68. core-y += arch/arc/plat-$(PLATFORM)/
  69. endif
  70. libs-y += arch/arc/lib/ $(LIBGCC)
  71. #default target for make without any arguements.
  72. KBUILD_IMAGE := bootpImage
  73. all: $(KBUILD_IMAGE)
  74. boot := arch/arc/boot
  75. bootpImage: vmlinux
  76. uImage: vmlinux
  77. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  78. %.dtb %.dtb.S %.dtb.o: scripts
  79. $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
  80. dtbs: scripts
  81. $(Q)$(MAKE) $(build)=$(boot)/dts dtbs
  82. archclean:
  83. $(Q)$(MAKE) $(clean)=$(boot)
  84. # Hacks to enable final link due to absence of link-time branch relexation
  85. # and gcc choosing optimal(shorter) branches at -O3
  86. #
  87. # vineetg Feb 2010: -mlong-calls switched off for overall kernel build
  88. # However lib/decompress_inflate.o (.init.text) calls
  89. # zlib_inflate_workspacesize (.text) causing relocation errors.
  90. # Thus forcing all exten calls in this file to be long calls
  91. export CFLAGS_decompress_inflate.o = -mmedium-calls
  92. export CFLAGS_initramfs.o = -mmedium-calls