1LDFLAGS_vmlinux	:= --no-undefined -X
2OBJCOPYFLAGS	:= -O binary -R .note -R .note.gnu.build-id -R .comment -S
3
4KBUILD_DEFCONFIG := defconfig
5
6comma = ,
7
8ifdef CONFIG_FUNCTION_TRACER
9arch-y += -malways-save-lp -mno-relax
10endif
11
12KBUILD_CFLAGS	+= $(call cc-option, -mno-sched-prolog-epilog)
13KBUILD_CFLAGS	+= -mcmodel=large
14
15KBUILD_CFLAGS	+=$(arch-y) $(tune-y)
16KBUILD_AFLAGS	+=$(arch-y) $(tune-y)
17
18#Default value
19head-y		 := arch/nds32/kernel/head.o
20textaddr-y	 := $(CONFIG_PAGE_OFFSET)+0xc000
21
22TEXTADDR := $(textaddr-y)
23
24export	TEXTADDR
25
26
27# If we have a machine-specific directory, then include it in the build.
28core-y				+= arch/nds32/kernel/ arch/nds32/mm/
29libs-y				+= arch/nds32/lib/
30
31ifneq '$(CONFIG_NDS32_BUILTIN_DTB)' '""'
32BUILTIN_DTB := y
33else
34BUILTIN_DTB := n
35endif
36
37ifdef CONFIG_CPU_LITTLE_ENDIAN
38KBUILD_CFLAGS   += $(call cc-option, -EL)
39KBUILD_AFLAGS   += $(call cc-option, -EL)
40KBUILD_LDFLAGS  += $(call cc-option, -EL)
41CHECKFLAGS      += -D__NDS32_EL__
42else
43KBUILD_CFLAGS   += $(call cc-option, -EB)
44KBUILD_AFLAGS   += $(call cc-option, -EB)
45KBUILD_LDFLAGS  += $(call cc-option, -EB)
46CHECKFLAGS      += -D__NDS32_EB__
47endif
48
49boot := arch/nds32/boot
50core-$(BUILTIN_DTB) += $(boot)/dts/
51
52.PHONY: FORCE
53
54Image: vmlinux
55	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
56
57
58PHONY += vdso_install
59vdso_install:
60	$(Q)$(MAKE) $(build)=arch/nds32/kernel/vdso $@
61
62prepare: vdso_prepare
63vdso_prepare: prepare0
64	$(Q)$(MAKE) $(build)=arch/nds32/kernel/vdso include/generated/vdso-offsets.h
65
66CLEAN_FILES += include/asm-nds32/constants.h*
67
68# We use MRPROPER_FILES and CLEAN_FILES now
69archclean:
70	$(Q)$(MAKE) $(clean)=$(boot)
71
72define archhelp
73  echo  '  Image         - kernel image (arch/$(ARCH)/boot/Image)'
74endef
75