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 42*305ab0a7SRandy Dunlap# Set default 32 bits cross compilers for vdso. 43*305ab0a7SRandy Dunlap# This means that for 64BIT, both the 64-bit tools and the 32-bit tools 44*305ab0a7SRandy Dunlap# need to be in the path. 45df24e178SHelge DellerCC_ARCHES_32 = hppa hppa2.0 hppa1.1 46ed979481SHelge DellerCC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux 47df24e178SHelge DellerCROSS32_COMPILE := $(call cc-cross-prefix, \ 48df24e178SHelge Deller $(foreach a,$(CC_ARCHES_32), \ 49df24e178SHelge Deller $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-))) 50df24e178SHelge DellerCROSS32CC := $(CROSS32_COMPILE)gcc 51df24e178SHelge Dellerexport CROSS32CC 52df24e178SHelge Deller 53df24e178SHelge Deller# Set default cross compiler for kernel build 5423243c1aSMasahiro Yamadaifdef cross_compiling 550e39718bSHelge Deller ifeq ($(CROSS_COMPILE),) 56ed979481SHelge Deller CC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux 576880b015SHelge Deller CROSS_COMPILE := $(call cc-cross-prefix, \ 586880b015SHelge Deller $(foreach a,$(CC_ARCHES), \ 596880b015SHelge Deller $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-))) 600e39718bSHelge Deller endif 61991b7d6eSKyle McMartinendif 621da177e4SLinus Torvalds 636ca63662SSven Schnelleifdef CONFIG_DYNAMIC_FTRACE 646ca63662SSven Schnelleifdef CONFIG_64BIT 656ca63662SSven SchnelleNOP_COUNT := 8 666ca63662SSven Schnelleelse 676ca63662SSven SchnelleNOP_COUNT := 5 686ca63662SSven Schnelleendif 696ca63662SSven Schnelle 706ca63662SSven Schnelleexport CC_USING_RECORD_MCOUNT:=1 716ca63662SSven Schnelleexport CC_USING_PATCHABLE_FUNCTION_ENTRY:=1 726ca63662SSven Schnelle 736ca63662SSven SchnelleKBUILD_AFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 746ca63662SSven SchnelleKBUILD_CFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 \ 756ca63662SSven Schnelle -DFTRACE_PATCHABLE_FUNCTION_SIZE=$(NOP_COUNT) 766ca63662SSven Schnelle 776ca63662SSven SchnelleCC_FLAGS_FTRACE := -fpatchable-function-entry=$(NOP_COUNT),$(shell echo $$(($(NOP_COUNT)-1))) 786ca63662SSven Schnelleendif 796ca63662SSven Schnelle 801da177e4SLinus TorvaldsOBJCOPY_FLAGS =-O binary -R .note -R .comment -S 811da177e4SLinus Torvalds 821da177e4SLinus Torvaldscflags-y := -pipe 831da177e4SLinus Torvalds 841da177e4SLinus Torvalds# These flags should be implied by an hppa-linux configuration, but they 851da177e4SLinus Torvalds# are not in gcc 3.2. 86d26a7730SJohn David Anglincflags-y += -mno-space-regs 87d26a7730SJohn David Anglin 88d26a7730SJohn David Anglin# -mfast-indirect-calls is only relevant for 32-bit kernels. 89d26a7730SJohn David Anglinifndef CONFIG_64BIT 90d26a7730SJohn David Anglincflags-y += -mfast-indirect-calls 91d26a7730SJohn David Anglinendif 921da177e4SLinus Torvalds 931da177e4SLinus Torvalds# Currently we save and restore fpregs on all kernel entry/interruption paths. 941da177e4SLinus Torvalds# If that gets optimized, we might need to disable the use of fpregs in the 951da177e4SLinus Torvalds# kernel. 96fa681a18SRandolph Chungcflags-y += -mdisable-fpregs 971da177e4SLinus Torvalds 98ec758f98SHelge Deller# Use long jumps instead of long branches (needed if your linker fails to 99cf71130dSHelge Deller# link a too big vmlinux executable). Not enabled for building modules. 100cf71130dSHelge Dellerifdef CONFIG_MLONGCALLS 101cf71130dSHelge DellerKBUILD_CFLAGS_KERNEL += -mlong-calls 102cf71130dSHelge Dellerendif 103ec758f98SHelge Deller 1041e8249b8SHelge Deller# Without this, "ld -r" results in .text sections that are too big (> 0x40000) 1051e8249b8SHelge Deller# for branches to reach stubs. And multiple .text sections trigger a warning 1061e8249b8SHelge Deller# when creating the sysfs module information section. 1071e8249b8SHelge Dellerifndef CONFIG_64BIT 1081e8249b8SHelge DellerKBUILD_CFLAGS_MODULE += -ffunction-sections 1091e8249b8SHelge Dellerendif 1101e8249b8SHelge Deller 1111da177e4SLinus Torvalds# select which processor to optimise for 11276603902SPaul Bollecflags-$(CONFIG_PA7000) += -march=1.1 -mschedule=7100 1131da177e4SLinus Torvaldscflags-$(CONFIG_PA7200) += -march=1.1 -mschedule=7200 1141da177e4SLinus Torvaldscflags-$(CONFIG_PA7100LC) += -march=1.1 -mschedule=7100LC 1151da177e4SLinus Torvaldscflags-$(CONFIG_PA7300LC) += -march=1.1 -mschedule=7300 1161da177e4SLinus Torvaldscflags-$(CONFIG_PA8X00) += -march=2.0 -mschedule=8000 1171da177e4SLinus Torvalds 118a0f97e06SSam RavnborgKBUILD_CFLAGS += $(cflags-y) 1190d341e0dSHelge DellerLIBGCC := $(shell $(CC) -print-libgcc-file-name) 1200d341e0dSHelge Dellerexport LIBGCC 1211da177e4SLinus Torvalds 1224c01acc0SJames Bottomleylibs-y += arch/parisc/lib/ $(LIBGCC) 1231da177e4SLinus Torvalds 124f25eae2cSThomas Zimmermanndrivers-$(CONFIG_VIDEO) += arch/parisc/video/ 125cf41d18bSThomas Zimmermann 126b6adc16eSHelge Dellerboot := arch/parisc/boot 127b6adc16eSHelge Deller 1286525ee55SKyle McMartinPALO := $(shell if (which palo 2>&1); then : ; \ 1295feb4f39SKyle McMartin elif [ -x /sbin/palo ]; then echo /sbin/palo; \ 1305feb4f39SKyle McMartin fi) 1315feb4f39SKyle McMartin 13275dd4747SMasahiro YamadaPALOCONF := $(shell if [ -f $(srctree)/palo.conf ]; then echo $(srctree)/palo.conf; \ 13375dd4747SMasahiro Yamada else echo $(objtree)/palo.conf; \ 134f67d4033SKyle McMartin fi) 135f67d4033SKyle McMartin 136b0756b5aSHelge Dellerpalo lifimage: vmlinuz 137f67d4033SKyle McMartin @if test ! -x "$(PALO)"; then \ 1385feb4f39SKyle McMartin echo 'ERROR: Please install palo first (apt-get install palo)';\ 1395feb4f39SKyle McMartin echo 'or build it from source and install it somewhere in your $$PATH';\ 1405feb4f39SKyle McMartin false; \ 1415feb4f39SKyle McMartin fi 142f67d4033SKyle McMartin @if test ! -f "$(PALOCONF)"; then \ 14375dd4747SMasahiro Yamada cp $(srctree)/arch/parisc/defpalo.conf $(objtree)/palo.conf; \ 144963f1b20SRandy Dunlap echo 'A generic palo config file ($(objtree)/palo.conf) has been created for you.'; \ 1455feb4f39SKyle McMartin echo 'You should check it and re-run "make palo".'; \ 1465feb4f39SKyle McMartin echo 'WARNING: the "lifimage" file is now placed in this directory by default!'; \ 1475feb4f39SKyle McMartin false; \ 1485feb4f39SKyle McMartin fi 149f67d4033SKyle McMartin $(PALO) -f $(PALOCONF) 1505feb4f39SKyle McMartin 151b0756b5aSHelge DellerBOOT_TARGETS = zImage Image palo lifimage 152b0756b5aSHelge DellerINSTALL_TARGETS = zinstall install 153b0756b5aSHelge Deller 154b0756b5aSHelge DellerPHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS) 155b0756b5aSHelge Deller 15689e050c8SHelge Deller# Default kernel to build 15789e050c8SHelge Dellerall: bzImage 15889e050c8SHelge Deller 159b6adc16eSHelge DellerzImage: vmlinuz 160594174d8SHelge DellerImage: vmlinux 1611da177e4SLinus Torvalds 162b6adc16eSHelge DellerbzImage: vmlinux 163b6adc16eSHelge Deller $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 164b6adc16eSHelge Deller 165b6adc16eSHelge Dellervmlinuz: bzImage 166b6adc16eSHelge Deller $(OBJCOPY) $(boot)/bzImage $@ 167594174d8SHelge Deller 168df24e178SHelge Dellerifeq ($(KBUILD_EXTMOD),) 169df24e178SHelge Deller# We need to generate vdso-offsets.h before compiling certain files in kernel/. 170df24e178SHelge Deller# In order to do that, we should use the archprepare target, but we can't since 171df24e178SHelge Deller# asm-offsets.h is included in some files used to generate vdso-offsets.h, and 172df24e178SHelge Deller# asm-offsets.h is built in prepare0, for which archprepare is a dependency. 173df24e178SHelge Deller# Therefore we need to generate the header after prepare0 has been made, hence 174df24e178SHelge Deller# this hack. 175df24e178SHelge Dellerprepare: vdso_prepare 176df24e178SHelge Dellervdso_prepare: prepare0 177df24e178SHelge Deller $(if $(CONFIG_64BIT),$(Q)$(MAKE) \ 178df24e178SHelge Deller $(build)=arch/parisc/kernel/vdso64 include/generated/vdso64-offsets.h) 179df24e178SHelge Deller $(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 include/generated/vdso32-offsets.h 180df24e178SHelge Dellerendif 181df24e178SHelge Deller 18256769ba4SMasahiro Yamadavdso-install-y += arch/parisc/kernel/vdso32/vdso32.so 18356769ba4SMasahiro Yamadavdso-install-$(CONFIG_64BIT) += arch/parisc/kernel/vdso64/vdso64.so 184f774f5bbSMasahiro Yamada 185f774f5bbSMasahiro Yamadainstall: KBUILD_IMAGE := vmlinux 186f774f5bbSMasahiro Yamadazinstall: KBUILD_IMAGE := vmlinuz 187f774f5bbSMasahiro Yamadainstall zinstall: 188f774f5bbSMasahiro Yamada $(call cmd,install) 1891da177e4SLinus Torvalds 1900013a854SSam RavnborgCLEAN_FILES += lifimage 1911da177e4SLinus TorvaldsMRPROPER_FILES += palo.conf 1921da177e4SLinus Torvalds 1931da177e4SLinus Torvaldsdefine archhelp 1941da177e4SLinus Torvalds @echo '* vmlinux - Uncompressed kernel image (./vmlinux)' 195594174d8SHelge Deller @echo ' vmlinuz - Compressed kernel image (./vmlinuz)' 1965feb4f39SKyle McMartin @echo ' palo - Bootable image (./lifimage)' 197b0756b5aSHelge Deller @echo ' install - Install uncompressed vmlinux kernel using' 198caa27b66SSam Ravnborg @echo ' (your) ~/bin/$(INSTALLKERNEL) or' 199caa27b66SSam Ravnborg @echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 2001da177e4SLinus Torvalds @echo ' copy to $$(INSTALL_PATH)' 201b0756b5aSHelge Deller @echo ' zinstall - Install compressed vmlinuz kernel' 2021da177e4SLinus Torvaldsendef 203575afc4dSFiroz Khan 204575afc4dSFiroz Khanarchheaders: 205575afc4dSFiroz Khan $(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all 206