xref: /OK3568_Linux_fs/kernel/arch/nios2/Makefile (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#
2*4882a593Smuzhiyun# This file is subject to the terms and conditions of the GNU General Public
3*4882a593Smuzhiyun# License.  See the file "COPYING" in the main directory of this archive
4*4882a593Smuzhiyun# for more details.
5*4882a593Smuzhiyun#
6*4882a593Smuzhiyun# Copyright (C) 2013 Altera Corporation
7*4882a593Smuzhiyun# Copyright (C) 1994, 95, 96, 2003 by Wind River Systems
8*4882a593Smuzhiyun# Written by Fredrik Markstrom
9*4882a593Smuzhiyun#
10*4882a593Smuzhiyun# This file is included by the global makefile so that you can add your own
11*4882a593Smuzhiyun# architecture-specific flags and dependencies. Remember to do have actions
12*4882a593Smuzhiyun# for "archclean" cleaning up for this architecture.
13*4882a593Smuzhiyun#
14*4882a593Smuzhiyun# Nios2 port by Wind River Systems Inc trough:
15*4882a593Smuzhiyun#   fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunKBUILD_DEFCONFIG := 3c120_defconfig
18*4882a593Smuzhiyun
19*4882a593SmuzhiyunUTS_SYSNAME = Linux
20*4882a593Smuzhiyun
21*4882a593Smuzhiyunexport MMU
22*4882a593Smuzhiyun
23*4882a593SmuzhiyunLIBGCC         := $(shell $(CC) $(KBUILD_CFLAGS) $(KCFLAGS) -print-libgcc-file-name)
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunKBUILD_AFLAGS += -march=r$(CONFIG_NIOS2_ARCH_REVISION)
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunKBUILD_CFLAGS += -pipe -D__linux__ -D__ELF__
28*4882a593SmuzhiyunKBUILD_CFLAGS += -march=r$(CONFIG_NIOS2_ARCH_REVISION)
29*4882a593SmuzhiyunKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MUL_SUPPORT),-mhw-mul,-mno-hw-mul)
30*4882a593SmuzhiyunKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MULX_SUPPORT),-mhw-mulx,-mno-hw-mulx)
31*4882a593SmuzhiyunKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_DIV_SUPPORT),-mhw-div,-mno-hw-div)
32*4882a593SmuzhiyunKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_BMX_SUPPORT),-mbmx,-mno-bmx)
33*4882a593SmuzhiyunKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_CDX_SUPPORT),-mcdx,-mno-cdx)
34*4882a593SmuzhiyunKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_FPU_SUPPORT),-mcustom-fpu-cfg=60-1,)
35*4882a593Smuzhiyun
36*4882a593SmuzhiyunKBUILD_CFLAGS += -fno-optimize-sibling-calls
37*4882a593SmuzhiyunKBUILD_CFLAGS += -DUTS_SYSNAME=\"$(UTS_SYSNAME)\"
38*4882a593SmuzhiyunKBUILD_CFLAGS += -fno-builtin
39*4882a593SmuzhiyunKBUILD_CFLAGS += -G 0
40*4882a593Smuzhiyun
41*4882a593Smuzhiyunhead-y		:= arch/nios2/kernel/head.o
42*4882a593Smuzhiyunlibs-y		+= arch/nios2/lib/ $(LIBGCC)
43*4882a593Smuzhiyuncore-y		+= arch/nios2/kernel/ arch/nios2/mm/
44*4882a593Smuzhiyuncore-y		+= arch/nios2/platform/
45*4882a593Smuzhiyun
46*4882a593SmuzhiyunINSTALL_PATH ?= /tftpboot
47*4882a593Smuzhiyunnios2-boot := arch/$(ARCH)/boot
48*4882a593SmuzhiyunBOOT_TARGETS = vmImage zImage
49*4882a593SmuzhiyunPHONY += $(BOOT_TARGETS) install
50*4882a593SmuzhiyunKBUILD_IMAGE := $(nios2-boot)/vmImage
51*4882a593Smuzhiyun
52*4882a593Smuzhiyuncore-y	+= $(nios2-boot)/dts/
53*4882a593Smuzhiyun
54*4882a593Smuzhiyunall: vmImage
55*4882a593Smuzhiyun
56*4882a593Smuzhiyunarchclean:
57*4882a593Smuzhiyun	$(Q)$(MAKE) $(clean)=$(nios2-boot)
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun$(BOOT_TARGETS): vmlinux
60*4882a593Smuzhiyun	$(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
61*4882a593Smuzhiyun
62*4882a593Smuzhiyuninstall:
63*4882a593Smuzhiyun	$(Q)$(MAKE) $(build)=$(nios2-boot) BOOTIMAGE=$(KBUILD_IMAGE) install
64*4882a593Smuzhiyun
65*4882a593Smuzhiyundefine archhelp
66*4882a593Smuzhiyun  echo  '* vmImage         - Kernel-only image for U-Boot ($(KBUILD_IMAGE))'
67*4882a593Smuzhiyun  echo  '  install         - Install kernel using'
68*4882a593Smuzhiyun  echo  '                     (your) ~/bin/$(INSTALLKERNEL) or'
69*4882a593Smuzhiyun  echo  '                     (distribution) /sbin/$(INSTALLKERNEL) or'
70*4882a593Smuzhiyun  echo  '                     install to $$(INSTALL_PATH)'
71*4882a593Smuzhiyunendef
72