blob: c64c505d966c7a737b0db3c0590fb1063b549f69 [file] [log] [blame]
Vineet Guptacfdbc2e2013-01-18 15:12:20 +05301#
2# Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License version 2 as
6# published by the Free Software Foundation.
7#
8
Vineet Gupta7a70bf72014-12-12 10:27:50 +05309KBUILD_DEFCONFIG := nsim_700_defconfig
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053010
Alexey Brodkin74c11e32018-06-01 14:34:33 +030011cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
Vineet Gupta40b8ad82015-06-28 20:22:01 +053012cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7
Vineet Gupta00a99332018-09-07 15:13:10 -070013cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053014
Vineet Gupta080c3742013-02-11 19:52:57 +053015ifdef CONFIG_ARC_CURR_IN_REG
16# For a global register defintion, make sure it gets passed to every file
17# We had a customer reported bug where some code built in kernel was NOT using
18# any kernel headers, and missing the r25 global register
Vineet Gupta82357032013-06-01 12:55:42 +053019# Can't do unconditionally because of recursive include issues
Vineet Gupta080c3742013-02-11 19:52:57 +053020# due to <linux/thread_info.h>
21LINUXINCLUDE += -include ${src}/arch/arc/include/asm/current.h
22endif
23
Masahiro Yamada2b52e2a2018-08-27 12:07:37 +090024cflags-y += -fsection-anchors
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053025
Vineet Gupta76a08402016-11-08 08:47:14 -080026cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock
27cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape
28
Alexey Brodkind05a76a2015-07-16 21:45:38 +030029ifdef CONFIG_ISA_ARCV2
30
Vineet Gupta1f6ccff2013-05-13 18:30:41 +053031ifndef CONFIG_ARC_HAS_LL64
Alexey Brodkind05a76a2015-07-16 21:45:38 +030032cflags-y += -mno-ll64
33endif
34
35ifndef CONFIG_ARC_HAS_DIV_REM
36cflags-y += -mno-div-rem
37endif
38
Vineet Gupta1f6ccff2013-05-13 18:30:41 +053039endif
40
Vineet Gupta5a205a32016-09-16 17:23:26 -070041cfi := $(call as-instr,.cfi_startproc\n.cfi_endproc,-DARC_DW2_UNWIND_AS_CFI)
42cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables $(cfi)
Vineet Gupta6716dbb2013-06-24 21:22:06 +053043
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053044ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
45# Generic build system uses -O2, we want -O3
Vineet Gupta97709062015-06-18 13:54:01 +053046# Note: No need to add to cflags-y as that happens anyways
Arnd Bergmanna76bcf52016-11-10 17:44:44 +010047#
48# Disable the false maybe-uninitialized warings gcc spits out at -O3
49ARCH_CFLAGS += -O3 $(call cc-disable-warning,maybe-uninitialized,)
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053050endif
51
52# small data is default for elf32 tool-chain. If not usable, disable it
53# This also allows repurposing GP as scratch reg to gcc reg allocator
54disable_small_data := y
55cflags-$(disable_small_data) += -mno-sdata -fcall-used-gp
56
57cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian
58ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB
59
Alexey Brodkin40660f12018-09-16 23:47:57 +030060LIBGCC = $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053061
62# Modules with short calls might break for calls into builtin-kernel
Vineet Gupta07fd7d42015-12-21 12:38:01 +053063KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053064
65# Finally dump eveything into kernel build system
66KBUILD_CFLAGS += $(cflags-y)
67KBUILD_AFLAGS += $(KBUILD_CFLAGS)
Masahiro Yamadad503ac52018-08-24 08:20:39 +090068KBUILD_LDFLAGS += $(ldflags-y)
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053069
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053070head-y := arch/arc/kernel/head.o
71
72# See arch/arc/Kbuild for content of core part of the kernel
73core-y += arch/arc/
74
Vineet Gupta999159a2013-01-22 17:00:52 +053075# w/o this dtb won't embed into kernel binary
76core-y += arch/arc/boot/dts/
77
Vineet Gupta33460f82017-07-28 16:53:50 +053078core-y += arch/arc/plat-sim/
Vineet Guptafd155792015-02-20 19:12:18 +053079core-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/
Alexey Brodkin556cc1c2014-01-27 14:51:34 +010080core-$(CONFIG_ARC_PLAT_AXS10X) += arch/arc/plat-axs10x/
Noam Camus966657892015-10-16 16:52:43 +030081core-$(CONFIG_ARC_PLAT_EZNPS) += arch/arc/plat-eznps/
Alexey Brodkina518d632017-08-15 21:13:55 +030082core-$(CONFIG_ARC_SOC_HSDK) += arch/arc/plat-hsdk/
Noam Camus966657892015-10-16 16:52:43 +030083
84ifdef CONFIG_ARC_PLAT_EZNPS
85KBUILD_CPPFLAGS += -I$(srctree)/arch/arc/plat-eznps/include
86endif
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053087
Vineet Gupta769bc1f2013-01-22 17:02:38 +053088drivers-$(CONFIG_OPROFILE) += arch/arc/oprofile/
89
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053090libs-y += arch/arc/lib/ $(LIBGCC)
91
Vineet Guptafb0990b2013-03-22 19:48:01 +053092boot := arch/arc/boot
93
Andrea Gelmini25474762016-05-21 13:45:35 +020094#default target for make without any arguments.
Michal Marek5e40f0f2016-11-22 22:34:31 +010095KBUILD_IMAGE := $(boot)/bootpImage
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053096
Michal Marek5e40f0f2016-11-22 22:34:31 +010097all: bootpImage
Vineet Guptacfdbc2e2013-01-18 15:12:20 +053098bootpImage: vmlinux
99
Vineet Gupta104058e2013-03-22 22:04:27 +0530100boot_targets += uImage uImage.bin uImage.gz
101
102$(boot_targets): vmlinux
Vineet Guptacfdbc2e2013-01-18 15:12:20 +0530103 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
104
Vineet Guptacfdbc2e2013-01-18 15:12:20 +0530105archclean:
106 $(Q)$(MAKE) $(clean)=$(boot)