xref: /linux/arch/arc/Makefile (revision 40660f1fcee8d524a60b5101538e42b1f39f106d)
1cfdbc2e1SVineet Gupta#
2cfdbc2e1SVineet Gupta# Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3cfdbc2e1SVineet Gupta#
4cfdbc2e1SVineet Gupta# This program is free software; you can redistribute it and/or modify
5cfdbc2e1SVineet Gupta# it under the terms of the GNU General Public License version 2 as
6cfdbc2e1SVineet Gupta# published by the Free Software Foundation.
7cfdbc2e1SVineet Gupta#
8cfdbc2e1SVineet Gupta
97a70bf79SVineet GuptaKBUILD_DEFCONFIG := nsim_700_defconfig
10cfdbc2e1SVineet Gupta
1174c11e30SAlexey Brodkincflags-y	+= -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__
1240b8ad8fSVineet Guptacflags-$(CONFIG_ISA_ARCOMPACT)	+= -mA7
1300a99339SVineet Guptacflags-$(CONFIG_ISA_ARCV2)	+= -mcpu=hs38
14cfdbc2e1SVineet Gupta
15080c3747SVineet Guptaifdef CONFIG_ARC_CURR_IN_REG
16080c3747SVineet Gupta# For a global register defintion, make sure it gets passed to every file
17080c3747SVineet Gupta# We had a customer reported bug where some code built in kernel was NOT using
18080c3747SVineet Gupta# any kernel headers, and missing the r25 global register
198235703eSVineet Gupta# Can't do unconditionally because of recursive include issues
20080c3747SVineet Gupta# due to <linux/thread_info.h>
21080c3747SVineet GuptaLINUXINCLUDE	+=  -include ${src}/arch/arc/include/asm/current.h
22080c3747SVineet Guptaendif
23080c3747SVineet Gupta
242b52e2a6SMasahiro Yamadacflags-y				+= -fsection-anchors
25cfdbc2e1SVineet Gupta
2676a08404SVineet Guptacflags-$(CONFIG_ARC_HAS_LLSC)		+= -mlock
2776a08404SVineet Guptacflags-$(CONFIG_ARC_HAS_SWAPE)		+= -mswape
2876a08404SVineet Gupta
29d05a76abSAlexey Brodkinifdef CONFIG_ISA_ARCV2
30d05a76abSAlexey Brodkin
311f6ccfffSVineet Guptaifndef CONFIG_ARC_HAS_LL64
32d05a76abSAlexey Brodkincflags-y				+= -mno-ll64
33d05a76abSAlexey Brodkinendif
34d05a76abSAlexey Brodkin
35d05a76abSAlexey Brodkinifndef CONFIG_ARC_HAS_DIV_REM
36d05a76abSAlexey Brodkincflags-y				+= -mno-div-rem
37d05a76abSAlexey Brodkinendif
38d05a76abSAlexey Brodkin
391f6ccfffSVineet Guptaendif
401f6ccfffSVineet Gupta
415a205a32SVineet Guptacfi := $(call as-instr,.cfi_startproc\n.cfi_endproc,-DARC_DW2_UNWIND_AS_CFI)
425a205a32SVineet Guptacflags-$(CONFIG_ARC_DW2_UNWIND)		+= -fasynchronous-unwind-tables $(cfi)
436716dbbdSVineet Gupta
44cfdbc2e1SVineet Guptaifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
45cfdbc2e1SVineet Gupta# Generic build system uses -O2, we want -O3
4697709069SVineet Gupta# Note: No need to add to cflags-y as that happens anyways
47a76bcf55SArnd Bergmann#
48a76bcf55SArnd Bergmann# Disable the false maybe-uninitialized warings gcc spits out at -O3
49a76bcf55SArnd BergmannARCH_CFLAGS += -O3 $(call cc-disable-warning,maybe-uninitialized,)
50cfdbc2e1SVineet Guptaendif
51cfdbc2e1SVineet Gupta
52cfdbc2e1SVineet Gupta# small data is default for elf32 tool-chain. If not usable, disable it
53cfdbc2e1SVineet Gupta# This also allows repurposing GP as scratch reg to gcc reg allocator
54cfdbc2e1SVineet Guptadisable_small_data := y
55cfdbc2e1SVineet Guptacflags-$(disable_small_data)		+= -mno-sdata -fcall-used-gp
56cfdbc2e1SVineet Gupta
57cfdbc2e1SVineet Guptacflags-$(CONFIG_CPU_BIG_ENDIAN)		+= -mbig-endian
58cfdbc2e1SVineet Guptaldflags-$(CONFIG_CPU_BIG_ENDIAN)	+= -EB
59cfdbc2e1SVineet Gupta
60*40660f1fSAlexey BrodkinLIBGCC	= $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
61cfdbc2e1SVineet Gupta
62cfdbc2e1SVineet Gupta# Modules with short calls might break for calls into builtin-kernel
6307fd7d4bSVineet GuptaKBUILD_CFLAGS_MODULE	+= -mlong-calls -mno-millicode
64cfdbc2e1SVineet Gupta
65cfdbc2e1SVineet Gupta# Finally dump eveything into kernel build system
66cfdbc2e1SVineet GuptaKBUILD_CFLAGS	+= $(cflags-y)
67cfdbc2e1SVineet GuptaKBUILD_AFLAGS	+= $(KBUILD_CFLAGS)
68d503ac53SMasahiro YamadaKBUILD_LDFLAGS	+= $(ldflags-y)
69cfdbc2e1SVineet Gupta
70cfdbc2e1SVineet Guptahead-y		:= arch/arc/kernel/head.o
71cfdbc2e1SVineet Gupta
72cfdbc2e1SVineet Gupta# See arch/arc/Kbuild for content of core part of the kernel
73cfdbc2e1SVineet Guptacore-y		+= arch/arc/
74cfdbc2e1SVineet Gupta
75999159a5SVineet Gupta# w/o this dtb won't embed into kernel binary
76999159a5SVineet Guptacore-y		+= arch/arc/boot/dts/
77999159a5SVineet Gupta
7833460f86SVineet Guptacore-y				+= arch/arc/plat-sim/
79072eb693SChristian Ruppertcore-$(CONFIG_ARC_PLAT_TB10X)	+= arch/arc/plat-tb10x/
80556cc1c5SAlexey Brodkincore-$(CONFIG_ARC_PLAT_AXS10X)	+= arch/arc/plat-axs10x/
8196665789SNoam Camuscore-$(CONFIG_ARC_PLAT_EZNPS)	+= arch/arc/plat-eznps/
82a518d637SAlexey Brodkincore-$(CONFIG_ARC_SOC_HSDK)	+= arch/arc/plat-hsdk/
8396665789SNoam Camus
8496665789SNoam Camusifdef CONFIG_ARC_PLAT_EZNPS
8596665789SNoam CamusKBUILD_CPPFLAGS += -I$(srctree)/arch/arc/plat-eznps/include
8696665789SNoam Camusendif
87cfdbc2e1SVineet Gupta
88769bc1fdSVineet Guptadrivers-$(CONFIG_OPROFILE)	+= arch/arc/oprofile/
89769bc1fdSVineet Gupta
90cfdbc2e1SVineet Guptalibs-y		+= arch/arc/lib/ $(LIBGCC)
91cfdbc2e1SVineet Gupta
92fb0990bbSVineet Guptaboot		:= arch/arc/boot
93fb0990bbSVineet Gupta
942547476aSAndrea Gelmini#default target for make without any arguments.
955e40f0fdSMichal MarekKBUILD_IMAGE	:= $(boot)/bootpImage
96cfdbc2e1SVineet Gupta
975e40f0fdSMichal Marekall:	bootpImage
98cfdbc2e1SVineet GuptabootpImage: vmlinux
99cfdbc2e1SVineet Gupta
100104058edSVineet Guptaboot_targets += uImage uImage.bin uImage.gz
101104058edSVineet Gupta
102104058edSVineet Gupta$(boot_targets): vmlinux
103cfdbc2e1SVineet Gupta	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
104cfdbc2e1SVineet Gupta
105999159a5SVineet Gupta%.dtb %.dtb.S %.dtb.o: scripts
106999159a5SVineet Gupta	$(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
107999159a5SVineet Gupta
108999159a5SVineet Guptadtbs: scripts
10910375cccSRob Herring	$(Q)$(MAKE) $(build)=$(boot)/dts
110999159a5SVineet Gupta
111cfdbc2e1SVineet Guptaarchclean:
112cfdbc2e1SVineet Gupta	$(Q)$(MAKE) $(clean)=$(boot)
113