18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ciLDFLAGS_vmlinux	:= --no-undefined -X
38c2ecf20Sopenharmony_ciOBJCOPYFLAGS	:= -O binary -R .note -R .note.gnu.build-id -R .comment -S
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciifdef CONFIG_FUNCTION_TRACER
68c2ecf20Sopenharmony_ciarch-y += -malways-save-lp -mno-relax
78c2ecf20Sopenharmony_ciendif
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci# Avoid generating FPU instructions
108c2ecf20Sopenharmony_ciarch-y  += -mno-ext-fpu-sp -mno-ext-fpu-dp -mfloat-abi=soft
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciKBUILD_CFLAGS	+= $(call cc-option, -mno-sched-prolog-epilog)
138c2ecf20Sopenharmony_ciKBUILD_CFLAGS	+= -mcmodel=large
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciKBUILD_CFLAGS	+=$(arch-y) $(tune-y)
168c2ecf20Sopenharmony_ciKBUILD_AFLAGS	+=$(arch-y) $(tune-y)
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#Default value
198c2ecf20Sopenharmony_cihead-y		 := arch/nds32/kernel/head.o
208c2ecf20Sopenharmony_citextaddr-y	 := $(CONFIG_PAGE_OFFSET)+0xc000
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciTEXTADDR := $(textaddr-y)
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ciexport	TEXTADDR
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci# If we have a machine-specific directory, then include it in the build.
288c2ecf20Sopenharmony_cicore-y				+= arch/nds32/kernel/ arch/nds32/mm/
298c2ecf20Sopenharmony_cicore-$(CONFIG_FPU)              += arch/nds32/math-emu/
308c2ecf20Sopenharmony_cilibs-y				+= arch/nds32/lib/
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciifneq '$(CONFIG_NDS32_BUILTIN_DTB)' '""'
338c2ecf20Sopenharmony_ciBUILTIN_DTB := y
348c2ecf20Sopenharmony_cielse
358c2ecf20Sopenharmony_ciBUILTIN_DTB := n
368c2ecf20Sopenharmony_ciendif
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciifdef CONFIG_CPU_LITTLE_ENDIAN
398c2ecf20Sopenharmony_ciKBUILD_CFLAGS   += $(call cc-option, -EL)
408c2ecf20Sopenharmony_ciKBUILD_AFLAGS   += $(call cc-option, -EL)
418c2ecf20Sopenharmony_ciKBUILD_LDFLAGS  += $(call cc-option, -EL)
428c2ecf20Sopenharmony_ciCHECKFLAGS      += -D__NDS32_EL__
438c2ecf20Sopenharmony_cielse
448c2ecf20Sopenharmony_ciKBUILD_CFLAGS   += $(call cc-option, -EB)
458c2ecf20Sopenharmony_ciKBUILD_AFLAGS   += $(call cc-option, -EB)
468c2ecf20Sopenharmony_ciKBUILD_LDFLAGS  += $(call cc-option, -EB)
478c2ecf20Sopenharmony_ciCHECKFLAGS      += -D__NDS32_EB__
488c2ecf20Sopenharmony_ciendif
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ciboot := arch/nds32/boot
518c2ecf20Sopenharmony_cicore-y += $(boot)/dts/
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciImage: vmlinux
548c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciPHONY += vdso_install
588c2ecf20Sopenharmony_civdso_install:
598c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(build)=arch/nds32/kernel/vdso $@
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ciprepare: vdso_prepare
628c2ecf20Sopenharmony_civdso_prepare: prepare0
638c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(build)=arch/nds32/kernel/vdso include/generated/vdso-offsets.h
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ciarchclean:
668c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(clean)=$(boot)
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_cidefine archhelp
698c2ecf20Sopenharmony_ci  echo  '  Image         - kernel image (arch/$(ARCH)/boot/Image)'
708c2ecf20Sopenharmony_ciendef
71