xref: /linux/arch/nios2/Makefile (revision edebea98777d7090ea14bdce2e38e6798557729d)
12fc8483fSLey Foon Tan#
22fc8483fSLey Foon Tan# This file is subject to the terms and conditions of the GNU General Public
32fc8483fSLey Foon Tan# License.  See the file "COPYING" in the main directory of this archive
42fc8483fSLey Foon Tan# for more details.
52fc8483fSLey Foon Tan#
62fc8483fSLey Foon Tan# Copyright (C) 2013 Altera Corporation
72fc8483fSLey Foon Tan# Copyright (C) 1994, 95, 96, 2003 by Wind River Systems
82fc8483fSLey Foon Tan# Written by Fredrik Markstrom
92fc8483fSLey Foon Tan#
102fc8483fSLey Foon Tan# This file is included by the global makefile so that you can add your own
112fc8483fSLey Foon Tan# architecture-specific flags and dependencies. Remember to do have actions
122fc8483fSLey Foon Tan# for "archclean" cleaning up for this architecture.
132fc8483fSLey Foon Tan#
142fc8483fSLey Foon Tan# Nios2 port by Wind River Systems Inc trough:
152fc8483fSLey Foon Tan#   fredrik.markstrom@gmail.com and ivarholmqvist@gmail.com
162fc8483fSLey Foon Tan
17d1e4ef04SPaul BolleKBUILD_DEFCONFIG := 3c120_defconfig
18d1e4ef04SPaul Bolle
192fc8483fSLey Foon TanUTS_SYSNAME = Linux
202fc8483fSLey Foon Tan
212fc8483fSLey Foon Tanexport MMU
222fc8483fSLey Foon Tan
23fb75a2bbSMarek VasutLIBGCC         := $(shell $(CC) $(KBUILD_CFLAGS) $(KCFLAGS) -print-libgcc-file-name)
242fc8483fSLey Foon Tan
25a89988a6SMarek VasutKBUILD_AFLAGS += -march=r$(CONFIG_NIOS2_ARCH_REVISION)
26a89988a6SMarek Vasut
272fc8483fSLey Foon TanKBUILD_CFLAGS += -pipe -D__linux__ -D__ELF__
28a89988a6SMarek VasutKBUILD_CFLAGS += -march=r$(CONFIG_NIOS2_ARCH_REVISION)
292fc8483fSLey Foon TanKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MUL_SUPPORT),-mhw-mul,-mno-hw-mul)
302fc8483fSLey Foon TanKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MULX_SUPPORT),-mhw-mulx,-mno-hw-mulx)
312fc8483fSLey Foon TanKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_DIV_SUPPORT),-mhw-div,-mno-hw-div)
3223460839SMarek VasutKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_BMX_SUPPORT),-mbmx,-mno-bmx)
33*edebea98SMarek VasutKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_CDX_SUPPORT),-mcdx,-mno-cdx)
342fc8483fSLey Foon TanKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_FPU_SUPPORT),-mcustom-fpu-cfg=60-1,)
352fc8483fSLey Foon Tan
362fc8483fSLey Foon TanKBUILD_CFLAGS += -fno-optimize-sibling-calls
372fc8483fSLey Foon TanKBUILD_CFLAGS += -DUTS_SYSNAME=\"$(UTS_SYSNAME)\"
382fc8483fSLey Foon TanKBUILD_CFLAGS += -fno-builtin
392fc8483fSLey Foon TanKBUILD_CFLAGS += -G 0
402fc8483fSLey Foon Tan
412fc8483fSLey Foon Tanhead-y		:= arch/nios2/kernel/head.o
422fc8483fSLey Foon Tanlibs-y		+= arch/nios2/lib/ $(LIBGCC)
432fc8483fSLey Foon Tancore-y		+= arch/nios2/kernel/ arch/nios2/mm/
442fc8483fSLey Foon Tancore-y		+= arch/nios2/platform/
452fc8483fSLey Foon Tan
462fc8483fSLey Foon TanINSTALL_PATH ?= /tftpboot
472fc8483fSLey Foon Tannios2-boot := arch/$(ARCH)/boot
482fc8483fSLey Foon TanBOOT_TARGETS = vmImage zImage
492fc8483fSLey Foon TanPHONY += $(BOOT_TARGETS) install
502fc8483fSLey Foon TanKBUILD_IMAGE := $(nios2-boot)/vmImage
512fc8483fSLey Foon Tan
522fc8483fSLey Foon Tanifneq ($(CONFIG_NIOS2_DTB_SOURCE),"")
532fc8483fSLey Foon Tan	core-y	+= $(nios2-boot)/
542fc8483fSLey Foon Tanendif
552fc8483fSLey Foon Tan
562fc8483fSLey Foon Tanall: vmImage
572fc8483fSLey Foon Tan
582fc8483fSLey Foon Tanarchclean:
592fc8483fSLey Foon Tan	$(Q)$(MAKE) $(clean)=$(nios2-boot)
602fc8483fSLey Foon Tan
619fa78f63SMarek Vasut%.dtb: | scripts
622fc8483fSLey Foon Tan	$(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
632fc8483fSLey Foon Tan
642fc8483fSLey Foon Tandtbs:
652fc8483fSLey Foon Tan	$(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
662fc8483fSLey Foon Tan
672fc8483fSLey Foon Tan$(BOOT_TARGETS): vmlinux
682fc8483fSLey Foon Tan	$(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
692fc8483fSLey Foon Tan
702fc8483fSLey Foon Taninstall:
712fc8483fSLey Foon Tan	$(Q)$(MAKE) $(build)=$(nios2-boot) BOOTIMAGE=$(KBUILD_IMAGE) install
722fc8483fSLey Foon Tan
732fc8483fSLey Foon Tandefine archhelp
742fc8483fSLey Foon Tan  echo  '* vmImage         - Kernel-only image for U-Boot ($(KBUILD_IMAGE))'
752fc8483fSLey Foon Tan  echo  '  install         - Install kernel using'
762fc8483fSLey Foon Tan  echo  '                     (your) ~/bin/$(INSTALLKERNEL) or'
772fc8483fSLey Foon Tan  echo  '                     (distribution) /sbin/$(INSTALLKERNEL) or'
782fc8483fSLey Foon Tan  echo  '                     install to $$(INSTALL_PATH)'
792fc8483fSLey Foon Tan  echo  '  dtbs            - Build device tree blobs for enabled boards'
802fc8483fSLey Foon Tanendef
81