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 Dellerboot := arch/parisc/boot 191d7c29b7SHelge DellerKBUILD_IMAGE := $(boot)/bzImage 20594174d8SHelge Deller 2114516765SLuc Van OostenryckCHECKFLAGS += -D__hppa__=1 221da177e4SLinus Torvalds 231da177e4SLinus Torvaldsifdef CONFIG_64BIT 241da177e4SLinus TorvaldsUTS_MACHINE := parisc64 251f2f01b1SLuc Van OostenryckCHECKFLAGS += -D__LP64__=1 26b6adc16eSHelge DellerLD_BFD := elf64-hppa-linux 27991b7d6eSKyle McMartinelse # 32-bit 28b6adc16eSHelge DellerLD_BFD := elf32-hppa-linux 291da177e4SLinus Torvaldsendif 301da177e4SLinus Torvalds 31ededa081SHelge Deller# select defconfig based on actual architecture 325f6e0fe0SMasahiro Yamadaifeq ($(ARCH),parisc64) 33ededa081SHelge Deller KBUILD_DEFCONFIG := generic-64bit_defconfig 345f6e0fe0SMasahiro Yamada CC_ARCHES := hppa64 35ededa081SHelge Dellerelse 36ededa081SHelge Deller KBUILD_DEFCONFIG := generic-32bit_defconfig 375f6e0fe0SMasahiro Yamada CC_ARCHES := hppa hppa2.0 hppa1.1 38ededa081SHelge Dellerendif 39ededa081SHelge Deller 40b6adc16eSHelge Dellerexport LD_BFD 41b6adc16eSHelge Deller 42df24e178SHelge Deller# Set default 32 bits cross compilers for vdso 43df24e178SHelge DellerCC_ARCHES_32 = hppa hppa2.0 hppa1.1 44ed979481SHelge DellerCC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux 45df24e178SHelge DellerCROSS32_COMPILE := $(call cc-cross-prefix, \ 46df24e178SHelge Deller $(foreach a,$(CC_ARCHES_32), \ 47df24e178SHelge Deller $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-))) 48df24e178SHelge DellerCROSS32CC := $(CROSS32_COMPILE)gcc 49df24e178SHelge Dellerexport CROSS32CC 50df24e178SHelge Deller 51df24e178SHelge Deller# Set default cross compiler for kernel build 5223243c1aSMasahiro Yamadaifdef cross_compiling 530e39718bSHelge Deller ifeq ($(CROSS_COMPILE),) 54ed979481SHelge Deller CC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux 556880b015SHelge Deller CROSS_COMPILE := $(call cc-cross-prefix, \ 566880b015SHelge Deller $(foreach a,$(CC_ARCHES), \ 576880b015SHelge Deller $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-))) 580e39718bSHelge Deller endif 59991b7d6eSKyle McMartinendif 601da177e4SLinus Torvalds 616ca63662SSven Schnelleifdef CONFIG_DYNAMIC_FTRACE 626ca63662SSven Schnelleifdef CONFIG_64BIT 636ca63662SSven SchnelleNOP_COUNT := 8 646ca63662SSven Schnelleelse 656ca63662SSven SchnelleNOP_COUNT := 5 666ca63662SSven Schnelleendif 676ca63662SSven Schnelle 686ca63662SSven Schnelleexport CC_USING_RECORD_MCOUNT:=1 696ca63662SSven Schnelleexport CC_USING_PATCHABLE_FUNCTION_ENTRY:=1 706ca63662SSven Schnelle 716ca63662SSven SchnelleKBUILD_AFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 726ca63662SSven SchnelleKBUILD_CFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 \ 736ca63662SSven Schnelle -DFTRACE_PATCHABLE_FUNCTION_SIZE=$(NOP_COUNT) 746ca63662SSven Schnelle 756ca63662SSven SchnelleCC_FLAGS_FTRACE := -fpatchable-function-entry=$(NOP_COUNT),$(shell echo $$(($(NOP_COUNT)-1))) 766ca63662SSven Schnelleendif 776ca63662SSven Schnelle 781da177e4SLinus TorvaldsOBJCOPY_FLAGS =-O binary -R .note -R .comment -S 791da177e4SLinus Torvalds 801da177e4SLinus Torvaldscflags-y := -pipe 811da177e4SLinus Torvalds 821da177e4SLinus Torvalds# These flags should be implied by an hppa-linux configuration, but they 831da177e4SLinus Torvalds# are not in gcc 3.2. 84d26a7730SJohn David Anglincflags-y += -mno-space-regs 85d26a7730SJohn David Anglin 86d26a7730SJohn David Anglin# -mfast-indirect-calls is only relevant for 32-bit kernels. 87d26a7730SJohn David Anglinifndef CONFIG_64BIT 88d26a7730SJohn David Anglincflags-y += -mfast-indirect-calls 89d26a7730SJohn David Anglinendif 901da177e4SLinus Torvalds 911da177e4SLinus Torvalds# Currently we save and restore fpregs on all kernel entry/interruption paths. 921da177e4SLinus Torvalds# If that gets optimized, we might need to disable the use of fpregs in the 931da177e4SLinus Torvalds# kernel. 94fa681a18SRandolph Chungcflags-y += -mdisable-fpregs 951da177e4SLinus Torvalds 96ec758f98SHelge Deller# Use long jumps instead of long branches (needed if your linker fails to 97cf71130dSHelge Deller# link a too big vmlinux executable). Not enabled for building modules. 98cf71130dSHelge Dellerifdef CONFIG_MLONGCALLS 99cf71130dSHelge DellerKBUILD_CFLAGS_KERNEL += -mlong-calls 100cf71130dSHelge Dellerendif 101ec758f98SHelge Deller 1021e8249b8SHelge Deller# Without this, "ld -r" results in .text sections that are too big (> 0x40000) 1031e8249b8SHelge Deller# for branches to reach stubs. And multiple .text sections trigger a warning 1041e8249b8SHelge Deller# when creating the sysfs module information section. 1051e8249b8SHelge Dellerifndef CONFIG_64BIT 1061e8249b8SHelge DellerKBUILD_CFLAGS_MODULE += -ffunction-sections 1071e8249b8SHelge Dellerendif 1081e8249b8SHelge Deller 1091da177e4SLinus Torvalds# select which processor to optimise for 11076603902SPaul Bollecflags-$(CONFIG_PA7000) += -march=1.1 -mschedule=7100 1111da177e4SLinus Torvaldscflags-$(CONFIG_PA7200) += -march=1.1 -mschedule=7200 1121da177e4SLinus Torvaldscflags-$(CONFIG_PA7100LC) += -march=1.1 -mschedule=7100LC 1131da177e4SLinus Torvaldscflags-$(CONFIG_PA7300LC) += -march=1.1 -mschedule=7300 1141da177e4SLinus Torvaldscflags-$(CONFIG_PA8X00) += -march=2.0 -mschedule=8000 1151da177e4SLinus Torvalds 116a0f97e06SSam RavnborgKBUILD_CFLAGS += $(cflags-y) 1170d341e0dSHelge DellerLIBGCC := $(shell $(CC) -print-libgcc-file-name) 1180d341e0dSHelge Dellerexport LIBGCC 1191da177e4SLinus Torvalds 1204c01acc0SJames Bottomleylibs-y += arch/parisc/lib/ $(LIBGCC) 1211da177e4SLinus Torvalds 122cf41d18bSThomas Zimmermanndrivers-y += arch/parisc/video/ 123cf41d18bSThomas Zimmermann 124b6adc16eSHelge Dellerboot := arch/parisc/boot 125b6adc16eSHelge Deller 1266525ee55SKyle McMartinPALO := $(shell if (which palo 2>&1); then : ; \ 1275feb4f39SKyle McMartin elif [ -x /sbin/palo ]; then echo /sbin/palo; \ 1285feb4f39SKyle McMartin fi) 1295feb4f39SKyle McMartin 13075dd4747SMasahiro YamadaPALOCONF := $(shell if [ -f $(srctree)/palo.conf ]; then echo $(srctree)/palo.conf; \ 13175dd4747SMasahiro Yamada else echo $(objtree)/palo.conf; \ 132f67d4033SKyle McMartin fi) 133f67d4033SKyle McMartin 134b0756b5aSHelge Dellerpalo lifimage: vmlinuz 135f67d4033SKyle McMartin @if test ! -x "$(PALO)"; then \ 1365feb4f39SKyle McMartin echo 'ERROR: Please install palo first (apt-get install palo)';\ 1375feb4f39SKyle McMartin echo 'or build it from source and install it somewhere in your $$PATH';\ 1385feb4f39SKyle McMartin false; \ 1395feb4f39SKyle McMartin fi 140f67d4033SKyle McMartin @if test ! -f "$(PALOCONF)"; then \ 14175dd4747SMasahiro Yamada cp $(srctree)/arch/parisc/defpalo.conf $(objtree)/palo.conf; \ 14275dd4747SMasahiro Yamada echo 'A generic palo config file ($(objree)/palo.conf) has been created for you.'; \ 1435feb4f39SKyle McMartin echo 'You should check it and re-run "make palo".'; \ 1445feb4f39SKyle McMartin echo 'WARNING: the "lifimage" file is now placed in this directory by default!'; \ 1455feb4f39SKyle McMartin false; \ 1465feb4f39SKyle McMartin fi 147f67d4033SKyle McMartin $(PALO) -f $(PALOCONF) 1485feb4f39SKyle McMartin 149b0756b5aSHelge DellerBOOT_TARGETS = zImage Image palo lifimage 150b0756b5aSHelge DellerINSTALL_TARGETS = zinstall install 151b0756b5aSHelge Deller 152b0756b5aSHelge DellerPHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS) 153b0756b5aSHelge Deller 15489e050c8SHelge Deller# Default kernel to build 15589e050c8SHelge Dellerall: bzImage 15689e050c8SHelge Deller 157b6adc16eSHelge DellerzImage: vmlinuz 158594174d8SHelge DellerImage: vmlinux 1591da177e4SLinus Torvalds 160b6adc16eSHelge DellerbzImage: vmlinux 161b6adc16eSHelge Deller $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 162b6adc16eSHelge Deller 163b6adc16eSHelge Dellervmlinuz: bzImage 164b6adc16eSHelge Deller $(OBJCOPY) $(boot)/bzImage $@ 165594174d8SHelge Deller 166df24e178SHelge Dellerifeq ($(KBUILD_EXTMOD),) 167df24e178SHelge Deller# We need to generate vdso-offsets.h before compiling certain files in kernel/. 168df24e178SHelge Deller# In order to do that, we should use the archprepare target, but we can't since 169df24e178SHelge Deller# asm-offsets.h is included in some files used to generate vdso-offsets.h, and 170df24e178SHelge Deller# asm-offsets.h is built in prepare0, for which archprepare is a dependency. 171df24e178SHelge Deller# Therefore we need to generate the header after prepare0 has been made, hence 172df24e178SHelge Deller# this hack. 173df24e178SHelge Dellerprepare: vdso_prepare 174df24e178SHelge Dellervdso_prepare: prepare0 175df24e178SHelge Deller $(if $(CONFIG_64BIT),$(Q)$(MAKE) \ 176df24e178SHelge Deller $(build)=arch/parisc/kernel/vdso64 include/generated/vdso64-offsets.h) 177df24e178SHelge Deller $(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 include/generated/vdso32-offsets.h 178df24e178SHelge Dellerendif 179df24e178SHelge Deller 180*adacfc6dSMasahiro Yamadavdso-install-y += arch/parisc/kernel/vdso32/vdso32.so 181*adacfc6dSMasahiro Yamadavdso-install-$(CONFIG_64BIT) += arch/parisc/kernel/vdso64/vdso64.so 182f774f5bbSMasahiro Yamada 183f774f5bbSMasahiro Yamadainstall: KBUILD_IMAGE := vmlinux 184f774f5bbSMasahiro Yamadazinstall: KBUILD_IMAGE := vmlinuz 185f774f5bbSMasahiro Yamadainstall zinstall: 186f774f5bbSMasahiro Yamada $(call cmd,install) 1871da177e4SLinus Torvalds 1880013a854SSam RavnborgCLEAN_FILES += lifimage 1891da177e4SLinus TorvaldsMRPROPER_FILES += palo.conf 1901da177e4SLinus Torvalds 1911da177e4SLinus Torvaldsdefine archhelp 1921da177e4SLinus Torvalds @echo '* vmlinux - Uncompressed kernel image (./vmlinux)' 193594174d8SHelge Deller @echo ' vmlinuz - Compressed kernel image (./vmlinuz)' 1945feb4f39SKyle McMartin @echo ' palo - Bootable image (./lifimage)' 195b0756b5aSHelge Deller @echo ' install - Install uncompressed vmlinux kernel using' 196caa27b66SSam Ravnborg @echo ' (your) ~/bin/$(INSTALLKERNEL) or' 197caa27b66SSam Ravnborg @echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 1981da177e4SLinus Torvalds @echo ' copy to $$(INSTALL_PATH)' 199b0756b5aSHelge Deller @echo ' zinstall - Install compressed vmlinuz kernel' 2001da177e4SLinus Torvaldsendef 201575afc4dSFiroz Khan 202575afc4dSFiroz Khanarchheaders: 203575afc4dSFiroz Khan $(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all 204