blob: 83ef8724c83367f28f7f1884d73a079e32962cef [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#
2# s390/Makefile
3#
4# This file is included by the global makefile so that you can add your own
5# architecture-specific flags and dependencies. Remember to do have actions
6# for "archclean" and "archdep" for cleaning up and making dependencies for
7# this architecture
8#
9# This file is subject to the terms and conditions of the GNU General Public
10# License. See the file "COPYING" in the main directory of this archive
11# for more details.
12#
13# Copyright (C) 1994 by Linus Torvalds
14#
15
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -080016ifndef CONFIG_64BIT
Linus Torvalds1da177e2005-04-16 15:20:36 -070017LDFLAGS := -m elf_s390
Sam Ravnborga0f97e02007-10-14 22:21:35 +020018KBUILD_CFLAGS += -m31
Sam Ravnborg222d3942007-10-15 21:59:31 +020019KBUILD_AFLAGS += -m31
Linus Torvalds1da177e2005-04-16 15:20:36 -070020UTS_MACHINE := s390
21STACK_SIZE := 8192
Al Viro22bb3e92007-07-15 21:00:41 +010022CHECKFLAGS += -D__s390__ -msize-long
Martin Schwidefsky347a8dc2006-01-06 00:19:28 -080023else
Linus Torvalds1da177e2005-04-16 15:20:36 -070024LDFLAGS := -m elf64_s390
Sam Ravnborg65881692010-07-28 17:33:09 +020025KBUILD_AFLAGS_MODULE += -fpic -D__PIC__
26KBUILD_CFLAGS_MODULE += -fpic -D__PIC__
Sam Ravnborga0f97e02007-10-14 22:21:35 +020027KBUILD_CFLAGS += -m64
Sam Ravnborg222d3942007-10-15 21:59:31 +020028KBUILD_AFLAGS += -m64
Linus Torvalds1da177e2005-04-16 15:20:36 -070029UTS_MACHINE := s390x
30STACK_SIZE := 16384
viro@ZenIV.linux.org.ukd310a352005-09-09 16:56:05 +010031CHECKFLAGS += -D__s390__ -D__s390x__
Linus Torvalds1da177e2005-04-16 15:20:36 -070032endif
33
34cflags-$(CONFIG_MARCH_G5) += $(call cc-option,-march=g5)
35cflags-$(CONFIG_MARCH_Z900) += $(call cc-option,-march=z900)
36cflags-$(CONFIG_MARCH_Z990) += $(call cc-option,-march=z990)
Christian Borntraeger0efa4702006-09-28 16:55:46 +020037cflags-$(CONFIG_MARCH_Z9_109) += $(call cc-option,-march=z9-109)
Martin Schwidefskye37f50e2008-12-25 13:39:19 +010038cflags-$(CONFIG_MARCH_Z10) += $(call cc-option,-march=z10)
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Christian Borntraeger1681ced2006-12-04 15:40:49 +010040#KBUILD_IMAGE is necessary for make rpm
41KBUILD_IMAGE :=arch/s390/boot/image
42
Heiko Carstenscbbd1fa2006-07-03 00:24:38 -070043#
44# Prevent tail-call optimizations, to get clearer backtraces:
45#
46cflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls
47
Linus Torvalds1da177e2005-04-16 15:20:36 -070048# old style option for packed stacks
49ifeq ($(call cc-option-yn,-mkernel-backchain),y)
50cflags-$(CONFIG_PACK_STACK) += -mkernel-backchain -D__PACK_STACK
51aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK
52cflags-$(CONFIG_SMALL_STACK) += -D__SMALL_STACK
53aflags-$(CONFIG_SMALL_STACK) += -D__SMALL_STACK
54ifdef CONFIG_SMALL_STACK
55STACK_SIZE := $(shell echo $$(($(STACK_SIZE)/2)) )
56endif
57endif
58
59# new style option for packed stacks
60ifeq ($(call cc-option-yn,-mpacked-stack),y)
61cflags-$(CONFIG_PACK_STACK) += -mpacked-stack -D__PACK_STACK
62aflags-$(CONFIG_PACK_STACK) += -D__PACK_STACK
63cflags-$(CONFIG_SMALL_STACK) += -D__SMALL_STACK
64aflags-$(CONFIG_SMALL_STACK) += -D__SMALL_STACK
65ifdef CONFIG_SMALL_STACK
66STACK_SIZE := $(shell echo $$(($(STACK_SIZE)/2)) )
67endif
68endif
69
70ifeq ($(call cc-option-yn,-mstack-size=8192 -mstack-guard=128),y)
71cflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE)
Martin Schwidefskybe796282007-04-27 16:01:46 +020072ifneq ($(call cc-option-yn,-mstack-size=8192),y)
Linus Torvalds1da177e2005-04-16 15:20:36 -070073cflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD)
74endif
Martin Schwidefskybe796282007-04-27 16:01:46 +020075endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070076
77ifeq ($(call cc-option-yn,-mwarn-dynamicstack),y)
78cflags-$(CONFIG_WARN_STACK) += -mwarn-dynamicstack
79cflags-$(CONFIG_WARN_STACK) += -mwarn-framesize=$(CONFIG_WARN_STACK_SIZE)
80endif
81
Sam Ravnborga0f97e02007-10-14 22:21:35 +020082KBUILD_CFLAGS += -mbackchain -msoft-float $(cflags-y)
83KBUILD_CFLAGS += -pipe -fno-strength-reduce -Wno-sign-compare
Sam Ravnborg222d3942007-10-15 21:59:31 +020084KBUILD_AFLAGS += $(aflags-y)
Linus Torvalds1da177e2005-04-16 15:20:36 -070085
86OBJCOPYFLAGS := -O binary
87LDFLAGS_vmlinux := -e start
88
Michael Holzheu4562c9f2007-02-21 10:55:46 +010089head-y := arch/s390/kernel/head.o arch/s390/kernel/init_task.o
Linus Torvalds1da177e2005-04-16 15:20:36 -070090
Michael Holzheu4562c9f2007-02-21 10:55:46 +010091core-y += arch/s390/mm/ arch/s390/kernel/ arch/s390/crypto/ \
Heiko Carstensc48ff642009-09-11 10:28:37 +020092 arch/s390/appldata/ arch/s390/hypfs/ arch/s390/kvm/
Hans-Joachim Picht155af2f2009-06-16 10:30:52 +020093
Michael Holzheu4562c9f2007-02-21 10:55:46 +010094libs-y += arch/s390/lib/
Linus Torvalds1da177e2005-04-16 15:20:36 -070095drivers-y += drivers/s390/
Michael Holzheu4562c9f2007-02-21 10:55:46 +010096drivers-$(CONFIG_MATHEMU) += arch/s390/math-emu/
Linus Torvalds1da177e2005-04-16 15:20:36 -070097
98# must be linked after kernel
99drivers-$(CONFIG_OPROFILE) += arch/s390/oprofile/
100
Michael Holzheu4562c9f2007-02-21 10:55:46 +0100101boot := arch/s390/boot
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102
103all: image
104
105install: vmlinux
106 $(Q)$(MAKE) $(build)=$(boot) $@
107
108image: vmlinux
109 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
110
Michael Holzheu411ed322007-04-27 16:01:49 +0200111zfcpdump:
112 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
113
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114archclean:
115 $(Q)$(MAKE) $(clean)=$(boot)
116
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117# Don't use tabs in echo arguments
118define archhelp
119 echo '* image - Kernel image for IPL ($(boot)/image)'
120endef