18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci# 38c2ecf20Sopenharmony_ci# Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 48c2ecf20Sopenharmony_ci# 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ciKBUILD_DEFCONFIG := haps_hs_smp_defconfig 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ciifeq ($(CROSS_COMPILE),) 98c2ecf20Sopenharmony_ciCROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-) 108c2ecf20Sopenharmony_ciendif 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_cicflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_citune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mcpu=arc700 158c2ecf20Sopenharmony_citune-mcpu-def-$(CONFIG_ISA_ARCV2) := -mcpu=hs38 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ciifeq ($(CONFIG_ARC_TUNE_MCPU),"") 188c2ecf20Sopenharmony_cicflags-y += $(tune-mcpu-def-y) 198c2ecf20Sopenharmony_cielse 208c2ecf20Sopenharmony_citune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU)) 218c2ecf20Sopenharmony_citune-mcpu-ok := $(call cc-option-yn, $(tune-mcpu)) 228c2ecf20Sopenharmony_ciifeq ($(tune-mcpu-ok),y) 238c2ecf20Sopenharmony_cicflags-y += $(tune-mcpu) 248c2ecf20Sopenharmony_cielse 258c2ecf20Sopenharmony_ci# The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler 268c2ecf20Sopenharmony_ci# (probably the compiler is too old). Use ISA default mcpu flag instead as a safe option. 278c2ecf20Sopenharmony_ci$(warning ** WARNING ** CONFIG_ARC_TUNE_MCPU flag '$(tune-mcpu)' is unknown, fallback to '$(tune-mcpu-def-y)') 288c2ecf20Sopenharmony_cicflags-y += $(tune-mcpu-def-y) 298c2ecf20Sopenharmony_ciendif 308c2ecf20Sopenharmony_ciendif 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ciifdef CONFIG_ARC_CURR_IN_REG 348c2ecf20Sopenharmony_ci# For a global register defintion, make sure it gets passed to every file 358c2ecf20Sopenharmony_ci# We had a customer reported bug where some code built in kernel was NOT using 368c2ecf20Sopenharmony_ci# any kernel headers, and missing the r25 global register 378c2ecf20Sopenharmony_ci# Can't do unconditionally because of recursive include issues 388c2ecf20Sopenharmony_ci# due to <linux/thread_info.h> 398c2ecf20Sopenharmony_ciLINUXINCLUDE += -include $(srctree)/arch/arc/include/asm/current.h 408c2ecf20Sopenharmony_ciendif 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_cicflags-y += -fsection-anchors 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cicflags-$(CONFIG_ARC_HAS_LLSC) += -mlock 458c2ecf20Sopenharmony_cicflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ciifdef CONFIG_ISA_ARCV2 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ciifdef CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS 508c2ecf20Sopenharmony_cicflags-y += -munaligned-access 518c2ecf20Sopenharmony_cielse 528c2ecf20Sopenharmony_cicflags-y += -mno-unaligned-access 538c2ecf20Sopenharmony_ciendif 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ciifndef CONFIG_ARC_HAS_LL64 568c2ecf20Sopenharmony_cicflags-y += -mno-ll64 578c2ecf20Sopenharmony_ciendif 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ciifndef CONFIG_ARC_HAS_DIV_REM 608c2ecf20Sopenharmony_cicflags-y += -mno-div-rem 618c2ecf20Sopenharmony_ciendif 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ciendif 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_cicfi := $(call as-instr,.cfi_startproc\n.cfi_endproc,-DARC_DW2_UNWIND_AS_CFI) 668c2ecf20Sopenharmony_cicflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables $(cfi) 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci# small data is default for elf32 tool-chain. If not usable, disable it 698c2ecf20Sopenharmony_ci# This also allows repurposing GP as scratch reg to gcc reg allocator 708c2ecf20Sopenharmony_cidisable_small_data := y 718c2ecf20Sopenharmony_cicflags-$(disable_small_data) += -mno-sdata -fcall-used-gp 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_cicflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian 748c2ecf20Sopenharmony_cildflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ciLIBGCC = $(shell $(CC) $(cflags-y) --print-libgcc-file-name) 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci# Modules with short calls might break for calls into builtin-kernel 798c2ecf20Sopenharmony_ciKBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci# Finally dump eveything into kernel build system 828c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(cflags-y) 838c2ecf20Sopenharmony_ciKBUILD_AFLAGS += $(KBUILD_CFLAGS) 848c2ecf20Sopenharmony_ciKBUILD_LDFLAGS += $(ldflags-y) 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_cihead-y := arch/arc/kernel/head.o 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci# See arch/arc/Kbuild for content of core part of the kernel 898c2ecf20Sopenharmony_cicore-y += arch/arc/ 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci# w/o this dtb won't embed into kernel binary 928c2ecf20Sopenharmony_cicore-y += arch/arc/boot/dts/ 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_cicore-y += arch/arc/plat-sim/ 958c2ecf20Sopenharmony_cicore-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/ 968c2ecf20Sopenharmony_cicore-$(CONFIG_ARC_PLAT_AXS10X) += arch/arc/plat-axs10x/ 978c2ecf20Sopenharmony_cicore-$(CONFIG_ARC_SOC_HSDK) += arch/arc/plat-hsdk/ 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_cidrivers-$(CONFIG_OPROFILE) += arch/arc/oprofile/ 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_cilibs-y += arch/arc/lib/ $(LIBGCC) 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ciboot := arch/arc/boot 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ciboot_targets := uImage.bin uImage.gz uImage.lzma 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ciPHONY += $(boot_targets) 1088c2ecf20Sopenharmony_ci$(boot_targets): vmlinux 1098c2ecf20Sopenharmony_ci $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ciuimage-default-y := uImage.bin 1128c2ecf20Sopenharmony_ciuimage-default-$(CONFIG_KERNEL_GZIP) := uImage.gz 1138c2ecf20Sopenharmony_ciuimage-default-$(CONFIG_KERNEL_LZMA) := uImage.lzma 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ciPHONY += uImage 1168c2ecf20Sopenharmony_ciuImage: $(uimage-default-y) 1178c2ecf20Sopenharmony_ci @ln -sf $< $(boot)/uImage 1188c2ecf20Sopenharmony_ci @$(kecho) ' Image $(boot)/uImage is ready' 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ciCLEAN_FILES += $(boot)/uImage 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ciarchclean: 1238c2ecf20Sopenharmony_ci $(Q)$(MAKE) $(clean)=$(boot) 124