1# 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 9KBUILD_DEFCONFIG := nsim_hs_defconfig 10 11ifeq ($(CROSS_COMPILE),) 12CROSS_COMPILE := $(call cc-cross-prefix, arc-linux- arceb-linux-) 13endif 14 15cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ 16cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 17cflags-$(CONFIG_ISA_ARCV2) += -mcpu=hs38 18 19ifdef CONFIG_ARC_CURR_IN_REG 20# For a global register defintion, make sure it gets passed to every file 21# We had a customer reported bug where some code built in kernel was NOT using 22# any kernel headers, and missing the r25 global register 23# Can't do unconditionally because of recursive include issues 24# due to <linux/thread_info.h> 25LINUXINCLUDE += -include ${src}/arch/arc/include/asm/current.h 26endif 27 28cflags-y += -fsection-anchors 29 30cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock 31cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape 32 33ifdef CONFIG_ISA_ARCV2 34 35ifdef CONFIG_ARC_USE_UNALIGNED_MEM_ACCESS 36cflags-y += -munaligned-access 37else 38cflags-y += -mno-unaligned-access 39endif 40 41ifndef CONFIG_ARC_HAS_LL64 42cflags-y += -mno-ll64 43endif 44 45ifndef CONFIG_ARC_HAS_DIV_REM 46cflags-y += -mno-div-rem 47endif 48 49endif 50 51cfi := $(call as-instr,.cfi_startproc\n.cfi_endproc,-DARC_DW2_UNWIND_AS_CFI) 52cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables $(cfi) 53 54ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE 55# Generic build system uses -O2, we want -O3 56# Note: No need to add to cflags-y as that happens anyways 57# 58# Disable the false maybe-uninitialized warings gcc spits out at -O3 59ARCH_CFLAGS += -O3 $(call cc-disable-warning,maybe-uninitialized,) 60endif 61 62# small data is default for elf32 tool-chain. If not usable, disable it 63# This also allows repurposing GP as scratch reg to gcc reg allocator 64disable_small_data := y 65cflags-$(disable_small_data) += -mno-sdata -fcall-used-gp 66 67cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mbig-endian 68ldflags-$(CONFIG_CPU_BIG_ENDIAN) += -EB 69 70LIBGCC = $(shell $(CC) $(cflags-y) --print-libgcc-file-name) 71 72# Modules with short calls might break for calls into builtin-kernel 73KBUILD_CFLAGS_MODULE += -mlong-calls -mno-millicode 74 75# Finally dump eveything into kernel build system 76KBUILD_CFLAGS += $(cflags-y) 77KBUILD_AFLAGS += $(KBUILD_CFLAGS) 78KBUILD_LDFLAGS += $(ldflags-y) 79 80head-y := arch/arc/kernel/head.o 81 82# See arch/arc/Kbuild for content of core part of the kernel 83core-y += arch/arc/ 84 85# w/o this dtb won't embed into kernel binary 86core-y += arch/arc/boot/dts/ 87 88core-y += arch/arc/plat-sim/ 89core-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/ 90core-$(CONFIG_ARC_PLAT_AXS10X) += arch/arc/plat-axs10x/ 91core-$(CONFIG_ARC_PLAT_EZNPS) += arch/arc/plat-eznps/ 92core-$(CONFIG_ARC_SOC_HSDK) += arch/arc/plat-hsdk/ 93 94ifdef CONFIG_ARC_PLAT_EZNPS 95KBUILD_CPPFLAGS += -I$(srctree)/arch/arc/plat-eznps/include 96endif 97 98drivers-$(CONFIG_OPROFILE) += arch/arc/oprofile/ 99 100libs-y += arch/arc/lib/ $(LIBGCC) 101 102boot := arch/arc/boot 103 104#default target for make without any arguments. 105KBUILD_IMAGE := $(boot)/bootpImage 106 107all: bootpImage 108bootpImage: vmlinux 109 110boot_targets += uImage uImage.bin uImage.gz 111 112$(boot_targets): vmlinux 113 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 114 115archclean: 116 $(Q)$(MAKE) $(clean)=$(boot) 117