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