xref: /openbmc/linux/arch/parisc/Makefile (revision df24e178)
11da177e4SLinus Torvalds#
21da177e4SLinus Torvalds# parisc/Makefile
31da177e4SLinus Torvalds#
41da177e4SLinus Torvalds# This file is included by the global makefile so that you can add your own
58212f898SMasahiro Yamada# architecture-specific flags and dependencies.
61da177e4SLinus Torvalds#
71da177e4SLinus Torvalds# This file is subject to the terms and conditions of the GNU General Public
81da177e4SLinus Torvalds# License.  See the file "COPYING" in the main directory of this archive
91da177e4SLinus Torvalds# for more details.
101da177e4SLinus Torvalds#
111da177e4SLinus Torvalds# Copyright (C) 1994 by Linus Torvalds
121da177e4SLinus Torvalds# Portions Copyright (C) 1999 The Puffin Group
131da177e4SLinus Torvalds#
141da177e4SLinus Torvalds# Modified for PA-RISC Linux by Paul Lahaie, Alex deVries,
151da177e4SLinus Torvalds# Mike Shaver, Helge Deller and Martin K. Petersen
161da177e4SLinus Torvalds#
17c04f7ae2SAdrian Bunk
181d7c29b7SHelge Dellerifdef CONFIG_PARISC_SELF_EXTRACT
191d7c29b7SHelge Dellerboot := arch/parisc/boot
201d7c29b7SHelge DellerKBUILD_IMAGE := $(boot)/bzImage
211d7c29b7SHelge Dellerelse
22594174d8SHelge DellerKBUILD_IMAGE := vmlinuz
231d7c29b7SHelge Dellerendif
24594174d8SHelge Deller
251da177e4SLinus TorvaldsNM		= sh $(srctree)/arch/parisc/nm
2614516765SLuc Van OostenryckCHECKFLAGS	+= -D__hppa__=1
271da177e4SLinus Torvalds
281da177e4SLinus Torvaldsifdef CONFIG_64BIT
291da177e4SLinus TorvaldsUTS_MACHINE	:= parisc64
301f2f01b1SLuc Van OostenryckCHECKFLAGS	+= -D__LP64__=1
31b6adc16eSHelge DellerLD_BFD		:= elf64-hppa-linux
32991b7d6eSKyle McMartinelse # 32-bit
33b6adc16eSHelge DellerLD_BFD		:= elf32-hppa-linux
341da177e4SLinus Torvaldsendif
351da177e4SLinus Torvalds
36ededa081SHelge Deller# select defconfig based on actual architecture
375f6e0fe0SMasahiro Yamadaifeq ($(ARCH),parisc64)
38ededa081SHelge Deller	KBUILD_DEFCONFIG := generic-64bit_defconfig
395f6e0fe0SMasahiro Yamada	CC_ARCHES := hppa64
40ededa081SHelge Dellerelse
41ededa081SHelge Deller	KBUILD_DEFCONFIG := generic-32bit_defconfig
425f6e0fe0SMasahiro Yamada	CC_ARCHES := hppa hppa2.0 hppa1.1
43ededa081SHelge Dellerendif
44ededa081SHelge Deller
45b6adc16eSHelge Dellerexport LD_BFD
46b6adc16eSHelge Deller
47*df24e178SHelge Deller# Set default 32 bits cross compilers for vdso
48*df24e178SHelge DellerCC_ARCHES_32 = hppa hppa2.0 hppa1.1
49*df24e178SHelge DellerCC_SUFFIXES  = linux linux-gnu unknown-linux-gnu
50*df24e178SHelge DellerCROSS32_COMPILE := $(call cc-cross-prefix, \
51*df24e178SHelge Deller	$(foreach a,$(CC_ARCHES_32), \
52*df24e178SHelge Deller	$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
53*df24e178SHelge DellerCROSS32CC := $(CROSS32_COMPILE)gcc
54*df24e178SHelge Dellerexport CROSS32CC
55*df24e178SHelge Deller
56*df24e178SHelge Deller# Set default cross compiler for kernel build
5723243c1aSMasahiro Yamadaifdef cross_compiling
580e39718bSHelge Deller	ifeq ($(CROSS_COMPILE),)
596880b015SHelge Deller		CC_SUFFIXES = linux linux-gnu unknown-linux-gnu
606880b015SHelge Deller		CROSS_COMPILE := $(call cc-cross-prefix, \
616880b015SHelge Deller			$(foreach a,$(CC_ARCHES), \
626880b015SHelge Deller			$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
630e39718bSHelge Deller	endif
64991b7d6eSKyle McMartinendif
651da177e4SLinus Torvalds
666ca63662SSven Schnelleifdef CONFIG_DYNAMIC_FTRACE
676ca63662SSven Schnelleifdef CONFIG_64BIT
686ca63662SSven SchnelleNOP_COUNT := 8
696ca63662SSven Schnelleelse
706ca63662SSven SchnelleNOP_COUNT := 5
716ca63662SSven Schnelleendif
726ca63662SSven Schnelle
736ca63662SSven Schnelleexport CC_USING_RECORD_MCOUNT:=1
746ca63662SSven Schnelleexport CC_USING_PATCHABLE_FUNCTION_ENTRY:=1
756ca63662SSven Schnelle
766ca63662SSven SchnelleKBUILD_AFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1
776ca63662SSven SchnelleKBUILD_CFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 \
786ca63662SSven Schnelle		 -DFTRACE_PATCHABLE_FUNCTION_SIZE=$(NOP_COUNT)
796ca63662SSven Schnelle
806ca63662SSven SchnelleCC_FLAGS_FTRACE := -fpatchable-function-entry=$(NOP_COUNT),$(shell echo $$(($(NOP_COUNT)-1)))
816ca63662SSven Schnelleendif
826ca63662SSven Schnelle
831da177e4SLinus TorvaldsOBJCOPY_FLAGS =-O binary -R .note -R .comment -S
841da177e4SLinus Torvalds
851da177e4SLinus Torvaldscflags-y	:= -pipe
861da177e4SLinus Torvalds
871da177e4SLinus Torvalds# These flags should be implied by an hppa-linux configuration, but they
881da177e4SLinus Torvalds# are not in gcc 3.2.
89d26a7730SJohn David Anglincflags-y	+= -mno-space-regs
90d26a7730SJohn David Anglin
91d26a7730SJohn David Anglin# -mfast-indirect-calls is only relevant for 32-bit kernels.
92d26a7730SJohn David Anglinifndef CONFIG_64BIT
93d26a7730SJohn David Anglincflags-y	+= -mfast-indirect-calls
94d26a7730SJohn David Anglinendif
951da177e4SLinus Torvalds
961da177e4SLinus Torvalds# Currently we save and restore fpregs on all kernel entry/interruption paths.
971da177e4SLinus Torvalds# If that gets optimized, we might need to disable the use of fpregs in the
981da177e4SLinus Torvalds# kernel.
99fa681a18SRandolph Chungcflags-y	+= -mdisable-fpregs
1001da177e4SLinus Torvalds
101ec758f98SHelge Deller# Use long jumps instead of long branches (needed if your linker fails to
102cf71130dSHelge Deller# link a too big vmlinux executable). Not enabled for building modules.
103cf71130dSHelge Dellerifdef CONFIG_MLONGCALLS
104cf71130dSHelge DellerKBUILD_CFLAGS_KERNEL += -mlong-calls
105cf71130dSHelge Dellerendif
106ec758f98SHelge Deller
1071e8249b8SHelge Deller# Without this, "ld -r" results in .text sections that are too big (> 0x40000)
1081e8249b8SHelge Deller# for branches to reach stubs. And multiple .text sections trigger a warning
1091e8249b8SHelge Deller# when creating the sysfs module information section.
1101e8249b8SHelge Dellerifndef CONFIG_64BIT
1111e8249b8SHelge DellerKBUILD_CFLAGS_MODULE += -ffunction-sections
1121e8249b8SHelge Dellerendif
1131e8249b8SHelge Deller
1141da177e4SLinus Torvalds# select which processor to optimise for
11576603902SPaul Bollecflags-$(CONFIG_PA7000)		+= -march=1.1 -mschedule=7100
1161da177e4SLinus Torvaldscflags-$(CONFIG_PA7200)		+= -march=1.1 -mschedule=7200
1171da177e4SLinus Torvaldscflags-$(CONFIG_PA7100LC)	+= -march=1.1 -mschedule=7100LC
1181da177e4SLinus Torvaldscflags-$(CONFIG_PA7300LC)	+= -march=1.1 -mschedule=7300
1191da177e4SLinus Torvaldscflags-$(CONFIG_PA8X00)		+= -march=2.0 -mschedule=8000
1201da177e4SLinus Torvalds
1211da177e4SLinus Torvaldshead-y			:= arch/parisc/kernel/head.o
1221da177e4SLinus Torvalds
123a0f97e06SSam RavnborgKBUILD_CFLAGS	+= $(cflags-y)
1240d341e0dSHelge DellerLIBGCC		:= $(shell $(CC) -print-libgcc-file-name)
1250d341e0dSHelge Dellerexport LIBGCC
1261da177e4SLinus Torvalds
1274c01acc0SJames Bottomleylibs-y	+= arch/parisc/lib/ $(LIBGCC)
1281da177e4SLinus Torvalds
129b6adc16eSHelge Dellerboot	:= arch/parisc/boot
130b6adc16eSHelge Deller
1316525ee55SKyle McMartinPALO := $(shell if (which palo 2>&1); then : ; \
1325feb4f39SKyle McMartin	elif [ -x /sbin/palo ]; then echo /sbin/palo; \
1335feb4f39SKyle McMartin	fi)
1345feb4f39SKyle McMartin
13575dd4747SMasahiro YamadaPALOCONF := $(shell if [ -f $(srctree)/palo.conf ]; then echo $(srctree)/palo.conf; \
13675dd4747SMasahiro Yamada	else echo $(objtree)/palo.conf; \
137f67d4033SKyle McMartin	fi)
138f67d4033SKyle McMartin
139b0756b5aSHelge Dellerpalo lifimage: vmlinuz
140f67d4033SKyle McMartin	@if test ! -x "$(PALO)"; then \
1415feb4f39SKyle McMartin		echo 'ERROR: Please install palo first (apt-get install palo)';\
1425feb4f39SKyle McMartin		echo 'or build it from source and install it somewhere in your $$PATH';\
1435feb4f39SKyle McMartin		false; \
1445feb4f39SKyle McMartin	fi
145f67d4033SKyle McMartin	@if test ! -f "$(PALOCONF)"; then \
14675dd4747SMasahiro Yamada		cp $(srctree)/arch/parisc/defpalo.conf $(objtree)/palo.conf; \
14775dd4747SMasahiro Yamada		echo 'A generic palo config file ($(objree)/palo.conf) has been created for you.'; \
1485feb4f39SKyle McMartin		echo 'You should check it and re-run "make palo".'; \
1495feb4f39SKyle McMartin		echo 'WARNING: the "lifimage" file is now placed in this directory by default!'; \
1505feb4f39SKyle McMartin		false; \
1515feb4f39SKyle McMartin	fi
152f67d4033SKyle McMartin	$(PALO) -f $(PALOCONF)
1535feb4f39SKyle McMartin
154b0756b5aSHelge DellerBOOT_TARGETS    = zImage Image palo lifimage
155b0756b5aSHelge DellerINSTALL_TARGETS = zinstall install
156b0756b5aSHelge Deller
157b0756b5aSHelge DellerPHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
158b0756b5aSHelge Deller
15989e050c8SHelge Deller# Default kernel to build
16089e050c8SHelge Dellerall: bzImage
16189e050c8SHelge Deller
162b6adc16eSHelge DellerzImage: vmlinuz
163594174d8SHelge DellerImage: vmlinux
1641da177e4SLinus Torvalds
165b6adc16eSHelge DellerbzImage: vmlinux
166b6adc16eSHelge Deller	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
167b6adc16eSHelge Deller
168af21b01dSHelge Dellerifdef CONFIG_PARISC_SELF_EXTRACT
169b6adc16eSHelge Dellervmlinuz: bzImage
170b6adc16eSHelge Deller	$(OBJCOPY) $(boot)/bzImage $@
171af21b01dSHelge Dellerelse
172af21b01dSHelge Dellervmlinuz: vmlinux
173e4a42c82SDenis Efremov	@$(KGZIP) -cf -9 $< > $@
174af21b01dSHelge Dellerendif
175594174d8SHelge Deller
176*df24e178SHelge Dellerifeq ($(KBUILD_EXTMOD),)
177*df24e178SHelge Deller# We need to generate vdso-offsets.h before compiling certain files in kernel/.
178*df24e178SHelge Deller# In order to do that, we should use the archprepare target, but we can't since
179*df24e178SHelge Deller# asm-offsets.h is included in some files used to generate vdso-offsets.h, and
180*df24e178SHelge Deller# asm-offsets.h is built in prepare0, for which archprepare is a dependency.
181*df24e178SHelge Deller# Therefore we need to generate the header after prepare0 has been made, hence
182*df24e178SHelge Deller# this hack.
183*df24e178SHelge Dellerprepare: vdso_prepare
184*df24e178SHelge Dellervdso_prepare: prepare0
185*df24e178SHelge Deller	$(if $(CONFIG_64BIT),$(Q)$(MAKE) \
186*df24e178SHelge Deller		$(build)=arch/parisc/kernel/vdso64 include/generated/vdso64-offsets.h)
187*df24e178SHelge Deller	$(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 include/generated/vdso32-offsets.h
188*df24e178SHelge Dellerendif
189*df24e178SHelge Deller
190*df24e178SHelge DellerPHONY += vdso_install
191*df24e178SHelge Deller
192*df24e178SHelge Dellervdso_install:
193*df24e178SHelge Deller	$(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso $@
194*df24e178SHelge Deller	$(if $(CONFIG_COMPAT_VDSO), \
195*df24e178SHelge Deller		$(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 $@)
196b0756b5aSHelge Dellerinstall:
19775dd4747SMasahiro Yamada	$(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
198b0756b5aSHelge Deller			$(KERNELRELEASE) vmlinux System.map "$(INSTALL_PATH)"
199b0756b5aSHelge Dellerzinstall:
20075dd4747SMasahiro Yamada	$(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
201b0756b5aSHelge Deller			$(KERNELRELEASE) vmlinuz System.map "$(INSTALL_PATH)"
2021da177e4SLinus Torvalds
2030013a854SSam RavnborgCLEAN_FILES	+= lifimage
2041da177e4SLinus TorvaldsMRPROPER_FILES	+= palo.conf
2051da177e4SLinus Torvalds
2061da177e4SLinus Torvaldsdefine archhelp
2071da177e4SLinus Torvalds	@echo  '* vmlinux	- Uncompressed kernel image (./vmlinux)'
208594174d8SHelge Deller	@echo  '  vmlinuz	- Compressed kernel image (./vmlinuz)'
2095feb4f39SKyle McMartin	@echo  '  palo		- Bootable image (./lifimage)'
210b0756b5aSHelge Deller	@echo  '  install	- Install uncompressed vmlinux kernel using'
211caa27b66SSam Ravnborg	@echo  '		  (your) ~/bin/$(INSTALLKERNEL) or'
212caa27b66SSam Ravnborg	@echo  '		  (distribution) /sbin/$(INSTALLKERNEL) or'
2131da177e4SLinus Torvalds	@echo  '		  copy to $$(INSTALL_PATH)'
214b0756b5aSHelge Deller	@echo  '  zinstall	- Install compressed vmlinuz kernel'
2151da177e4SLinus Torvaldsendef
216575afc4dSFiroz Khan
217575afc4dSFiroz Khanarchheaders:
218575afc4dSFiroz Khan	$(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all
219