xref: /linux/arch/s390/Makefile (revision 7bceec4e58ee23be653c0dd366479d6cb64ae686)
10b73214fSGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
21da177e4SLinus Torvalds#
31da177e4SLinus Torvalds# s390/Makefile
41da177e4SLinus Torvalds#
51da177e4SLinus Torvalds# This file is included by the global makefile so that you can add your own
61da177e4SLinus Torvalds# architecture-specific flags and dependencies. Remember to do have actions
71da177e4SLinus Torvalds# for "archclean" and "archdep" for cleaning up and making dependencies for
81da177e4SLinus Torvalds# this architecture
91da177e4SLinus Torvalds#
101da177e4SLinus Torvalds# Copyright (C) 1994 by Linus Torvalds
111da177e4SLinus Torvalds#
121da177e4SLinus Torvalds
131844c9bcSMartin SchwidefskyLD_BFD		:= elf64-s390
141da177e4SLinus TorvaldsLDFLAGS		:= -m elf64_s390
157bdc229fSMartin SchwidefskyKBUILD_AFLAGS_MODULE += -fPIC
167bdc229fSMartin SchwidefskyKBUILD_CFLAGS_MODULE += -fPIC
17a0f97e06SSam RavnborgKBUILD_CFLAGS	+= -m64
18222d394dSSam RavnborgKBUILD_AFLAGS	+= -m64
191da177e4SLinus TorvaldsUTS_MACHINE	:= s390x
201da177e4SLinus TorvaldsSTACK_SIZE	:= 16384
213b42c17aSLuc Van OostenryckCHECKFLAGS	+= -D__s390__ -D__s390x__ -mbig-endian
221da177e4SLinus Torvalds
231844c9bcSMartin Schwidefskyexport LD_BFD
241844c9bcSMartin Schwidefsky
250f1b1ff5SHeiko Carstensmflags-$(CONFIG_MARCH_Z900)   := -march=z900
260f1b1ff5SHeiko Carstensmflags-$(CONFIG_MARCH_Z990)   := -march=z990
270f1b1ff5SHeiko Carstensmflags-$(CONFIG_MARCH_Z9_109) := -march=z9-109
280f1b1ff5SHeiko Carstensmflags-$(CONFIG_MARCH_Z10)    := -march=z10
290f1b1ff5SHeiko Carstensmflags-$(CONFIG_MARCH_Z196)   := -march=z196
300f1b1ff5SHeiko Carstensmflags-$(CONFIG_MARCH_ZEC12)  := -march=zEC12
31f8b2dcbdSMartin Schwidefskymflags-$(CONFIG_MARCH_Z13)    := -march=z13
326997c323SMartin Schwidefskymflags-$(CONFIG_MARCH_Z14)    := -march=z14
330f1b1ff5SHeiko Carstens
3422362a0eSMartin Schwidefskyexport CC_FLAGS_MARCH := $(mflags-y)
3522362a0eSMartin Schwidefsky
360f1b1ff5SHeiko Carstensaflags-y += $(mflags-y)
370f1b1ff5SHeiko Carstenscflags-y += $(mflags-y)
381da177e4SLinus Torvalds
391db9e051SHeiko Carstenscflags-$(CONFIG_MARCH_Z900_TUNE)	+= -mtune=z900
401db9e051SHeiko Carstenscflags-$(CONFIG_MARCH_Z990_TUNE)	+= -mtune=z990
411db9e051SHeiko Carstenscflags-$(CONFIG_MARCH_Z9_109_TUNE)	+= -mtune=z9-109
421db9e051SHeiko Carstenscflags-$(CONFIG_MARCH_Z10_TUNE)		+= -mtune=z10
431db9e051SHeiko Carstenscflags-$(CONFIG_MARCH_Z196_TUNE)	+= -mtune=z196
441db9e051SHeiko Carstenscflags-$(CONFIG_MARCH_ZEC12_TUNE)	+= -mtune=zEC12
45f8b2dcbdSMartin Schwidefskycflags-$(CONFIG_MARCH_Z13_TUNE)		+= -mtune=z13
466997c323SMartin Schwidefskycflags-$(CONFIG_MARCH_Z14_TUNE)		+= -mtune=z14
471db9e051SHeiko Carstens
48c783b91eSMartin Schwidefskycflags-y += -Wa,-I$(srctree)/arch/$(ARCH)/include
49c783b91eSMartin Schwidefsky
501681cedaSChristian Borntraeger#KBUILD_IMAGE is necessary for make rpm
511681cedaSChristian BorntraegerKBUILD_IMAGE	:=arch/s390/boot/image
521681cedaSChristian Borntraeger
53cbbd1fa7SHeiko Carstens#
54cbbd1fa7SHeiko Carstens# Prevent tail-call optimizations, to get clearer backtraces:
55cbbd1fa7SHeiko Carstens#
56cbbd1fa7SHeiko Carstenscflags-$(CONFIG_FRAME_POINTER) += -fno-optimize-sibling-calls
57cbbd1fa7SHeiko Carstens
581da177e4SLinus Torvalds# old style option for packed stacks
591da177e4SLinus Torvaldsifeq ($(call cc-option-yn,-mkernel-backchain),y)
601da177e4SLinus Torvaldscflags-$(CONFIG_PACK_STACK)  += -mkernel-backchain -D__PACK_STACK
611da177e4SLinus Torvaldsaflags-$(CONFIG_PACK_STACK)  += -D__PACK_STACK
621da177e4SLinus Torvaldsendif
631da177e4SLinus Torvalds
641da177e4SLinus Torvalds# new style option for packed stacks
651da177e4SLinus Torvaldsifeq ($(call cc-option-yn,-mpacked-stack),y)
661da177e4SLinus Torvaldscflags-$(CONFIG_PACK_STACK)  += -mpacked-stack -D__PACK_STACK
671da177e4SLinus Torvaldsaflags-$(CONFIG_PACK_STACK)  += -D__PACK_STACK
681da177e4SLinus Torvaldsendif
691da177e4SLinus Torvalds
701da177e4SLinus Torvaldsifeq ($(call cc-option-yn,-mstack-size=8192 -mstack-guard=128),y)
711da177e4SLinus Torvaldscflags-$(CONFIG_CHECK_STACK) += -mstack-size=$(STACK_SIZE)
72be796285SMartin Schwidefskyifneq ($(call cc-option-yn,-mstack-size=8192),y)
731da177e4SLinus Torvaldscflags-$(CONFIG_CHECK_STACK) += -mstack-guard=$(CONFIG_STACK_GUARD)
741da177e4SLinus Torvaldsendif
75be796285SMartin Schwidefskyendif
761da177e4SLinus Torvalds
771da177e4SLinus Torvaldsifeq ($(call cc-option-yn,-mwarn-dynamicstack),y)
782c190da4SJan Glaubercflags-$(CONFIG_WARN_DYNAMIC_STACK) += -mwarn-dynamicstack
791da177e4SLinus Torvaldsendif
801da177e4SLinus Torvalds
81e6d60b36SHeiko Carstensifdef CONFIG_FUNCTION_TRACER
82e6d60b36SHeiko Carstens# make use of hotpatch feature if the compiler supports it
83e6d60b36SHeiko Carstenscc_hotpatch	:= -mhotpatch=0,3
84e6d60b36SHeiko Carstensifeq ($(call cc-option-yn,$(cc_hotpatch)),y)
85e6d60b36SHeiko CarstensCC_FLAGS_FTRACE := $(cc_hotpatch)
86e6d60b36SHeiko CarstensKBUILD_AFLAGS	+= -DCC_USING_HOTPATCH
87e6d60b36SHeiko CarstensKBUILD_CFLAGS	+= -DCC_USING_HOTPATCH
88e6d60b36SHeiko Carstensendif
89e6d60b36SHeiko Carstensendif
90e6d60b36SHeiko Carstens
91*7bceec4eSHendrik Brueckner# Test CFI features of binutils
92*7bceec4eSHendrik Bruecknercfi := $(call as-instr,.cfi_startproc\n.cfi_val_offset 15$(comma)-160\n.cfi_endproc,-DCONFIG_AS_CFI_VAL_OFFSET=1)
93*7bceec4eSHendrik Brueckner
94a0f97e06SSam RavnborgKBUILD_CFLAGS	+= -mbackchain -msoft-float $(cflags-y)
95a0f97e06SSam RavnborgKBUILD_CFLAGS	+= -pipe -fno-strength-reduce -Wno-sign-compare
96*7bceec4eSHendrik BruecknerKBUILD_CFLAGS	+= -fno-asynchronous-unwind-tables $(cfi)
97*7bceec4eSHendrik BruecknerKBUILD_AFLAGS	+= $(aflags-y) $(cfi)
981da177e4SLinus Torvalds
991da177e4SLinus TorvaldsOBJCOPYFLAGS	:= -O binary
1001da177e4SLinus Torvalds
1011844c9bcSMartin Schwidefskyhead-y		:= arch/s390/kernel/head.o
1025a79859aSHeiko Carstenshead-y		+= arch/s390/kernel/head64.o
1031da177e4SLinus Torvalds
10401485943SHeiko Carstens# See arch/s390/Kbuild for content of core part of the kernel
10501485943SHeiko Carstenscore-y		+= arch/s390/
106155af2f9SHans-Joachim Picht
1074562c9ffSMichael Holzheulibs-y		+= arch/s390/lib/
1081da177e4SLinus Torvaldsdrivers-y	+= drivers/s390/
1091da177e4SLinus Torvalds
1101da177e4SLinus Torvalds# must be linked after kernel
1111da177e4SLinus Torvaldsdrivers-$(CONFIG_OPROFILE)	+= arch/s390/oprofile/
1121da177e4SLinus Torvalds
1134562c9ffSMichael Holzheuboot		:= arch/s390/boot
114c30f6828SHeiko Carstenstools		:= arch/s390/tools
1151da177e4SLinus Torvalds
1161844c9bcSMartin Schwidefskyall: image bzImage
1171da177e4SLinus Torvalds
1181da177e4SLinus Torvaldsinstall: vmlinux
1191da177e4SLinus Torvalds	$(Q)$(MAKE) $(build)=$(boot) $@
1201da177e4SLinus Torvalds
1211844c9bcSMartin Schwidefskyimage bzImage: vmlinux
1221da177e4SLinus Torvalds	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
1231da177e4SLinus Torvalds
124411ed322SMichael Holzheuzfcpdump:
125411ed322SMichael Holzheu	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
126411ed322SMichael Holzheu
127f3cb31e4SHendrik Bruecknervdso_install:
128f3cb31e4SHendrik Brueckner	$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@
129f3cb31e4SHendrik Brueckner	$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@
130f3cb31e4SHendrik Brueckner
1311da177e4SLinus Torvaldsarchclean:
1321da177e4SLinus Torvalds	$(Q)$(MAKE) $(clean)=$(boot)
133c30f6828SHeiko Carstens	$(Q)$(MAKE) $(clean)=$(tools)
134c30f6828SHeiko Carstens
135c30f6828SHeiko Carstensarchprepare:
136c30f6828SHeiko Carstens	$(Q)$(MAKE) $(build)=$(tools) include/generated/facilities.h
1378bc1e4ecSHeiko Carstens	$(Q)$(MAKE) $(build)=$(tools) include/generated/dis.h
1381da177e4SLinus Torvalds
1391da177e4SLinus Torvalds# Don't use tabs in echo arguments
1401da177e4SLinus Torvaldsdefine archhelp
1411da177e4SLinus Torvalds  echo  '* image           - Kernel image for IPL ($(boot)/image)'
1421844c9bcSMartin Schwidefsky  echo	'* bzImage         - Compressed kernel image for IPL ($(boot)/bzImage)'
143b8eecf36SMichael Holzheu  echo	'  install         - Install kernel using'
144b8eecf36SMichael Holzheu  echo	'                    (your) ~/bin/$(INSTALLKERNEL) or'
145b8eecf36SMichael Holzheu  echo	'                    (distribution) /sbin/$(INSTALLKERNEL) or'
146b8eecf36SMichael Holzheu  echo	'                    install to $$(INSTALL_PATH)'
1471da177e4SLinus Torvaldsendef
148