blob: 4a091958169712ba78536198f8a966221eedec52 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001# SPDX-License-Identifier: GPL-2.0
Linus Torvalds1da177e2005-04-16 15:20:36 -07002#
3# sparc/Makefile
4#
5# Makefile for the architecture dependent flags and dependencies on the
Sam Ravnborg5e538792008-12-02 23:17:12 -08006# Sparc and sparc64.
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#
Sam Ravnborg5e538792008-12-02 23:17:12 -08008# Copyright (C) 1994,1996,1998 David S. Miller (davem@caip.rutgers.edu)
9# Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz)
10
11# We are not yet configured - so test on arch
Masahiro Yamadac84ca612018-08-21 02:08:28 +090012ifeq ($(ARCH),sparc64)
Sam Ravnborg5e538792008-12-02 23:17:12 -080013 KBUILD_DEFCONFIG := sparc64_defconfig
Masahiro Yamadac84ca612018-08-21 02:08:28 +090014else
15 KBUILD_DEFCONFIG := sparc32_defconfig
Sam Ravnborg5e538792008-12-02 23:17:12 -080016endif
17
18ifeq ($(CONFIG_SPARC32),y)
19#####
20# sparc32
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#
22
Sam Ravnborgb0cdd592008-11-16 20:04:20 -080023CHECKFLAGS += -D__sparc__
Masahiro Yamadad503ac52018-08-24 08:20:39 +090024KBUILD_LDFLAGS := -m elf32_sparc
Sam Ravnborgb0cdd592008-11-16 20:04:20 -080025export BITS := 32
David S. Miller7f5620a2009-12-05 17:17:55 -080026UTS_MACHINE := sparc
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
David S. Miller22be3b12016-01-17 11:47:29 -050028# We are adding -Wa,-Av8 to KBUILD_CFLAGS to deal with a specs bug in some
29# versions of gcc. Some gcc versions won't pass -Av8 to binutils when you
30# give -mcpu=v8. This silently worked with older bintutils versions but
31# does not any more.
Sam Ravnborg38753582012-05-15 21:21:55 +020032KBUILD_CFLAGS += -m32 -mcpu=v8 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
David S. Miller22be3b12016-01-17 11:47:29 -050033KBUILD_CFLAGS += -Wa,-Av8
34
Sam Ravnborg38753582012-05-15 21:21:55 +020035KBUILD_AFLAGS += -m32 -Wa,-Av8
Linus Torvalds1da177e2005-04-16 15:20:36 -070036
Sam Ravnborg5e538792008-12-02 23:17:12 -080037else
38#####
39# sparc64
40#
41
Luc Van Oostenryck1f2f01b2018-05-30 22:48:38 +020042CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__
Masahiro Yamadad503ac52018-08-24 08:20:39 +090043KBUILD_LDFLAGS := -m elf64_sparc
Sam Ravnborg38753582012-05-15 21:21:55 +020044export BITS := 64
45UTS_MACHINE := sparc64
Sam Ravnborg5e538792008-12-02 23:17:12 -080046
Sam Ravnborg38753582012-05-15 21:21:55 +020047KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow
48KBUILD_CFLAGS += -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare
49KBUILD_CFLAGS += -Wa,--undeclared-regs
Sam Ravnborg5e538792008-12-02 23:17:12 -080050KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3)
51KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs
52
53ifeq ($(CONFIG_MCOUNT),y)
54 KBUILD_CFLAGS += -pg
55endif
56
57endif
58
Sam Ravnborga88b5ba2008-12-03 03:11:52 -080059head-y := arch/sparc/kernel/head_$(BITS).o
Sam Ravnborg5e538792008-12-02 23:17:12 -080060
Sam Ravnborge1d7de82012-05-15 21:27:15 +020061# See arch/sparc/Kbuild for the core part of the kernel
62core-y += arch/sparc/
Sam Ravnborg5e538792008-12-02 23:17:12 -080063
Sam Ravnborg5de18cd2008-11-29 22:16:52 -080064libs-y += arch/sparc/prom/
Sam Ravnborg478b8fe2008-12-03 03:10:25 -080065libs-y += arch/sparc/lib/
Linus Torvalds1da177e2005-04-16 15:20:36 -070066
Tkhai Kirillbdde6b32013-03-19 15:11:07 +000067drivers-$(CONFIG_PM) += arch/sparc/power/
Martin Habets9550e592006-10-17 19:21:48 -070068drivers-$(CONFIG_OPROFILE) += arch/sparc/oprofile/
69
Sam Ravnborga8c601c2008-12-03 03:14:26 -080070boot := arch/sparc/boot
Linus Torvalds1da177e2005-04-16 15:20:36 -070071
Jurij Smakov48e46b72009-08-16 18:21:47 -070072# Default target
73all: zImage
74
Daniel Hellstrom684151a2011-01-26 06:36:35 +000075image zImage uImage tftpboot.img vmlinux.aout: vmlinux
Sam Ravnborga8c601c2008-12-03 03:14:26 -080076 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
Linus Torvalds1da177e2005-04-16 15:20:36 -070077
David L Stevensc78f77e2014-07-25 13:41:51 -040078install:
79 $(Q)$(MAKE) $(build)=$(boot) $@
80
Linus Torvalds1da177e2005-04-16 15:20:36 -070081archclean:
Sam Ravnborga8c601c2008-12-03 03:14:26 -080082 $(Q)$(MAKE) $(clean)=$(boot)
Linus Torvalds1da177e2005-04-16 15:20:36 -070083
Firoz Khan36800332018-11-14 10:56:31 +053084archheaders:
85 $(Q)$(MAKE) $(build)=arch/sparc/kernel/syscalls all
86
Nagarathnam Muthusamy9a088622017-09-21 11:05:31 -040087PHONY += vdso_install
88vdso_install:
89 $(Q)$(MAKE) $(build)=arch/sparc/vdso $@
90
Martin Habets349101d2008-08-18 22:37:18 -070091# This is the image used for packaging
Sam Ravnborga8c601c2008-12-03 03:14:26 -080092KBUILD_IMAGE := $(boot)/zImage
Martin Habets349101d2008-08-18 22:37:18 -070093
Linus Torvalds1da177e2005-04-16 15:20:36 -070094# Don't use tabs in echo arguments.
Sam Ravnborg5e538792008-12-02 23:17:12 -080095ifeq ($(ARCH),sparc)
Linus Torvalds1da177e2005-04-16 15:20:36 -070096define archhelp
97 echo '* image - kernel image ($(boot)/image)'
Martin Habets349101d2008-08-18 22:37:18 -070098 echo '* zImage - stripped kernel image ($(boot)/zImage)'
Daniel Hellstrom684151a2011-01-26 06:36:35 +000099 echo ' uImage - U-Boot SPARC32 Image (only for LEON)'
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 echo ' tftpboot.img - image prepared for tftp'
101endef
Sam Ravnborg5e538792008-12-02 23:17:12 -0800102else
103define archhelp
Jurij Smakov48e46b72009-08-16 18:21:47 -0700104 echo '* vmlinux - standard sparc64 kernel'
105 echo '* zImage - stripped and compressed sparc64 kernel ($(boot)/zImage)'
106 echo ' vmlinux.aout - a.out kernel for sparc64'
Sam Ravnborg5e538792008-12-02 23:17:12 -0800107 echo ' tftpboot.img - image prepared for tftp'
108endef
109endif