blob: edac927e4952347555fe6b60543d6ebf105088c9 [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
12ifeq ($(ARCH),sparc)
13 KBUILD_DEFCONFIG := sparc32_defconfig
14else
15 KBUILD_DEFCONFIG := sparc64_defconfig
16endif
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__
Sam Ravnborg38753582012-05-15 21:21:55 +020024LDFLAGS := -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
Sam Ravnborg38753582012-05-15 21:21:55 +020042CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64
43LDFLAGS := -m elf64_sparc
44export 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
Nagarathnam Muthusamy9a088622017-09-21 11:05:31 -040084PHONY += vdso_install
85vdso_install:
86 $(Q)$(MAKE) $(build)=arch/sparc/vdso $@
87
Martin Habets349101d2008-08-18 22:37:18 -070088# This is the image used for packaging
Sam Ravnborga8c601c2008-12-03 03:14:26 -080089KBUILD_IMAGE := $(boot)/zImage
Martin Habets349101d2008-08-18 22:37:18 -070090
Linus Torvalds1da177e2005-04-16 15:20:36 -070091# Don't use tabs in echo arguments.
Sam Ravnborg5e538792008-12-02 23:17:12 -080092ifeq ($(ARCH),sparc)
Linus Torvalds1da177e2005-04-16 15:20:36 -070093define archhelp
94 echo '* image - kernel image ($(boot)/image)'
Martin Habets349101d2008-08-18 22:37:18 -070095 echo '* zImage - stripped kernel image ($(boot)/zImage)'
Daniel Hellstrom684151a2011-01-26 06:36:35 +000096 echo ' uImage - U-Boot SPARC32 Image (only for LEON)'
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 echo ' tftpboot.img - image prepared for tftp'
98endef
Sam Ravnborg5e538792008-12-02 23:17:12 -080099else
100define archhelp
Jurij Smakov48e46b72009-08-16 18:21:47 -0700101 echo '* vmlinux - standard sparc64 kernel'
102 echo '* zImage - stripped and compressed sparc64 kernel ($(boot)/zImage)'
103 echo ' vmlinux.aout - a.out kernel for sparc64'
Sam Ravnborg5e538792008-12-02 23:17:12 -0800104 echo ' tftpboot.img - image prepared for tftp'
105endef
106endif