xref: /openbmc/linux/arch/parisc/Makefile (revision 5f6e0fe0)
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
241da177e4SLinus Torvalds
251da177e4SLinus Torvaldsifdef CONFIG_64BIT
261da177e4SLinus TorvaldsUTS_MACHINE	:= parisc64
271f2f01b1SLuc Van OostenryckCHECKFLAGS	+= -D__LP64__=1
28b6adc16eSHelge DellerLD_BFD		:= elf64-hppa-linux
29991b7d6eSKyle McMartinelse # 32-bit
30b6adc16eSHelge DellerLD_BFD		:= elf32-hppa-linux
311da177e4SLinus Torvaldsendif
321da177e4SLinus Torvalds
33ededa081SHelge Deller# select defconfig based on actual architecture
34*5f6e0fe0SMasahiro Yamadaifeq ($(ARCH),parisc64)
35ededa081SHelge Deller	KBUILD_DEFCONFIG := generic-64bit_defconfig
36*5f6e0fe0SMasahiro Yamada	CC_ARCHES := hppa64
37ededa081SHelge Dellerelse
38ededa081SHelge Deller	KBUILD_DEFCONFIG := generic-32bit_defconfig
39*5f6e0fe0SMasahiro Yamada	CC_ARCHES := hppa hppa2.0 hppa1.1
40ededa081SHelge Dellerendif
41ededa081SHelge Deller
42b6adc16eSHelge Dellerexport LD_BFD
43b6adc16eSHelge Deller
4423243c1aSMasahiro Yamadaifdef cross_compiling
450e39718bSHelge Deller	ifeq ($(CROSS_COMPILE),)
466880b015SHelge Deller		CC_SUFFIXES = linux linux-gnu unknown-linux-gnu
476880b015SHelge Deller		CROSS_COMPILE := $(call cc-cross-prefix, \
486880b015SHelge Deller			$(foreach a,$(CC_ARCHES), \
496880b015SHelge Deller			$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
500e39718bSHelge Deller	endif
51991b7d6eSKyle McMartinendif
521da177e4SLinus Torvalds
536ca63662SSven Schnelleifdef CONFIG_DYNAMIC_FTRACE
546ca63662SSven Schnelleifdef CONFIG_64BIT
556ca63662SSven SchnelleNOP_COUNT := 8
566ca63662SSven Schnelleelse
576ca63662SSven SchnelleNOP_COUNT := 5
586ca63662SSven Schnelleendif
596ca63662SSven Schnelle
606ca63662SSven Schnelleexport CC_USING_RECORD_MCOUNT:=1
616ca63662SSven Schnelleexport CC_USING_PATCHABLE_FUNCTION_ENTRY:=1
626ca63662SSven Schnelle
636ca63662SSven SchnelleKBUILD_AFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1
646ca63662SSven SchnelleKBUILD_CFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 \
656ca63662SSven Schnelle		 -DFTRACE_PATCHABLE_FUNCTION_SIZE=$(NOP_COUNT)
666ca63662SSven Schnelle
676ca63662SSven SchnelleCC_FLAGS_FTRACE := -fpatchable-function-entry=$(NOP_COUNT),$(shell echo $$(($(NOP_COUNT)-1)))
686ca63662SSven Schnelleendif
696ca63662SSven Schnelle
701da177e4SLinus TorvaldsOBJCOPY_FLAGS =-O binary -R .note -R .comment -S
711da177e4SLinus Torvalds
721da177e4SLinus Torvaldscflags-y	:= -pipe
731da177e4SLinus Torvalds
741da177e4SLinus Torvalds# These flags should be implied by an hppa-linux configuration, but they
751da177e4SLinus Torvalds# are not in gcc 3.2.
76d26a7730SJohn David Anglincflags-y	+= -mno-space-regs
77d26a7730SJohn David Anglin
78d26a7730SJohn David Anglin# -mfast-indirect-calls is only relevant for 32-bit kernels.
79d26a7730SJohn David Anglinifndef CONFIG_64BIT
80d26a7730SJohn David Anglincflags-y	+= -mfast-indirect-calls
81d26a7730SJohn David Anglinendif
821da177e4SLinus Torvalds
831da177e4SLinus Torvalds# Currently we save and restore fpregs on all kernel entry/interruption paths.
841da177e4SLinus Torvalds# If that gets optimized, we might need to disable the use of fpregs in the
851da177e4SLinus Torvalds# kernel.
86fa681a18SRandolph Chungcflags-y	+= -mdisable-fpregs
871da177e4SLinus Torvalds
88ec758f98SHelge Deller# Use long jumps instead of long branches (needed if your linker fails to
89cf71130dSHelge Deller# link a too big vmlinux executable). Not enabled for building modules.
90cf71130dSHelge Dellerifdef CONFIG_MLONGCALLS
91cf71130dSHelge DellerKBUILD_CFLAGS_KERNEL += -mlong-calls
92cf71130dSHelge Dellerendif
93ec758f98SHelge Deller
941e8249b8SHelge Deller# Without this, "ld -r" results in .text sections that are too big (> 0x40000)
951e8249b8SHelge Deller# for branches to reach stubs. And multiple .text sections trigger a warning
961e8249b8SHelge Deller# when creating the sysfs module information section.
971e8249b8SHelge Dellerifndef CONFIG_64BIT
981e8249b8SHelge DellerKBUILD_CFLAGS_MODULE += -ffunction-sections
991e8249b8SHelge Dellerendif
1001e8249b8SHelge Deller
1011da177e4SLinus Torvalds# select which processor to optimise for
10276603902SPaul Bollecflags-$(CONFIG_PA7000)		+= -march=1.1 -mschedule=7100
1031da177e4SLinus Torvaldscflags-$(CONFIG_PA7200)		+= -march=1.1 -mschedule=7200
1041da177e4SLinus Torvaldscflags-$(CONFIG_PA7100LC)	+= -march=1.1 -mschedule=7100LC
1051da177e4SLinus Torvaldscflags-$(CONFIG_PA7300LC)	+= -march=1.1 -mschedule=7300
1061da177e4SLinus Torvaldscflags-$(CONFIG_PA8X00)		+= -march=2.0 -mschedule=8000
1071da177e4SLinus Torvalds
1081da177e4SLinus Torvaldshead-y			:= arch/parisc/kernel/head.o
1091da177e4SLinus Torvalds
110a0f97e06SSam RavnborgKBUILD_CFLAGS	+= $(cflags-y)
1110d341e0dSHelge DellerLIBGCC		:= $(shell $(CC) -print-libgcc-file-name)
1120d341e0dSHelge Dellerexport LIBGCC
1131da177e4SLinus Torvalds
1144c01acc0SJames Bottomleylibs-y	+= arch/parisc/lib/ $(LIBGCC)
1151da177e4SLinus Torvalds
116b6adc16eSHelge Dellerboot	:= arch/parisc/boot
117b6adc16eSHelge Deller
1186525ee55SKyle McMartinPALO := $(shell if (which palo 2>&1); then : ; \
1195feb4f39SKyle McMartin	elif [ -x /sbin/palo ]; then echo /sbin/palo; \
1205feb4f39SKyle McMartin	fi)
1215feb4f39SKyle McMartin
12275dd4747SMasahiro YamadaPALOCONF := $(shell if [ -f $(srctree)/palo.conf ]; then echo $(srctree)/palo.conf; \
12375dd4747SMasahiro Yamada	else echo $(objtree)/palo.conf; \
124f67d4033SKyle McMartin	fi)
125f67d4033SKyle McMartin
126b0756b5aSHelge Dellerpalo lifimage: vmlinuz
127f67d4033SKyle McMartin	@if test ! -x "$(PALO)"; then \
1285feb4f39SKyle McMartin		echo 'ERROR: Please install palo first (apt-get install palo)';\
1295feb4f39SKyle McMartin		echo 'or build it from source and install it somewhere in your $$PATH';\
1305feb4f39SKyle McMartin		false; \
1315feb4f39SKyle McMartin	fi
132f67d4033SKyle McMartin	@if test ! -f "$(PALOCONF)"; then \
13375dd4747SMasahiro Yamada		cp $(srctree)/arch/parisc/defpalo.conf $(objtree)/palo.conf; \
13475dd4747SMasahiro Yamada		echo 'A generic palo config file ($(objree)/palo.conf) has been created for you.'; \
1355feb4f39SKyle McMartin		echo 'You should check it and re-run "make palo".'; \
1365feb4f39SKyle McMartin		echo 'WARNING: the "lifimage" file is now placed in this directory by default!'; \
1375feb4f39SKyle McMartin		false; \
1385feb4f39SKyle McMartin	fi
139f67d4033SKyle McMartin	$(PALO) -f $(PALOCONF)
1405feb4f39SKyle McMartin
141b0756b5aSHelge DellerBOOT_TARGETS    = zImage Image palo lifimage
142b0756b5aSHelge DellerINSTALL_TARGETS = zinstall install
143b0756b5aSHelge Deller
144b0756b5aSHelge DellerPHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
145b0756b5aSHelge Deller
14689e050c8SHelge Deller# Default kernel to build
14789e050c8SHelge Dellerall: bzImage
14889e050c8SHelge Deller
149b6adc16eSHelge DellerzImage: vmlinuz
150594174d8SHelge DellerImage: vmlinux
1511da177e4SLinus Torvalds
152b6adc16eSHelge DellerbzImage: vmlinux
153b6adc16eSHelge Deller	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
154b6adc16eSHelge Deller
155af21b01dSHelge Dellerifdef CONFIG_PARISC_SELF_EXTRACT
156b6adc16eSHelge Dellervmlinuz: bzImage
157b6adc16eSHelge Deller	$(OBJCOPY) $(boot)/bzImage $@
158af21b01dSHelge Dellerelse
159af21b01dSHelge Dellervmlinuz: vmlinux
160e4a42c82SDenis Efremov	@$(KGZIP) -cf -9 $< > $@
161af21b01dSHelge Dellerendif
162594174d8SHelge Deller
163b0756b5aSHelge Dellerinstall:
16475dd4747SMasahiro Yamada	$(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
165b0756b5aSHelge Deller			$(KERNELRELEASE) vmlinux System.map "$(INSTALL_PATH)"
166b0756b5aSHelge Dellerzinstall:
16775dd4747SMasahiro Yamada	$(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
168b0756b5aSHelge Deller			$(KERNELRELEASE) vmlinuz System.map "$(INSTALL_PATH)"
1691da177e4SLinus Torvalds
1700013a854SSam RavnborgCLEAN_FILES	+= lifimage
1711da177e4SLinus TorvaldsMRPROPER_FILES	+= palo.conf
1721da177e4SLinus Torvalds
1731da177e4SLinus Torvaldsdefine archhelp
1741da177e4SLinus Torvalds	@echo  '* vmlinux	- Uncompressed kernel image (./vmlinux)'
175594174d8SHelge Deller	@echo  '  vmlinuz	- Compressed kernel image (./vmlinuz)'
1765feb4f39SKyle McMartin	@echo  '  palo		- Bootable image (./lifimage)'
177b0756b5aSHelge Deller	@echo  '  install	- Install uncompressed vmlinux kernel using'
178caa27b66SSam Ravnborg	@echo  '		  (your) ~/bin/$(INSTALLKERNEL) or'
179caa27b66SSam Ravnborg	@echo  '		  (distribution) /sbin/$(INSTALLKERNEL) or'
1801da177e4SLinus Torvalds	@echo  '		  copy to $$(INSTALL_PATH)'
181b0756b5aSHelge Deller	@echo  '  zinstall	- Install compressed vmlinuz kernel'
1821da177e4SLinus Torvaldsendef
183575afc4dSFiroz Khan
184f2c5ed0dSJames Bottomleyarchclean:
185f2c5ed0dSJames Bottomley	$(Q)$(MAKE) $(clean)=$(boot)
186f2c5ed0dSJames Bottomley
187575afc4dSFiroz Khanarchheaders:
188575afc4dSFiroz Khan	$(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all
189