blob: 480af1af9e63dba43ae9a2aa72698f99f9593154 [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
Kevin Hilmanb7cc40c2018-11-30 15:51:56 +03006KBUILD_DEFCONFIG := nsim_hs_defconfig
Vineet Guptacfdbc2e2013-01-18 15:12:20 +05307
Alexey Brodkin74c11e32018-06-01 14:34:33 +03008cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
Vineet Gupta40b8ad82015-06-28 20:22:01 +05309cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
Vineet Gupta00a99332018-09-07 15:13:10 -070010cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053011
Vineet Gupta080c3742013-02-11 19:52:57 +053012ifdef CONFIG_ARC_CURR_IN_REG
13# For a global register defintion, make sure it gets passed to every file
14# We had a customer reported bug where some code built in kernel was NOT using
15# any kernel headers, and missing the r25 global register
Vineet Gupta82357032013-06-01 12:55:42 +053016# Can't do unconditionally because of recursive include issues
Vineet Gupta080c3742013-02-11 19:52:57 +053017# due to <linux/thread_info.h>
18LINUXINCLUDE += -include ${src}/arch/arc/include/asm/current.h
19endif
20
Masahiro Yamada2b52e2a2018-08-27 12:07:37 +090021cflags-y += -fsection-anchors
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053022
Vineet Gupta76a08402016-11-08 08:47:14 -080023cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock
24cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
25
Alexey Brodkind05a76a2015-07-16 21:45:38 +030026ifdef CONFIG_ISA_ARCV2
27
Eugeniy Paltsev76551462019-01-30 19:32:41 +030028ifdef CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS
29cflags-y += -munaligned-access
30else
31cflags-y += -mno-unaligned-access
32endif
33
Vineet Gupta1f6ccff2013-05-13 18:30:41 +053034ifndef CONFIG_ARC_HAS_LL64
Alexey Brodkind05a76a2015-07-16 21:45:38 +030035cflags-y += -mno-ll64
36endif
37
38ifndef CONFIG_ARC_HAS_DIV_REM
39cflags-y += -mno-div-rem
40endif
41
Vineet Gupta1f6ccff2013-05-13 18:30:41 +053042endif
43
Vineet Gupta5a205a32016-09-16 17:23:26 -070044cfi := $(call as-instr,.cfi_startproc\n.cfi_endproc,-DARC_DW2_UNWIND_AS_CFI)
45cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables $(cfi)
Vineet Gupta6716dbb2013-06-24 21:22:06 +053046
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053047ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
48# Generic build system uses -O2, we want -O3
Vineet Gupta97709062015-06-18 13:54:01 +053049# Note: No need to add to cflags-y as that happens anyways
Arnd Bergmanna76bcf52016-11-10 17:44:44 +010050#
51# Disable the false maybe-uninitialized warings gcc spits out at -O3
52ARCH_CFLAGS += -O3 $(call cc-disable-warning,maybe-uninitialized,)
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053053endif
54
55# small data is default for elf32 tool-chain. If not usable, disable it
56# This also allows repurposing GP as scratch reg to gcc reg allocator
57disable_small_data := y
58cflags-$(disable_small_data) += -mno-sdata -fcall-used-gp
59
60cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian
61ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
62
Alexey Brodkin40660f12018-09-16 23:47:57 +030063LIBGCC = $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053064
65# Modules with short calls might break for calls into builtin-kernel
Vineet Gupta07fd7d42015-12-21 12:38:01 +053066KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053067
68# Finally dump eveything into kernel build system
69KBUILD_CFLAGS += $(cflags-y)
70KBUILD_AFLAGS += $(KBUILD_CFLAGS)
Masahiro Yamadad503ac52018-08-24 08:20:39 +090071KBUILD_LDFLAGS += $(ldflags-y)
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053072
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053073head-y := arch/arc/kernel/head.o
74
75# See arch/arc/Kbuild for content of core part of the kernel
76core-y += arch/arc/
77
Vineet Gupta999159a2013-01-22 17:00:52 +053078# w/o this dtb won't embed into kernel binary
79core-y += arch/arc/boot/dts/
80
Vineet Gupta33460f82017-07-28 16:53:50 +053081core-y += arch/arc/plat-sim/
Vineet Guptafd155792015-02-20 19:12:18 +053082core-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/
Alexey Brodkin556cc1c2014-01-27 14:51:34 +010083core-$(CONFIG_ARC_PLAT_AXS10X) += arch/arc/plat-axs10x/
Noam Camus966657892015-10-16 16:52:43 +030084core-$(CONFIG_ARC_PLAT_EZNPS) += arch/arc/plat-eznps/
Alexey Brodkina518d632017-08-15 21:13:55 +030085core-$(CONFIG_ARC_SOC_HSDK) += arch/arc/plat-hsdk/
Noam Camus966657892015-10-16 16:52:43 +030086
87ifdef CONFIG_ARC_PLAT_EZNPS
88KBUILD_CPPFLAGS += -I$(srctree)/arch/arc/plat-eznps/include
89endif
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053090
Vineet Gupta769bc1f2013-01-22 17:02:38 +053091drivers-$(CONFIG_OPROFILE) += arch/arc/oprofile/
92
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053093libs-y += arch/arc/lib/ $(LIBGCC)
94
Vineet Guptafb0990b2013-03-22 19:48:01 +053095boot := arch/arc/boot
96
Andrea Gelmini25474762016-05-21 13:45:35 +020097#default target for make without any arguments.
Michal Marek5e40f0f2016-11-22 22:34:31 +010098KBUILD_IMAGE := $(boot)/bootpImage
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053099
Michal Marek5e40f0f2016-11-22 22:34:31 +0100100all: bootpImage
Vineet Guptacfdbc2e2013-01-18 15:12:20 +0530101bootpImage: vmlinux
102
Vineet Gupta104058e2013-03-22 22:04:27 +0530103boot_targets += uImage uImage.bin uImage.gz
104
105$(boot_targets): vmlinux
Vineet Guptacfdbc2e2013-01-18 15:12:20 +0530106 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
107
Vineet Guptacfdbc2e2013-01-18 15:12:20 +0530108archclean:
109 $(Q)$(MAKE) $(clean)=$(boot)