Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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 := $(CONFIG_ARC_TUNE_MCPU)
  16. ifneq ($(call cc-option,$(tune-mcpu)),)
  17. cflags-y += $(tune-mcpu)
  18. else
  19. # The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
  20. # (probably the compiler is too old). Use ISA default mcpu flag instead as a safe option.
  21. $(warning ** WARNING ** CONFIG_ARC_TUNE_MCPU flag '$(tune-mcpu)' is unknown, fallback to '$(tune-mcpu-def-y)')
  22. cflags-y += $(tune-mcpu-def-y)
  23. endif
  24. endif
  25. ifdef CONFIG_ARC_CURR_IN_REG
  26. # For a global register definition, make sure it gets passed to every file
  27. # We had a customer reported bug where some code built in kernel was NOT using
  28. # any kernel headers, and missing the r25 global register
  29. # Can't do unconditionally because of recursive include issues
  30. # due to <linux/thread_info.h>
  31. LINUXINCLUDE += -include $(srctree)/arch/arc/include/asm/current.h
  32. endif
  33. cflags-y += -fsection-anchors
  34. cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock
  35. cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
  36. ifdef CONFIG_ISA_ARCV2
  37. ifdef CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS
  38. cflags-y += -munaligned-access
  39. else
  40. cflags-y += -mno-unaligned-access
  41. endif
  42. ifndef CONFIG_ARC_HAS_LL64
  43. cflags-y += -mno-ll64
  44. endif
  45. ifndef CONFIG_ARC_HAS_DIV_REM
  46. cflags-y += -mno-div-rem
  47. endif
  48. endif
  49. cfi := $(call as-instr,.cfi_startproc\n.cfi_endproc,-DARC_DW2_UNWIND_AS_CFI)
  50. cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables $(cfi)
  51. # small data is default for elf32 tool-chain. If not usable, disable it
  52. # This also allows repurposing GP as scratch reg to gcc reg allocator
  53. disable_small_data := y
  54. cflags-$(disable_small_data) += -mno-sdata -fcall-used-gp
  55. cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian
  56. ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
  57. LIBGCC = $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
  58. # Modules with short calls might break for calls into builtin-kernel
  59. KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode
  60. # Finally dump eveything into kernel build system
  61. KBUILD_CFLAGS += $(cflags-y)
  62. KBUILD_AFLAGS += $(KBUILD_CFLAGS)
  63. KBUILD_LDFLAGS += $(ldflags-y)
  64. # w/o this dtb won't embed into kernel binary
  65. core-y += arch/arc/boot/dts/
  66. core-y += arch/arc/plat-sim/
  67. core-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/
  68. core-$(CONFIG_ARC_PLAT_AXS10X) += arch/arc/plat-axs10x/
  69. core-$(CONFIG_ARC_SOC_HSDK) += arch/arc/plat-hsdk/
  70. libs-y += arch/arc/lib/ $(LIBGCC)
  71. boot := arch/arc/boot
  72. boot_targets := uImage.bin uImage.gz uImage.lzma
  73. PHONY += $(boot_targets)
  74. $(boot_targets): vmlinux
  75. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  76. uimage-default-y := uImage.bin
  77. uimage-default-$(CONFIG_KERNEL_GZIP) := uImage.gz
  78. uimage-default-$(CONFIG_KERNEL_LZMA) := uImage.lzma
  79. PHONY += uImage
  80. uImage: $(uimage-default-y)
  81. @ln -sf $< $(boot)/uImage
  82. @$(kecho) ' Image $(boot)/uImage is ready'
  83. CLEAN_FILES += $(boot)/uImage