xref: /openbmc/linux/arch/parisc/Makefile (revision 14516765)
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
22c04f7ae2SAdrian BunkKBUILD_DEFCONFIG := default_defconfig
23c04f7ae2SAdrian Bunk
241da177e4SLinus TorvaldsNM		= sh $(srctree)/arch/parisc/nm
2514516765SLuc Van OostenryckCHECKFLAGS	+= -D__hppa__=1
264c01acc0SJames BottomleyLIBGCC		= $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
27b6adc16eSHelge Dellerexport LIBGCC
281da177e4SLinus Torvalds
291da177e4SLinus Torvaldsifdef CONFIG_64BIT
301da177e4SLinus TorvaldsUTS_MACHINE	:= parisc64
311da177e4SLinus TorvaldsCHECKFLAGS	+= -D__LP64__=1 -m64
326880b015SHelge DellerCC_ARCHES	= hppa64
33b6adc16eSHelge DellerLD_BFD		:= elf64-hppa-linux
34991b7d6eSKyle McMartinelse # 32-bit
356880b015SHelge DellerCC_ARCHES	= hppa hppa2.0 hppa1.1
36b6adc16eSHelge DellerLD_BFD		:= elf32-hppa-linux
371da177e4SLinus Torvaldsendif
381da177e4SLinus Torvalds
39b6adc16eSHelge Dellerexport LD_BFD
40b6adc16eSHelge Deller
416880b015SHelge Dellerifneq ($(SUBARCH),$(UTS_MACHINE))
420e39718bSHelge Deller	ifeq ($(CROSS_COMPILE),)
436880b015SHelge Deller		CC_SUFFIXES = linux linux-gnu unknown-linux-gnu
446880b015SHelge Deller		CROSS_COMPILE := $(call cc-cross-prefix, \
456880b015SHelge Deller			$(foreach a,$(CC_ARCHES), \
466880b015SHelge Deller			$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
470e39718bSHelge Deller	endif
48991b7d6eSKyle McMartinendif
491da177e4SLinus Torvalds
501da177e4SLinus TorvaldsOBJCOPY_FLAGS =-O binary -R .note -R .comment -S
511da177e4SLinus Torvalds
521da177e4SLinus Torvaldscflags-y	:= -pipe
531da177e4SLinus Torvalds
541da177e4SLinus Torvalds# These flags should be implied by an hppa-linux configuration, but they
551da177e4SLinus Torvalds# are not in gcc 3.2.
56d26a7730SJohn David Anglincflags-y	+= -mno-space-regs
57d26a7730SJohn David Anglin
58d26a7730SJohn David Anglin# -mfast-indirect-calls is only relevant for 32-bit kernels.
59d26a7730SJohn David Anglinifndef CONFIG_64BIT
60d26a7730SJohn David Anglincflags-y	+= -mfast-indirect-calls
61d26a7730SJohn David Anglinendif
621da177e4SLinus Torvalds
631da177e4SLinus Torvalds# Currently we save and restore fpregs on all kernel entry/interruption paths.
641da177e4SLinus Torvalds# If that gets optimized, we might need to disable the use of fpregs in the
651da177e4SLinus Torvalds# kernel.
66fa681a18SRandolph Chungcflags-y	+= -mdisable-fpregs
671da177e4SLinus Torvalds
681da177e4SLinus Torvalds# Without this, "ld -r" results in .text sections that are too big
691da177e4SLinus Torvalds# (> 0x40000) for branches to reach stubs.
701da177e4SLinus Torvaldscflags-y	+= -ffunction-sections
711da177e4SLinus Torvalds
72ec758f98SHelge Deller# Use long jumps instead of long branches (needed if your linker fails to
73cf71130dSHelge Deller# link a too big vmlinux executable). Not enabled for building modules.
74cf71130dSHelge Dellerifdef CONFIG_MLONGCALLS
75cf71130dSHelge DellerKBUILD_CFLAGS_KERNEL += -mlong-calls
76cf71130dSHelge Dellerendif
77ec758f98SHelge Deller
781da177e4SLinus Torvalds# select which processor to optimise for
7976603902SPaul Bollecflags-$(CONFIG_PA7000)		+= -march=1.1 -mschedule=7100
801da177e4SLinus Torvaldscflags-$(CONFIG_PA7200)		+= -march=1.1 -mschedule=7200
811da177e4SLinus Torvaldscflags-$(CONFIG_PA7100LC)	+= -march=1.1 -mschedule=7100LC
821da177e4SLinus Torvaldscflags-$(CONFIG_PA7300LC)	+= -march=1.1 -mschedule=7300
831da177e4SLinus Torvaldscflags-$(CONFIG_PA8X00)		+= -march=2.0 -mschedule=8000
841da177e4SLinus Torvalds
851da177e4SLinus Torvaldshead-y			:= arch/parisc/kernel/head.o
861da177e4SLinus Torvalds
87a0f97e06SSam RavnborgKBUILD_CFLAGS	+= $(cflags-y)
881da177e4SLinus Torvalds
89481f93b6SThomas Gleixnerkernel-y			:= mm/ kernel/ math-emu/
901da177e4SLinus Torvalds
911da177e4SLinus Torvaldscore-y	+= $(addprefix arch/parisc/, $(kernel-y))
924c01acc0SJames Bottomleylibs-y	+= arch/parisc/lib/ $(LIBGCC)
931da177e4SLinus Torvalds
941da177e4SLinus Torvaldsdrivers-$(CONFIG_OPROFILE)		+= arch/parisc/oprofile/
951da177e4SLinus Torvalds
96b6adc16eSHelge Dellerboot	:= arch/parisc/boot
97b6adc16eSHelge Deller
986525ee55SKyle McMartinPALO := $(shell if (which palo 2>&1); then : ; \
995feb4f39SKyle McMartin	elif [ -x /sbin/palo ]; then echo /sbin/palo; \
1005feb4f39SKyle McMartin	fi)
1015feb4f39SKyle McMartin
102f67d4033SKyle McMartinPALOCONF := $(shell if [ -f $(src)/palo.conf ]; then echo $(src)/palo.conf; \
103f67d4033SKyle McMartin	else echo $(obj)/palo.conf; \
104f67d4033SKyle McMartin	fi)
105f67d4033SKyle McMartin
106b0756b5aSHelge Dellerpalo lifimage: vmlinuz
107f67d4033SKyle McMartin	@if test ! -x "$(PALO)"; then \
1085feb4f39SKyle McMartin		echo 'ERROR: Please install palo first (apt-get install palo)';\
1095feb4f39SKyle McMartin		echo 'or build it from source and install it somewhere in your $$PATH';\
1105feb4f39SKyle McMartin		false; \
1115feb4f39SKyle McMartin	fi
112f67d4033SKyle McMartin	@if test ! -f "$(PALOCONF)"; then \
113f67d4033SKyle McMartin		cp $(src)/arch/parisc/defpalo.conf $(obj)/palo.conf; \
114f67d4033SKyle McMartin		echo 'A generic palo config file ($(obj)/palo.conf) has been created for you.'; \
1155feb4f39SKyle McMartin		echo 'You should check it and re-run "make palo".'; \
1165feb4f39SKyle McMartin		echo 'WARNING: the "lifimage" file is now placed in this directory by default!'; \
1175feb4f39SKyle McMartin		false; \
1185feb4f39SKyle McMartin	fi
119f67d4033SKyle McMartin	$(PALO) -f $(PALOCONF)
1205feb4f39SKyle McMartin
121b0756b5aSHelge DellerBOOT_TARGETS    = zImage Image palo lifimage
122b0756b5aSHelge DellerINSTALL_TARGETS = zinstall install
123b0756b5aSHelge Deller
124b0756b5aSHelge DellerPHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
125b0756b5aSHelge Deller
12689e050c8SHelge Deller# Default kernel to build
12789e050c8SHelge Dellerall: bzImage
12889e050c8SHelge Deller
129b6adc16eSHelge DellerzImage: vmlinuz
130594174d8SHelge DellerImage: vmlinux
1311da177e4SLinus Torvalds
132b6adc16eSHelge DellerbzImage: vmlinux
133b6adc16eSHelge Deller	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
134b6adc16eSHelge Deller
135af21b01dSHelge Dellerifdef CONFIG_PARISC_SELF_EXTRACT
136b6adc16eSHelge Dellervmlinuz: bzImage
137b6adc16eSHelge Deller	$(OBJCOPY) $(boot)/bzImage $@
138af21b01dSHelge Dellerelse
139af21b01dSHelge Dellervmlinuz: vmlinux
140af21b01dSHelge Deller	@gzip -cf -9 $< > $@
141af21b01dSHelge Dellerendif
142594174d8SHelge Deller
143b0756b5aSHelge Dellerinstall:
144b0756b5aSHelge Deller	$(CONFIG_SHELL) $(src)/arch/parisc/install.sh \
145b0756b5aSHelge Deller			$(KERNELRELEASE) vmlinux System.map "$(INSTALL_PATH)"
146b0756b5aSHelge Dellerzinstall:
147b0756b5aSHelge Deller	$(CONFIG_SHELL) $(src)/arch/parisc/install.sh \
148b0756b5aSHelge Deller			$(KERNELRELEASE) vmlinuz System.map "$(INSTALL_PATH)"
1491da177e4SLinus Torvalds
1500013a854SSam RavnborgCLEAN_FILES	+= lifimage
1511da177e4SLinus TorvaldsMRPROPER_FILES	+= palo.conf
1521da177e4SLinus Torvalds
1531da177e4SLinus Torvaldsdefine archhelp
1541da177e4SLinus Torvalds	@echo  '* vmlinux	- Uncompressed kernel image (./vmlinux)'
155594174d8SHelge Deller	@echo  '  vmlinuz	- Compressed kernel image (./vmlinuz)'
1565feb4f39SKyle McMartin	@echo  '  palo		- Bootable image (./lifimage)'
157b0756b5aSHelge Deller	@echo  '  install	- Install uncompressed vmlinux kernel using'
158caa27b66SSam Ravnborg	@echo  '		  (your) ~/bin/$(INSTALLKERNEL) or'
159caa27b66SSam Ravnborg	@echo  '		  (distribution) /sbin/$(INSTALLKERNEL) or'
1601da177e4SLinus Torvalds	@echo  '		  copy to $$(INSTALL_PATH)'
161b0756b5aSHelge Deller	@echo  '  zinstall	- Install compressed vmlinuz kernel'
1621da177e4SLinus Torvaldsendef
163991b7d6eSKyle McMartin
164991b7d6eSKyle McMartin# we require gcc 3.3 or above to compile the kernel
165991b7d6eSKyle McMartinarchprepare: checkbin
166991b7d6eSKyle McMartincheckbin:
167665d92e3SMasahiro Yamada	@if test "$(cc-version)" -lt "0303"; then \
168991b7d6eSKyle McMartin		echo -n "Sorry, GCC v3.3 or above is required to build " ; \
169991b7d6eSKyle McMartin		echo "the kernel." ; \
170991b7d6eSKyle McMartin		false ; \
171991b7d6eSKyle McMartin	fi
172