1# SPDX-License-Identifier: GPL-2.0-only
2LDFLAGS_vmlinux	:= --no-undefined -X
3OBJCOPYFLAGS	:= -O binary -R .note -R .note.gnu.build-id -R .comment -S
4
5ifdef CONFIG_FUNCTION_TRACER
6arch-y += -malways-save-lp -mno-relax
7endif
8
9# Avoid generating FPU instructions
10arch-y  += -mno-ext-fpu-sp -mno-ext-fpu-dp -mfloat-abi=soft
11
12# Enable <nds32_intrinsic.h>
13KBUILD_CFLAGS	+= -isystem $(shell $(CC) -print-file-name=include)
14KBUILD_CFLAGS	+= $(call cc-option, -mno-sched-prolog-epilog)
15KBUILD_CFLAGS	+= -mcmodel=large
16
17KBUILD_CFLAGS	+=$(arch-y) $(tune-y)
18KBUILD_AFLAGS	+=$(arch-y) $(tune-y)
19
20#Default value
21head-y		 := arch/nds32/kernel/head.o
22textaddr-y	 := $(CONFIG_PAGE_OFFSET)+0xc000
23
24TEXTADDR := $(textaddr-y)
25
26export	TEXTADDR
27
28
29# If we have a machine-specific directory, then include it in the build.
30core-y				+= arch/nds32/kernel/ arch/nds32/mm/
31core-$(CONFIG_FPU)              += arch/nds32/math-emu/
32libs-y				+= arch/nds32/lib/
33
34ifneq '$(CONFIG_NDS32_BUILTIN_DTB)' '""'
35BUILTIN_DTB := y
36else
37BUILTIN_DTB := n
38endif
39
40ifdef CONFIG_CPU_LITTLE_ENDIAN
41KBUILD_CFLAGS   += $(call cc-option, -EL)
42KBUILD_AFLAGS   += $(call cc-option, -EL)
43KBUILD_LDFLAGS  += $(call cc-option, -EL)
44CHECKFLAGS      += -D__NDS32_EL__
45else
46KBUILD_CFLAGS   += $(call cc-option, -EB)
47KBUILD_AFLAGS   += $(call cc-option, -EB)
48KBUILD_LDFLAGS  += $(call cc-option, -EB)
49CHECKFLAGS      += -D__NDS32_EB__
50endif
51
52boot := arch/nds32/boot
53core-y += $(boot)/dts/
54
55Image: vmlinux
56	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
57
58
59PHONY += vdso_install
60vdso_install:
61	$(Q)$(MAKE) $(build)=arch/nds32/kernel/vdso $@
62
63prepare: vdso_prepare
64vdso_prepare: prepare0
65	$(Q)$(MAKE) $(build)=arch/nds32/kernel/vdso include/generated/vdso-offsets.h
66
67define archhelp
68  echo  '  Image         - kernel image (arch/$(ARCH)/boot/Image)'
69endef
70