Makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. #
  3. # Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
  4. #
  5. KBUILD_DEFCONFIG := haps_hs_smp_defconfig
  6. ifeq ($(CROSS_COMPILE),)
  7. CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-)
  8. endif
  9. cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
  10. tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mcpu=arc700
  11. tune-mcpu-def-$(CONFIG_ISA_ARCV2) := -mcpu=hs38
  12. ifeq ($(CONFIG_ARC_TUNE_MCPU),"")
  13. cflags-y += $(tune-mcpu-def-y)
  14. else
  15. tune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU))
  16. tune-mcpu-ok := $(call cc-option-yn, $(tune-mcpu))
  17. ifeq ($(tune-mcpu-ok),y)
  18. cflags-y += $(tune-mcpu)
  19. else
  20. # The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
  21. # (probably the compiler is too old). Use ISA default mcpu flag instead as a safe option.
  22. $(warning ** WARNING ** CONFIG_ARC_TUNE_MCPU flag '$(tune-mcpu)' is unknown, fallback to '$(tune-mcpu-def-y)')
  23. cflags-y += $(tune-mcpu-def-y)
  24. endif
  25. endif
  26. ifdef CONFIG_ARC_CURR_IN_REG
  27. # For a global register defintion, make sure it gets passed to every file
  28. # We had a customer reported bug where some code built in kernel was NOT using
  29. # any kernel headers, and missing the r25 global register
  30. # Can't do unconditionally because of recursive include issues
  31. # due to <linux/thread_info.h>
  32. LINUXINCLUDE += -include $(srctree)/arch/arc/include/asm/current.h
  33. endif
  34. cflags-y += -fsection-anchors
  35. cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock
  36. cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
  37. ifdef CONFIG_ISA_ARCV2
  38. ifdef CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS
  39. cflags-y += -munaligned-access
  40. else
  41. cflags-y += -mno-unaligned-access
  42. endif
  43. ifndef CONFIG_ARC_HAS_LL64
  44. cflags-y += -mno-ll64
  45. endif
  46. ifndef CONFIG_ARC_HAS_DIV_REM
  47. cflags-y += -mno-div-rem
  48. endif
  49. endif
  50. cfi := $(call as-instr,.cfi_startproc\n.cfi_endproc,-DARC_DW2_UNWIND_AS_CFI)
  51. cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables $(cfi)
  52. # small data is default for elf32 tool-chain. If not usable, disable it
  53. # This also allows repurposing GP as scratch reg to gcc reg allocator
  54. disable_small_data := y
  55. cflags-$(disable_small_data) += -mno-sdata -fcall-used-gp
  56. cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian
  57. ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
  58. LIBGCC = $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
  59. # Modules with short calls might break for calls into builtin-kernel
  60. KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode
  61. # Finally dump eveything into kernel build system
  62. KBUILD_CFLAGS += $(cflags-y)
  63. KBUILD_AFLAGS += $(KBUILD_CFLAGS)
  64. KBUILD_LDFLAGS += $(ldflags-y)
  65. head-y := arch/arc/kernel/head.o
  66. # See arch/arc/Kbuild for content of core part of the kernel
  67. core-y += arch/arc/
  68. # w/o this dtb won't embed into kernel binary
  69. core-y += arch/arc/boot/dts/
  70. core-y += arch/arc/plat-sim/
  71. core-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/
  72. core-$(CONFIG_ARC_PLAT_AXS10X) += arch/arc/plat-axs10x/
  73. core-$(CONFIG_ARC_SOC_HSDK) += arch/arc/plat-hsdk/
  74. drivers-$(CONFIG_OPROFILE) += arch/arc/oprofile/
  75. libs-y += arch/arc/lib/ $(LIBGCC)
  76. boot := arch/arc/boot
  77. boot_targets := uImage.bin uImage.gz uImage.lzma
  78. PHONY += $(boot_targets)
  79. $(boot_targets): vmlinux
  80. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  81. uimage-default-y := uImage.bin
  82. uimage-default-$(CONFIG_KERNEL_GZIP) := uImage.gz
  83. uimage-default-$(CONFIG_KERNEL_LZMA) := uImage.lzma
  84. PHONY += uImage
  85. uImage: $(uimage-default-y)
  86. @ln -sf $< $(boot)/uImage
  87. @$(kecho) ' Image $(boot)/uImage is ready'
  88. CLEAN_FILES += $(boot)/uImage
  89. archclean:
  90. $(Q)$(MAKE) $(clean)=$(boot)