Back to home page

LXR

 
 

    


0001 #
0002 # Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
0003 #
0004 # This program is free software; you can redistribute it and/or modify
0005 # it under the terms of the GNU General Public License version 2 as
0006 # published by the Free Software Foundation.
0007 #
0008 
0009 UTS_MACHINE := arc
0010 
0011 ifeq ($(CROSS_COMPILE),)
0012 ifndef CONFIG_CPU_BIG_ENDIAN
0013 CROSS_COMPILE := arc-linux-
0014 else
0015 CROSS_COMPILE := arceb-linux-
0016 endif
0017 endif
0018 
0019 KBUILD_DEFCONFIG := nsim_700_defconfig
0020 
0021 cflags-y        += -fno-common -pipe -fno-builtin -D__linux__
0022 cflags-$(CONFIG_ISA_ARCOMPACT)  += -mA7
0023 cflags-$(CONFIG_ISA_ARCV2)      += -mcpu=archs
0024 
0025 is_700 = $(shell $(CC) -dM -E - < /dev/null | grep -q "ARC700" && echo 1 || echo 0)
0026 
0027 ifdef CONFIG_ISA_ARCOMPACT
0028 ifeq ($(is_700), 0)
0029     $(error Toolchain not configured for ARCompact builds)
0030 endif
0031 endif
0032 
0033 ifdef CONFIG_ISA_ARCV2
0034 ifeq ($(is_700), 1)
0035     $(error Toolchain not configured for ARCv2 builds)
0036 endif
0037 endif
0038 
0039 ifdef CONFIG_ARC_CURR_IN_REG
0040 # For a global register defintion, make sure it gets passed to every file
0041 # We had a customer reported bug where some code built in kernel was NOT using
0042 # any kernel headers, and missing the r25 global register
0043 # Can't do unconditionally because of recursive include issues
0044 # due to <linux/thread_info.h>
0045 LINUXINCLUDE    +=  -include ${src}/arch/arc/include/asm/current.h
0046 endif
0047 
0048 upto_gcc44    :=  $(call cc-ifversion, -le, 0404, y)
0049 atleast_gcc44 :=  $(call cc-ifversion, -ge, 0404, y)
0050 
0051 cflags-$(atleast_gcc44)                 += -fsection-anchors
0052 
0053 cflags-$(CONFIG_ARC_HAS_LLSC)           += -mlock
0054 cflags-$(CONFIG_ARC_HAS_SWAPE)          += -mswape
0055 
0056 ifdef CONFIG_ISA_ARCV2
0057 
0058 ifndef CONFIG_ARC_HAS_LL64
0059 cflags-y                                += -mno-ll64
0060 endif
0061 
0062 ifndef CONFIG_ARC_HAS_DIV_REM
0063 cflags-y                                += -mno-div-rem
0064 endif
0065 
0066 endif
0067 
0068 cfi := $(call as-instr,.cfi_startproc\n.cfi_endproc,-DARC_DW2_UNWIND_AS_CFI)
0069 cflags-$(CONFIG_ARC_DW2_UNWIND)         += -fasynchronous-unwind-tables $(cfi)
0070 
0071 ifndef CONFIG_CC_OPTIMIZE_FOR_SIZE
0072 # Generic build system uses -O2, we want -O3
0073 # Note: No need to add to cflags-y as that happens anyways
0074 #
0075 # Disable the false maybe-uninitialized warings gcc spits out at -O3
0076 ARCH_CFLAGS += -O3 $(call cc-disable-warning,maybe-uninitialized,)
0077 endif
0078 
0079 # small data is default for elf32 tool-chain. If not usable, disable it
0080 # This also allows repurposing GP as scratch reg to gcc reg allocator
0081 disable_small_data := y
0082 cflags-$(disable_small_data)            += -mno-sdata -fcall-used-gp
0083 
0084 cflags-$(CONFIG_CPU_BIG_ENDIAN)         += -mbig-endian
0085 ldflags-$(CONFIG_CPU_BIG_ENDIAN)        += -EB
0086 
0087 # STAR 9000518362: (fixed with binutils shipping with gcc 4.8)
0088 # arc-linux-uclibc-ld (buildroot) or arceb-elf32-ld (EZChip) don't accept
0089 # --build-id w/o "-marclinux". Default arc-elf32-ld is OK
0090 ldflags-$(upto_gcc44)                   += -marclinux
0091 
0092 LIBGCC  := $(shell $(CC) $(cflags-y) --print-libgcc-file-name)
0093 
0094 # Modules with short calls might break for calls into builtin-kernel
0095 KBUILD_CFLAGS_MODULE    += -mlong-calls -mno-millicode
0096 
0097 # Finally dump eveything into kernel build system
0098 KBUILD_CFLAGS   += $(cflags-y)
0099 KBUILD_AFLAGS   += $(KBUILD_CFLAGS)
0100 LDFLAGS         += $(ldflags-y)
0101 
0102 head-y          := arch/arc/kernel/head.o
0103 
0104 # See arch/arc/Kbuild for content of core part of the kernel
0105 core-y          += arch/arc/
0106 
0107 # w/o this dtb won't embed into kernel binary
0108 core-y          += arch/arc/boot/dts/
0109 
0110 core-$(CONFIG_ARC_PLAT_SIM)     += arch/arc/plat-sim/
0111 core-$(CONFIG_ARC_PLAT_TB10X)   += arch/arc/plat-tb10x/
0112 core-$(CONFIG_ARC_PLAT_AXS10X)  += arch/arc/plat-axs10x/
0113 core-$(CONFIG_ARC_PLAT_EZNPS)   += arch/arc/plat-eznps/
0114 
0115 ifdef CONFIG_ARC_PLAT_EZNPS
0116 KBUILD_CPPFLAGS += -I$(srctree)/arch/arc/plat-eznps/include
0117 endif
0118 
0119 drivers-$(CONFIG_OPROFILE)      += arch/arc/oprofile/
0120 
0121 libs-y          += arch/arc/lib/ $(LIBGCC)
0122 
0123 boot            := arch/arc/boot
0124 
0125 #default target for make without any arguments.
0126 KBUILD_IMAGE    := bootpImage
0127 
0128 all:    $(KBUILD_IMAGE)
0129 bootpImage: vmlinux
0130 
0131 boot_targets += uImage uImage.bin uImage.gz
0132 
0133 $(boot_targets): vmlinux
0134         $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
0135 
0136 %.dtb %.dtb.S %.dtb.o: scripts
0137         $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@
0138 
0139 dtbs: scripts
0140         $(Q)$(MAKE) $(build)=$(boot)/dts
0141 
0142 archclean:
0143         $(Q)$(MAKE) $(clean)=$(boot)
0144 
0145 # Hacks to enable final link due to absence of link-time branch relexation
0146 # and gcc choosing optimal(shorter) branches at -O3
0147 #
0148 # vineetg Feb 2010: -mlong-calls switched off for overall kernel build
0149 # However lib/decompress_inflate.o (.init.text) calls
0150 # zlib_inflate_workspacesize (.text) causing relocation errors.
0151 # Thus forcing all exten calls in this file to be long calls
0152 export CFLAGS_decompress_inflate.o = -mmedium-calls
0153 export CFLAGS_initramfs.o = -mmedium-calls
0154 ifdef CONFIG_SMP
0155 export CFLAGS_core.o = -mmedium-calls
0156 endif