xref: /openbmc/linux/arch/parisc/Makefile (revision ededa081)
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
51da177e4SLinus Torvalds# architecture-specific flags and dependencies. Remember to do have actions
61da177e4SLinus Torvalds# for "archclean" and "archdep" for cleaning up and making dependencies for
71da177e4SLinus Torvalds# this architecture
81da177e4SLinus Torvalds#
91da177e4SLinus Torvalds# This file is subject to the terms and conditions of the GNU General Public
101da177e4SLinus Torvalds# License.  See the file "COPYING" in the main directory of this archive
111da177e4SLinus Torvalds# for more details.
121da177e4SLinus Torvalds#
131da177e4SLinus Torvalds# Copyright (C) 1994 by Linus Torvalds
141da177e4SLinus Torvalds# Portions Copyright (C) 1999 The Puffin Group
151da177e4SLinus Torvalds#
161da177e4SLinus Torvalds# Modified for PA-RISC Linux by Paul Lahaie, Alex deVries,
171da177e4SLinus Torvalds# Mike Shaver, Helge Deller and Martin K. Petersen
181da177e4SLinus Torvalds#
19c04f7ae2SAdrian Bunk
20594174d8SHelge DellerKBUILD_IMAGE := vmlinuz
21594174d8SHelge Deller
221da177e4SLinus TorvaldsNM		= sh $(srctree)/arch/parisc/nm
2314516765SLuc Van OostenryckCHECKFLAGS	+= -D__hppa__=1
244c01acc0SJames BottomleyLIBGCC		= $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
25b6adc16eSHelge Dellerexport LIBGCC
261da177e4SLinus Torvalds
271da177e4SLinus Torvaldsifdef CONFIG_64BIT
281da177e4SLinus TorvaldsUTS_MACHINE	:= parisc64
291f2f01b1SLuc Van OostenryckCHECKFLAGS	+= -D__LP64__=1
306880b015SHelge DellerCC_ARCHES	= hppa64
31b6adc16eSHelge DellerLD_BFD		:= elf64-hppa-linux
32991b7d6eSKyle McMartinelse # 32-bit
336880b015SHelge DellerCC_ARCHES	= hppa hppa2.0 hppa1.1
34b6adc16eSHelge DellerLD_BFD		:= elf32-hppa-linux
351da177e4SLinus Torvaldsendif
361da177e4SLinus Torvalds
37ededa081SHelge Deller# select defconfig based on actual architecture
38ededa081SHelge Dellerifeq ($(shell uname -m),parisc64)
39ededa081SHelge Deller	KBUILD_DEFCONFIG := generic-64bit_defconfig
40ededa081SHelge Dellerelse
41ededa081SHelge Deller	KBUILD_DEFCONFIG := generic-32bit_defconfig
42ededa081SHelge Dellerendif
43ededa081SHelge Deller
44b6adc16eSHelge Dellerexport LD_BFD
45b6adc16eSHelge Deller
466880b015SHelge Dellerifneq ($(SUBARCH),$(UTS_MACHINE))
470e39718bSHelge Deller	ifeq ($(CROSS_COMPILE),)
486880b015SHelge Deller		CC_SUFFIXES = linux linux-gnu unknown-linux-gnu
496880b015SHelge Deller		CROSS_COMPILE := $(call cc-cross-prefix, \
506880b015SHelge Deller			$(foreach a,$(CC_ARCHES), \
516880b015SHelge Deller			$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
520e39718bSHelge Deller	endif
53991b7d6eSKyle McMartinendif
541da177e4SLinus Torvalds
556ca63662SSven Schnelleifdef CONFIG_DYNAMIC_FTRACE
566ca63662SSven Schnelleifdef CONFIG_64BIT
576ca63662SSven SchnelleNOP_COUNT := 8
586ca63662SSven Schnelleelse
596ca63662SSven SchnelleNOP_COUNT := 5
606ca63662SSven Schnelleendif
616ca63662SSven Schnelle
626ca63662SSven Schnelleexport CC_USING_RECORD_MCOUNT:=1
636ca63662SSven Schnelleexport CC_USING_PATCHABLE_FUNCTION_ENTRY:=1
646ca63662SSven Schnelle
656ca63662SSven SchnelleKBUILD_AFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1
666ca63662SSven SchnelleKBUILD_CFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 \
676ca63662SSven Schnelle		 -DFTRACE_PATCHABLE_FUNCTION_SIZE=$(NOP_COUNT)
686ca63662SSven Schnelle
696ca63662SSven SchnelleCC_FLAGS_FTRACE := -fpatchable-function-entry=$(NOP_COUNT),$(shell echo $$(($(NOP_COUNT)-1)))
706ca63662SSven Schnelleendif
716ca63662SSven Schnelle
721da177e4SLinus TorvaldsOBJCOPY_FLAGS =-O binary -R .note -R .comment -S
731da177e4SLinus Torvalds
741da177e4SLinus Torvaldscflags-y	:= -pipe
751da177e4SLinus Torvalds
761da177e4SLinus Torvalds# These flags should be implied by an hppa-linux configuration, but they
771da177e4SLinus Torvalds# are not in gcc 3.2.
78d26a7730SJohn David Anglincflags-y	+= -mno-space-regs
79d26a7730SJohn David Anglin
80d26a7730SJohn David Anglin# -mfast-indirect-calls is only relevant for 32-bit kernels.
81d26a7730SJohn David Anglinifndef CONFIG_64BIT
82d26a7730SJohn David Anglincflags-y	+= -mfast-indirect-calls
83d26a7730SJohn David Anglinendif
841da177e4SLinus Torvalds
851da177e4SLinus Torvalds# Currently we save and restore fpregs on all kernel entry/interruption paths.
861da177e4SLinus Torvalds# If that gets optimized, we might need to disable the use of fpregs in the
871da177e4SLinus Torvalds# kernel.
88fa681a18SRandolph Chungcflags-y	+= -mdisable-fpregs
891da177e4SLinus Torvalds
90ec758f98SHelge Deller# Use long jumps instead of long branches (needed if your linker fails to
91cf71130dSHelge Deller# link a too big vmlinux executable). Not enabled for building modules.
92cf71130dSHelge Dellerifdef CONFIG_MLONGCALLS
93cf71130dSHelge DellerKBUILD_CFLAGS_KERNEL += -mlong-calls
94cf71130dSHelge Dellerendif
95ec758f98SHelge Deller
961e8249b8SHelge Deller# Without this, "ld -r" results in .text sections that are too big (> 0x40000)
971e8249b8SHelge Deller# for branches to reach stubs. And multiple .text sections trigger a warning
981e8249b8SHelge Deller# when creating the sysfs module information section.
991e8249b8SHelge Dellerifndef CONFIG_64BIT
1001e8249b8SHelge DellerKBUILD_CFLAGS_MODULE += -ffunction-sections
1011e8249b8SHelge Dellerendif
1021e8249b8SHelge Deller
1031da177e4SLinus Torvalds# select which processor to optimise for
10476603902SPaul Bollecflags-$(CONFIG_PA7000)		+= -march=1.1 -mschedule=7100
1051da177e4SLinus Torvaldscflags-$(CONFIG_PA7200)		+= -march=1.1 -mschedule=7200
1061da177e4SLinus Torvaldscflags-$(CONFIG_PA7100LC)	+= -march=1.1 -mschedule=7100LC
1071da177e4SLinus Torvaldscflags-$(CONFIG_PA7300LC)	+= -march=1.1 -mschedule=7300
1081da177e4SLinus Torvaldscflags-$(CONFIG_PA8X00)		+= -march=2.0 -mschedule=8000
1091da177e4SLinus Torvalds
1101da177e4SLinus Torvaldshead-y			:= arch/parisc/kernel/head.o
1111da177e4SLinus Torvalds
112a0f97e06SSam RavnborgKBUILD_CFLAGS	+= $(cflags-y)
1131da177e4SLinus Torvalds
114481f93b6SThomas Gleixnerkernel-y			:= mm/ kernel/ math-emu/
1151da177e4SLinus Torvalds
1161da177e4SLinus Torvaldscore-y	+= $(addprefix arch/parisc/, $(kernel-y))
1174c01acc0SJames Bottomleylibs-y	+= arch/parisc/lib/ $(LIBGCC)
1181da177e4SLinus Torvalds
1191da177e4SLinus Torvaldsdrivers-$(CONFIG_OPROFILE)		+= arch/parisc/oprofile/
1201da177e4SLinus Torvalds
121b6adc16eSHelge Dellerboot	:= arch/parisc/boot
122b6adc16eSHelge Deller
1236525ee55SKyle McMartinPALO := $(shell if (which palo 2>&1); then : ; \
1245feb4f39SKyle McMartin	elif [ -x /sbin/palo ]; then echo /sbin/palo; \
1255feb4f39SKyle McMartin	fi)
1265feb4f39SKyle McMartin
12775dd4747SMasahiro YamadaPALOCONF := $(shell if [ -f $(srctree)/palo.conf ]; then echo $(srctree)/palo.conf; \
12875dd4747SMasahiro Yamada	else echo $(objtree)/palo.conf; \
129f67d4033SKyle McMartin	fi)
130f67d4033SKyle McMartin
131b0756b5aSHelge Dellerpalo lifimage: vmlinuz
132f67d4033SKyle McMartin	@if test ! -x "$(PALO)"; then \
1335feb4f39SKyle McMartin		echo 'ERROR: Please install palo first (apt-get install palo)';\
1345feb4f39SKyle McMartin		echo 'or build it from source and install it somewhere in your $$PATH';\
1355feb4f39SKyle McMartin		false; \
1365feb4f39SKyle McMartin	fi
137f67d4033SKyle McMartin	@if test ! -f "$(PALOCONF)"; then \
13875dd4747SMasahiro Yamada		cp $(srctree)/arch/parisc/defpalo.conf $(objtree)/palo.conf; \
13975dd4747SMasahiro Yamada		echo 'A generic palo config file ($(objree)/palo.conf) has been created for you.'; \
1405feb4f39SKyle McMartin		echo 'You should check it and re-run "make palo".'; \
1415feb4f39SKyle McMartin		echo 'WARNING: the "lifimage" file is now placed in this directory by default!'; \
1425feb4f39SKyle McMartin		false; \
1435feb4f39SKyle McMartin	fi
144f67d4033SKyle McMartin	$(PALO) -f $(PALOCONF)
1455feb4f39SKyle McMartin
146b0756b5aSHelge DellerBOOT_TARGETS    = zImage Image palo lifimage
147b0756b5aSHelge DellerINSTALL_TARGETS = zinstall install
148b0756b5aSHelge Deller
149b0756b5aSHelge DellerPHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
150b0756b5aSHelge Deller
15189e050c8SHelge Deller# Default kernel to build
15289e050c8SHelge Dellerall: bzImage
15389e050c8SHelge Deller
154b6adc16eSHelge DellerzImage: vmlinuz
155594174d8SHelge DellerImage: vmlinux
1561da177e4SLinus Torvalds
157b6adc16eSHelge DellerbzImage: vmlinux
158b6adc16eSHelge Deller	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
159b6adc16eSHelge Deller
160af21b01dSHelge Dellerifdef CONFIG_PARISC_SELF_EXTRACT
161b6adc16eSHelge Dellervmlinuz: bzImage
162b6adc16eSHelge Deller	$(OBJCOPY) $(boot)/bzImage $@
163af21b01dSHelge Dellerelse
164af21b01dSHelge Dellervmlinuz: vmlinux
165af21b01dSHelge Deller	@gzip -cf -9 $< > $@
166af21b01dSHelge Dellerendif
167594174d8SHelge Deller
168b0756b5aSHelge Dellerinstall:
16975dd4747SMasahiro Yamada	$(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
170b0756b5aSHelge Deller			$(KERNELRELEASE) vmlinux System.map "$(INSTALL_PATH)"
171b0756b5aSHelge Dellerzinstall:
17275dd4747SMasahiro Yamada	$(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
173b0756b5aSHelge Deller			$(KERNELRELEASE) vmlinuz System.map "$(INSTALL_PATH)"
1741da177e4SLinus Torvalds
1750013a854SSam RavnborgCLEAN_FILES	+= lifimage
1761da177e4SLinus TorvaldsMRPROPER_FILES	+= palo.conf
1771da177e4SLinus Torvalds
1781da177e4SLinus Torvaldsdefine archhelp
1791da177e4SLinus Torvalds	@echo  '* vmlinux	- Uncompressed kernel image (./vmlinux)'
180594174d8SHelge Deller	@echo  '  vmlinuz	- Compressed kernel image (./vmlinuz)'
1815feb4f39SKyle McMartin	@echo  '  palo		- Bootable image (./lifimage)'
182b0756b5aSHelge Deller	@echo  '  install	- Install uncompressed vmlinux kernel using'
183caa27b66SSam Ravnborg	@echo  '		  (your) ~/bin/$(INSTALLKERNEL) or'
184caa27b66SSam Ravnborg	@echo  '		  (distribution) /sbin/$(INSTALLKERNEL) or'
1851da177e4SLinus Torvalds	@echo  '		  copy to $$(INSTALL_PATH)'
186b0756b5aSHelge Deller	@echo  '  zinstall	- Install compressed vmlinuz kernel'
1871da177e4SLinus Torvaldsendef
188575afc4dSFiroz Khan
189f2c5ed0dSJames Bottomleyarchclean:
190f2c5ed0dSJames Bottomley	$(Q)$(MAKE) $(clean)=$(boot)
191f2c5ed0dSJames Bottomley
192575afc4dSFiroz Khanarchheaders:
193575afc4dSFiroz Khan	$(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all
194