162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci#
362306a36Sopenharmony_ci# sparc/Makefile
462306a36Sopenharmony_ci#
562306a36Sopenharmony_ci# Makefile for the architecture dependent flags and dependencies on the
662306a36Sopenharmony_ci# Sparc and sparc64.
762306a36Sopenharmony_ci#
862306a36Sopenharmony_ci# Copyright (C) 1994,1996,1998 David S. Miller (davem@caip.rutgers.edu)
962306a36Sopenharmony_ci# Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci# We are not yet configured - so test on arch
1262306a36Sopenharmony_ciifeq ($(ARCH),sparc64)
1362306a36Sopenharmony_ci        KBUILD_DEFCONFIG := sparc64_defconfig
1462306a36Sopenharmony_cielse
1562306a36Sopenharmony_ci        KBUILD_DEFCONFIG := sparc32_defconfig
1662306a36Sopenharmony_ciendif
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ciifeq ($(CONFIG_SPARC32),y)
1962306a36Sopenharmony_ci#####
2062306a36Sopenharmony_ci# sparc32
2162306a36Sopenharmony_ci#
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ciCHECKFLAGS     += -D__sparc__
2462306a36Sopenharmony_ciKBUILD_LDFLAGS := -m elf32_sparc
2562306a36Sopenharmony_ciexport BITS    := 32
2662306a36Sopenharmony_ciUTS_MACHINE    := sparc
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci# We are adding -Wa,-Av8 to KBUILD_CFLAGS to deal with a specs bug in some
2962306a36Sopenharmony_ci# versions of gcc.  Some gcc versions won't pass -Av8 to binutils when you
3062306a36Sopenharmony_ci# give -mcpu=v8.  This silently worked with older bintutils versions but
3162306a36Sopenharmony_ci# does not any more.
3262306a36Sopenharmony_ciKBUILD_CFLAGS  += -m32 -mcpu=v8 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
3362306a36Sopenharmony_ciKBUILD_CFLAGS  += -Wa,-Av8
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ciKBUILD_AFLAGS  += -m32 -Wa,-Av8
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_cielse
3862306a36Sopenharmony_ci#####
3962306a36Sopenharmony_ci# sparc64
4062306a36Sopenharmony_ci#
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ciCHECKFLAGS    += -D__sparc__ -D__sparc_v9__ -D__arch64__
4362306a36Sopenharmony_ciKBUILD_LDFLAGS := -m elf64_sparc
4462306a36Sopenharmony_ciexport BITS   := 64
4562306a36Sopenharmony_ciUTS_MACHINE   := sparc64
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ciKBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow
4862306a36Sopenharmony_ciKBUILD_CFLAGS += -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare
4962306a36Sopenharmony_ciKBUILD_CFLAGS += -Wa,--undeclared-regs
5062306a36Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3)
5162306a36Sopenharmony_ciKBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ciifeq ($(CONFIG_MCOUNT),y)
5462306a36Sopenharmony_ci  KBUILD_CFLAGS += -pg
5562306a36Sopenharmony_ciendif
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ciendif
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_cilibs-y                 += arch/sparc/prom/
6062306a36Sopenharmony_cilibs-y                 += arch/sparc/lib/
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_cidrivers-$(CONFIG_PM) += arch/sparc/power/
6362306a36Sopenharmony_cidrivers-$(CONFIG_FB_CORE) += arch/sparc/video/
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ciboot := arch/sparc/boot
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci# Default target
6862306a36Sopenharmony_ciall: zImage
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ciimage zImage uImage tftpboot.img vmlinux.aout: vmlinux
7162306a36Sopenharmony_ci	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ciinstall:
7462306a36Sopenharmony_ci	$(call cmd,install)
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ciarchheaders:
7762306a36Sopenharmony_ci	$(Q)$(MAKE) $(build)=arch/sparc/kernel/syscalls all
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ciPHONY += vdso_install
8062306a36Sopenharmony_civdso_install:
8162306a36Sopenharmony_ci	$(Q)$(MAKE) $(build)=arch/sparc/vdso $@
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci# This is the image used for packaging
8462306a36Sopenharmony_ciKBUILD_IMAGE := $(boot)/zImage
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci# Don't use tabs in echo arguments.
8762306a36Sopenharmony_cidefine archhelp
8862306a36Sopenharmony_ci  echo  '* vmlinux      - standard SPARC kernel'
8962306a36Sopenharmony_ci  echo  '  image        - kernel image ($(boot)/image)'
9062306a36Sopenharmony_ci  echo  '* zImage       - stripped/compressed kernel image ($(boot)/zImage)'
9162306a36Sopenharmony_ci  echo  '  uImage       - U-Boot SPARC32 Image (only for LEON)'
9262306a36Sopenharmony_ci  echo  '  vmlinux.aout - a.out kernel for SPARC64'
9362306a36Sopenharmony_ci  echo  '  tftpboot.img - image prepared for tftp'
9462306a36Sopenharmony_ciendef
95