1d2912cb1SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only 2cfdbc2e1SVineet Gupta# 3cfdbc2e1SVineet Gupta# Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 4cfdbc2e1SVineet Gupta# 5cfdbc2e1SVineet Gupta 61681baa7SEugeniy PaltsevKBUILD_DEFCONFIG := haps_hs_smp_defconfig 7cfdbc2e1SVineet Gupta 82bc42bfbSAlexey Brodkinifeq ($(CROSS_COMPILE),) 92bc42bfbSAlexey BrodkinCROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-) 102bc42bfbSAlexey Brodkinendif 112bc42bfbSAlexey Brodkin 1274c11e30SAlexey Brodkincflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ 130bdd6e74SEugeniy Paltsev 14*040ece2aSVineet Guptatune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mcpu=arc700 150bdd6e74SEugeniy Paltsevtune-mcpu-def-$(CONFIG_ISA_ARCV2) := -mcpu=hs38 160bdd6e74SEugeniy Paltsev 170bdd6e74SEugeniy Paltsevifeq ($(CONFIG_ARC_TUNE_MCPU),"") 180bdd6e74SEugeniy Paltsevcflags-y += $(tune-mcpu-def-y) 190bdd6e74SEugeniy Paltsevelse 200bdd6e74SEugeniy Paltsevtune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU)) 210bdd6e74SEugeniy Paltsevtune-mcpu-ok := $(call cc-option-yn, $(tune-mcpu)) 220bdd6e74SEugeniy Paltsevifeq ($(tune-mcpu-ok),y) 230bdd6e74SEugeniy Paltsevcflags-y += $(tune-mcpu) 240bdd6e74SEugeniy Paltsevelse 250bdd6e74SEugeniy Paltsev# The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler 260bdd6e74SEugeniy Paltsev# (probably the compiler is too old). Use ISA default mcpu flag instead as a safe option. 270bdd6e74SEugeniy Paltsev$(warning ** WARNING ** CONFIG_ARC_TUNE_MCPU flag '$(tune-mcpu)' is unknown, fallback to '$(tune-mcpu-def-y)') 280bdd6e74SEugeniy Paltsevcflags-y += $(tune-mcpu-def-y) 290bdd6e74SEugeniy Paltsevendif 300bdd6e74SEugeniy Paltsevendif 310bdd6e74SEugeniy Paltsev 32cfdbc2e1SVineet Gupta 33080c3747SVineet Guptaifdef CONFIG_ARC_CURR_IN_REG 34080c3747SVineet Gupta# For a global register defintion, make sure it gets passed to every file 35080c3747SVineet Gupta# We had a customer reported bug where some code built in kernel was NOT using 36080c3747SVineet Gupta# any kernel headers, and missing the r25 global register 378235703eSVineet Gupta# Can't do unconditionally because of recursive include issues 38080c3747SVineet Gupta# due to <linux/thread_info.h> 3975dd4747SMasahiro YamadaLINUXINCLUDE += -include $(srctree)/arch/arc/include/asm/current.h 40080c3747SVineet Guptaendif 41080c3747SVineet Gupta 422b52e2a6SMasahiro Yamadacflags-y += -fsection-anchors 43cfdbc2e1SVineet Gupta 4476a08404SVineet Guptacflags-$(CONFIG_ARC_HAS_LLSC) += -mlock 4576a08404SVineet Guptacflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape 4676a08404SVineet Gupta 47d05a76abSAlexey Brodkinifdef CONFIG_ISA_ARCV2 48d05a76abSAlexey Brodkin 4976551468SEugeniy Paltsevifdef CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS 5076551468SEugeniy Paltsevcflags-y += -munaligned-access 5176551468SEugeniy Paltsevelse 5276551468SEugeniy Paltsevcflags-y += -mno-unaligned-access 5376551468SEugeniy Paltsevendif 5476551468SEugeniy Paltsev 551f6ccfffSVineet Guptaifndef CONFIG_ARC_HAS_LL64 56d05a76abSAlexey Brodkincflags-y += -mno-ll64 57d05a76abSAlexey Brodkinendif 58d05a76abSAlexey Brodkin 59d05a76abSAlexey Brodkinifndef CONFIG_ARC_HAS_DIV_REM 60d05a76abSAlexey Brodkincflags-y += -mno-div-rem 61d05a76abSAlexey Brodkinendif 62d05a76abSAlexey Brodkin 631f6ccfffSVineet Guptaendif 641f6ccfffSVineet Gupta 655a205a32SVineet Guptacfi := $(call as-instr,.cfi_startproc\n.cfi_endproc,-DARC_DW2_UNWIND_AS_CFI) 665a205a32SVineet Guptacflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables $(cfi) 676716dbbdSVineet Gupta 68cfdbc2e1SVineet Gupta# small data is default for elf32 tool-chain. If not usable, disable it 69cfdbc2e1SVineet Gupta# This also allows repurposing GP as scratch reg to gcc reg allocator 70cfdbc2e1SVineet Guptadisable_small_data := y 71cfdbc2e1SVineet Guptacflags-$(disable_small_data) += -mno-sdata -fcall-used-gp 72cfdbc2e1SVineet Gupta 73cfdbc2e1SVineet Guptacflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian 74cfdbc2e1SVineet Guptaldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB 75cfdbc2e1SVineet Gupta 7640660f1fSAlexey BrodkinLIBGCC = $(shell $(CC) $(cflags-y) --print-libgcc-file-name) 77cfdbc2e1SVineet Gupta 78cfdbc2e1SVineet Gupta# Modules with short calls might break for calls into builtin-kernel 7907fd7d4bSVineet GuptaKBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode 80cfdbc2e1SVineet Gupta 81cfdbc2e1SVineet Gupta# Finally dump eveything into kernel build system 82cfdbc2e1SVineet GuptaKBUILD_CFLAGS += $(cflags-y) 83cfdbc2e1SVineet GuptaKBUILD_AFLAGS += $(KBUILD_CFLAGS) 84d503ac53SMasahiro YamadaKBUILD_LDFLAGS += $(ldflags-y) 85cfdbc2e1SVineet Gupta 86cfdbc2e1SVineet Guptahead-y := arch/arc/kernel/head.o 87cfdbc2e1SVineet Gupta 88cfdbc2e1SVineet Gupta# See arch/arc/Kbuild for content of core part of the kernel 89cfdbc2e1SVineet Guptacore-y += arch/arc/ 90cfdbc2e1SVineet Gupta 91999159a5SVineet Gupta# w/o this dtb won't embed into kernel binary 92999159a5SVineet Guptacore-y += arch/arc/boot/dts/ 93999159a5SVineet Gupta 9433460f86SVineet Guptacore-y += arch/arc/plat-sim/ 95072eb693SChristian Ruppertcore-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/ 96556cc1c5SAlexey Brodkincore-$(CONFIG_ARC_PLAT_AXS10X) += arch/arc/plat-axs10x/ 9796665789SNoam Camuscore-$(CONFIG_ARC_PLAT_EZNPS) += arch/arc/plat-eznps/ 98a518d637SAlexey Brodkincore-$(CONFIG_ARC_SOC_HSDK) += arch/arc/plat-hsdk/ 9996665789SNoam Camus 10096665789SNoam Camusifdef CONFIG_ARC_PLAT_EZNPS 10196665789SNoam CamusKBUILD_CPPFLAGS += -I$(srctree)/arch/arc/plat-eznps/include 10296665789SNoam Camusendif 103cfdbc2e1SVineet Gupta 104769bc1fdSVineet Guptadrivers-$(CONFIG_OPROFILE) += arch/arc/oprofile/ 105769bc1fdSVineet Gupta 106cfdbc2e1SVineet Guptalibs-y += arch/arc/lib/ $(LIBGCC) 107cfdbc2e1SVineet Gupta 108fb0990bbSVineet Guptaboot := arch/arc/boot 109fb0990bbSVineet Gupta 1102547476aSAndrea Gelmini#default target for make without any arguments. 1115e40f0fdSMichal MarekKBUILD_IMAGE := $(boot)/bootpImage 112cfdbc2e1SVineet Gupta 1135e40f0fdSMichal Marekall: bootpImage 114cfdbc2e1SVineet GuptabootpImage: vmlinux 115cfdbc2e1SVineet Gupta 116104058edSVineet Guptaboot_targets += uImage uImage.bin uImage.gz 117104058edSVineet Gupta 118104058edSVineet Gupta$(boot_targets): vmlinux 119cfdbc2e1SVineet Gupta $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 120cfdbc2e1SVineet Gupta 121cfdbc2e1SVineet Guptaarchclean: 122cfdbc2e1SVineet Gupta $(Q)$(MAKE) $(clean)=$(boot) 123