xref: /linux/arch/nios2/Makefile (revision a89988a6e00c5a099ee23619cd91dc8dc7ec9328)
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
25*a89988a6SMarek VasutKBUILD_AFLAGS += -march=r$(CONFIG_NIOS2_ARCH_REVISION)
26*a89988a6SMarek Vasut
272fc8483fSLey Foon TanKBUILD_CFLAGS += -pipe -D__linux__ -D__ELF__
28*a89988a6SMarek 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)
322fc8483fSLey Foon TanKBUILD_CFLAGS += $(if $(CONFIG_NIOS2_FPU_SUPPORT),-mcustom-fpu-cfg=60-1,)
332fc8483fSLey Foon Tan
342fc8483fSLey Foon TanKBUILD_CFLAGS += -fno-optimize-sibling-calls
352fc8483fSLey Foon TanKBUILD_CFLAGS += -DUTS_SYSNAME=\"$(UTS_SYSNAME)\"
362fc8483fSLey Foon TanKBUILD_CFLAGS += -fno-builtin
372fc8483fSLey Foon TanKBUILD_CFLAGS += -G 0
382fc8483fSLey Foon Tan
392fc8483fSLey Foon Tanhead-y		:= arch/nios2/kernel/head.o
402fc8483fSLey Foon Tanlibs-y		+= arch/nios2/lib/ $(LIBGCC)
412fc8483fSLey Foon Tancore-y		+= arch/nios2/kernel/ arch/nios2/mm/
422fc8483fSLey Foon Tancore-y		+= arch/nios2/platform/
432fc8483fSLey Foon Tan
442fc8483fSLey Foon TanINSTALL_PATH ?= /tftpboot
452fc8483fSLey Foon Tannios2-boot := arch/$(ARCH)/boot
462fc8483fSLey Foon TanBOOT_TARGETS = vmImage zImage
472fc8483fSLey Foon TanPHONY += $(BOOT_TARGETS) install
482fc8483fSLey Foon TanKBUILD_IMAGE := $(nios2-boot)/vmImage
492fc8483fSLey Foon Tan
502fc8483fSLey Foon Tanifneq ($(CONFIG_NIOS2_DTB_SOURCE),"")
512fc8483fSLey Foon Tan	core-y	+= $(nios2-boot)/
522fc8483fSLey Foon Tanendif
532fc8483fSLey Foon Tan
542fc8483fSLey Foon Tanall: vmImage
552fc8483fSLey Foon Tan
562fc8483fSLey Foon Tanarchclean:
572fc8483fSLey Foon Tan	$(Q)$(MAKE) $(clean)=$(nios2-boot)
582fc8483fSLey Foon Tan
599fa78f63SMarek Vasut%.dtb: | scripts
602fc8483fSLey Foon Tan	$(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
612fc8483fSLey Foon Tan
622fc8483fSLey Foon Tandtbs:
632fc8483fSLey Foon Tan	$(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
642fc8483fSLey Foon Tan
652fc8483fSLey Foon Tan$(BOOT_TARGETS): vmlinux
662fc8483fSLey Foon Tan	$(Q)$(MAKE) $(build)=$(nios2-boot) $(nios2-boot)/$@
672fc8483fSLey Foon Tan
682fc8483fSLey Foon Taninstall:
692fc8483fSLey Foon Tan	$(Q)$(MAKE) $(build)=$(nios2-boot) BOOTIMAGE=$(KBUILD_IMAGE) install
702fc8483fSLey Foon Tan
712fc8483fSLey Foon Tandefine archhelp
722fc8483fSLey Foon Tan  echo  '* vmImage         - Kernel-only image for U-Boot ($(KBUILD_IMAGE))'
732fc8483fSLey Foon Tan  echo  '  install         - Install kernel using'
742fc8483fSLey Foon Tan  echo  '                     (your) ~/bin/$(INSTALLKERNEL) or'
752fc8483fSLey Foon Tan  echo  '                     (distribution) /sbin/$(INSTALLKERNEL) or'
762fc8483fSLey Foon Tan  echo  '                     install to $$(INSTALL_PATH)'
772fc8483fSLey Foon Tan  echo  '  dtbs            - Build device tree blobs for enabled boards'
782fc8483fSLey Foon Tanendef
79