1# SPDX-License-Identifier: GPL-2.0+
2
3head-y := arch/mips/cpu/start.o
4
5ifeq ($(CONFIG_SPL_BUILD),y)
6ifneq ($(CONFIG_SPL_START_S_PATH),)
7head-y := $(CONFIG_SPL_START_S_PATH:"%"=%)/start.o
8endif
9endif
10
11libs-y += arch/mips/cpu/
12libs-y += arch/mips/lib/
13
14machine-$(CONFIG_ARCH_ATH79) += ath79
15machine-$(CONFIG_ARCH_BMIPS) += bmips
16machine-$(CONFIG_ARCH_JZ47XX) += jz47xx
17machine-$(CONFIG_MACH_PIC32) += pic32
18machine-$(CONFIG_ARCH_MTMIPS) += mtmips
19machine-$(CONFIG_ARCH_MSCC) += mscc
20machine-${CONFIG_ARCH_OCTEON} += octeon
21
22machdirs := $(patsubst %,arch/mips/mach-%/,$(machine-y))
23libs-y += $(machdirs)
24
25PLATFORM_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs))
26
27# Optimize for MIPS architectures
28arch-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,-mips32
29arch-$(CONFIG_CPU_MIPS32_R2) += -march=mips32r2 -Wa,-mips32r2
30arch-$(CONFIG_CPU_MIPS32_R6) += -march=mips32r6 -Wa,-mips32r6
31arch-$(CONFIG_CPU_MIPS64_R1) += -march=mips64 -Wa,-mips64
32arch-$(CONFIG_CPU_MIPS64_R2) += -march=mips64r2 -Wa,-mips64r2
33arch-$(CONFIG_CPU_MIPS64_R6) += -march=mips64r6 -Wa,-mips64r6
34arch-${CONFIG_CPU_MIPS64_OCTEON} += -march=octeon2
35
36# Allow extra optimization for specific CPUs/SoCs
37tune-$(CONFIG_MIPS_TUNE_4KC) += -mtune=4kc
38tune-$(CONFIG_MIPS_TUNE_14KC) += -mtune=14kc
39tune-$(CONFIG_MIPS_TUNE_24KC) += -mtune=24kc
40tune-$(CONFIG_MIPS_TUNE_34KC) += -mtune=34kc
41tune-$(CONFIG_MIPS_TUNE_74KC) += -mtune=74kc
42tune-${CONFIG_MIPS_TUNE_OCTEON3} += -mtune=octeon2
43
44# Include default header files
45cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic
46
47PLATFORM_CPPFLAGS += $(arch-y) $(tune-y) $(cflags-y)
48