blob: 0c6bf0d1df7ad1ea1028f649559829cf6cca0793 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001# SPDX-License-Identifier: GPL-2.0-only
Vineet Guptacfdbc2e2013-01-18 15:12:20 +05302#
3# Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
4#
Vineet Guptacfdbc2e2013-01-18 15:12:20 +05305
Eugeniy Paltsev1681baa2019-10-23 15:44:15 +03006KBUILD_DEFCONFIG := haps_hs_smp_defconfig
Vineet Guptacfdbc2e2013-01-18 15:12:20 +05307
Alexey Brodkin2bc42bf2019-06-03 09:31:19 +03008ifeq ($(CROSS_COMPILE),)
9CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-)
10endif
11
Alexey Brodkin74c11e32018-06-01 14:34:33 +030012cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
Eugeniy Paltsev0bdd6e72020-06-04 20:39:24 +030013
Vineet Gupta040ece22020-06-16 15:14:50 -070014tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mcpu=arc700
Eugeniy Paltsev0bdd6e72020-06-04 20:39:24 +030015tune-mcpu-def-$(CONFIG_ISA_ARCV2) := -mcpu=hs38
16
17ifeq ($(CONFIG_ARC_TUNE_MCPU),"")
18cflags-y += $(tune-mcpu-def-y)
19else
20tune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU))
21tune-mcpu-ok := $(call cc-option-yn, $(tune-mcpu))
22ifeq ($(tune-mcpu-ok),y)
23cflags-y += $(tune-mcpu)
24else
25# The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
26# (probably the compiler is too old). Use ISA default mcpu flag instead as a safe option.
27$(warning ** WARNING ** CONFIG_ARC_TUNE_MCPU flag '$(tune-mcpu)' is unknown, fallback to '$(tune-mcpu-def-y)')
28cflags-y += $(tune-mcpu-def-y)
29endif
30endif
31
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053032
Vineet Gupta080c3742013-02-11 19:52:57 +053033ifdef CONFIG_ARC_CURR_IN_REG
34# For a global register defintion, make sure it gets passed to every file
35# We had a customer reported bug where some code built in kernel was NOT using
36# any kernel headers, and missing the r25 global register
Vineet Gupta82357032013-06-01 12:55:42 +053037# Can't do unconditionally because of recursive include issues
Vineet Gupta080c3742013-02-11 19:52:57 +053038# due to <linux/thread_info.h>
Masahiro Yamada75dd4742019-07-06 12:07:11 +090039LINUXINCLUDE += -include $(srctree)/arch/arc/include/asm/current.h
Vineet Gupta080c3742013-02-11 19:52:57 +053040endif
41
Masahiro Yamada2b52e2a2018-08-27 12:07:37 +090042cflags-y += -fsection-anchors
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053043
Vineet Gupta76a08402016-11-08 08:47:14 -080044cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock
45cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
46
Alexey Brodkind05a76a2015-07-16 21:45:38 +030047ifdef CONFIG_ISA_ARCV2
48
Eugeniy Paltsev76551462019-01-30 19:32:41 +030049ifdef CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS
50cflags-y += -munaligned-access
51else
52cflags-y += -mno-unaligned-access
53endif
54
Vineet Gupta1f6ccff2013-05-13 18:30:41 +053055ifndef CONFIG_ARC_HAS_LL64
Alexey Brodkind05a76a2015-07-16 21:45:38 +030056cflags-y += -mno-ll64
57endif
58
59ifndef CONFIG_ARC_HAS_DIV_REM
60cflags-y += -mno-div-rem
61endif
62
Vineet Gupta1f6ccff2013-05-13 18:30:41 +053063endif
64
Vineet Gupta5a205a32016-09-16 17:23:26 -070065cfi := $(call as-instr,.cfi_startproc\n.cfi_endproc,-DARC_DW2_UNWIND_AS_CFI)
66cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables $(cfi)
Vineet Gupta6716dbb2013-06-24 21:22:06 +053067
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053068# small data is default for elf32 tool-chain. If not usable, disable it
69# This also allows repurposing GP as scratch reg to gcc reg allocator
70disable_small_data := y
71cflags-$(disable_small_data) += -mno-sdata -fcall-used-gp
72
73cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian
74ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
75
Alexey Brodkin40660f12018-09-16 23:47:57 +030076LIBGCC = $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053077
78# Modules with short calls might break for calls into builtin-kernel
Vineet Gupta07fd7d42015-12-21 12:38:01 +053079KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053080
81# Finally dump eveything into kernel build system
82KBUILD_CFLAGS += $(cflags-y)
83KBUILD_AFLAGS += $(KBUILD_CFLAGS)
Masahiro Yamadad503ac52018-08-24 08:20:39 +090084KBUILD_LDFLAGS += $(ldflags-y)
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053085
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053086head-y := arch/arc/kernel/head.o
87
88# See arch/arc/Kbuild for content of core part of the kernel
89core-y += arch/arc/
90
Vineet Gupta999159a2013-01-22 17:00:52 +053091# w/o this dtb won't embed into kernel binary
92core-y += arch/arc/boot/dts/
93
Vineet Gupta33460f82017-07-28 16:53:50 +053094core-y += arch/arc/plat-sim/
Vineet Guptafd155792015-02-20 19:12:18 +053095core-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/
Alexey Brodkin556cc1c2014-01-27 14:51:34 +010096core-$(CONFIG_ARC_PLAT_AXS10X) += arch/arc/plat-axs10x/
Alexey Brodkina518d632017-08-15 21:13:55 +030097core-$(CONFIG_ARC_SOC_HSDK) += arch/arc/plat-hsdk/
Noam Camus966657892015-10-16 16:52:43 +030098
Vineet Gupta769bc1f2013-01-22 17:02:38 +053099drivers-$(CONFIG_OPROFILE) += arch/arc/oprofile/
100
Vineet Guptacfdbc2e2013-01-18 15:12:20 +0530101libs-y += arch/arc/lib/ $(LIBGCC)
102
Vineet Guptafb0990b2013-03-22 19:48:01 +0530103boot := arch/arc/boot
104
Andrea Gelmini25474762016-05-21 13:45:35 +0200105#default target for make without any arguments.
Michal Marek5e40f0f2016-11-22 22:34:31 +0100106KBUILD_IMAGE := $(boot)/bootpImage
Vineet Guptacfdbc2e2013-01-18 15:12:20 +0530107
Michal Marek5e40f0f2016-11-22 22:34:31 +0100108all: bootpImage
Vineet Guptacfdbc2e2013-01-18 15:12:20 +0530109bootpImage: vmlinux
110
Vineet Gupta104058e2013-03-22 22:04:27 +0530111boot_targets += uImage uImage.bin uImage.gz
112
113$(boot_targets): vmlinux
Vineet Guptacfdbc2e2013-01-18 15:12:20 +0530114 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
115
Vineet Guptacfdbc2e2013-01-18 15:12:20 +0530116archclean:
117 $(Q)$(MAKE) $(clean)=$(boot)