1# 2# parisc/Makefile 3# 4# This file is included by the global makefile so that you can add your own 5# architecture-specific flags and dependencies. 6# 7# This file is subject to the terms and conditions of the GNU General Public 8# License. See the file "COPYING" in the main directory of this archive 9# for more details. 10# 11# Copyright (C) 1994 by Linus Torvalds 12# Portions Copyright (C) 1999 The Puffin Group 13# 14# Modified for PA-RISC Linux by Paul Lahaie, Alex deVries, 15# Mike Shaver, Helge Deller and Martin K. Petersen 16# 17 18ifdef CONFIG_PARISC_SELF_EXTRACT 19boot := arch/parisc/boot 20KBUILD_IMAGE := $(boot)/bzImage 21else 22KBUILD_IMAGE := vmlinuz 23endif 24 25NM = sh $(srctree)/arch/parisc/nm 26CHECKFLAGS += -D__hppa__=1 27 28ifdef CONFIG_64BIT 29UTS_MACHINE := parisc64 30CHECKFLAGS += -D__LP64__=1 31LD_BFD := elf64-hppa-linux 32else # 32-bit 33LD_BFD := elf32-hppa-linux 34endif 35 36# select defconfig based on actual architecture 37ifeq ($(ARCH),parisc64) 38 KBUILD_DEFCONFIG := generic-64bit_defconfig 39 CC_ARCHES := hppa64 40else 41 KBUILD_DEFCONFIG := generic-32bit_defconfig 42 CC_ARCHES := hppa hppa2.0 hppa1.1 43endif 44 45export LD_BFD 46 47# Set default 32 bits cross compilers for vdso 48CC_ARCHES_32 = hppa hppa2.0 hppa1.1 49CC_SUFFIXES = linux linux-gnu unknown-linux-gnu 50CROSS32_COMPILE := $(call cc-cross-prefix, \ 51 $(foreach a,$(CC_ARCHES_32), \ 52 $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-))) 53CROSS32CC := $(CROSS32_COMPILE)gcc 54export CROSS32CC 55 56# Set default cross compiler for kernel build 57ifdef cross_compiling 58 ifeq ($(CROSS_COMPILE),) 59 CC_SUFFIXES = linux linux-gnu unknown-linux-gnu 60 CROSS_COMPILE := $(call cc-cross-prefix, \ 61 $(foreach a,$(CC_ARCHES), \ 62 $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-))) 63 endif 64endif 65 66ifdef CONFIG_DYNAMIC_FTRACE 67ifdef CONFIG_64BIT 68NOP_COUNT := 8 69else 70NOP_COUNT := 5 71endif 72 73export CC_USING_RECORD_MCOUNT:=1 74export CC_USING_PATCHABLE_FUNCTION_ENTRY:=1 75 76KBUILD_AFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 77KBUILD_CFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 \ 78 -DFTRACE_PATCHABLE_FUNCTION_SIZE=$(NOP_COUNT) 79 80CC_FLAGS_FTRACE := -fpatchable-function-entry=$(NOP_COUNT),$(shell echo $$(($(NOP_COUNT)-1))) 81endif 82 83OBJCOPY_FLAGS =-O binary -R .note -R .comment -S 84 85cflags-y := -pipe 86 87# These flags should be implied by an hppa-linux configuration, but they 88# are not in gcc 3.2. 89cflags-y += -mno-space-regs 90 91# -mfast-indirect-calls is only relevant for 32-bit kernels. 92ifndef CONFIG_64BIT 93cflags-y += -mfast-indirect-calls 94endif 95 96# Currently we save and restore fpregs on all kernel entry/interruption paths. 97# If that gets optimized, we might need to disable the use of fpregs in the 98# kernel. 99cflags-y += -mdisable-fpregs 100 101# Use long jumps instead of long branches (needed if your linker fails to 102# link a too big vmlinux executable). Not enabled for building modules. 103ifdef CONFIG_MLONGCALLS 104KBUILD_CFLAGS_KERNEL += -mlong-calls 105endif 106 107# Without this, "ld -r" results in .text sections that are too big (> 0x40000) 108# for branches to reach stubs. And multiple .text sections trigger a warning 109# when creating the sysfs module information section. 110ifndef CONFIG_64BIT 111KBUILD_CFLAGS_MODULE += -ffunction-sections 112endif 113 114# select which processor to optimise for 115cflags-$(CONFIG_PA7000) += -march=1.1 -mschedule=7100 116cflags-$(CONFIG_PA7200) += -march=1.1 -mschedule=7200 117cflags-$(CONFIG_PA7100LC) += -march=1.1 -mschedule=7100LC 118cflags-$(CONFIG_PA7300LC) += -march=1.1 -mschedule=7300 119cflags-$(CONFIG_PA8X00) += -march=2.0 -mschedule=8000 120 121head-y := arch/parisc/kernel/head.o 122 123KBUILD_CFLAGS += $(cflags-y) 124LIBGCC := $(shell $(CC) -print-libgcc-file-name) 125export LIBGCC 126 127libs-y += arch/parisc/lib/ $(LIBGCC) 128 129boot := arch/parisc/boot 130 131PALO := $(shell if (which palo 2>&1); then : ; \ 132 elif [ -x /sbin/palo ]; then echo /sbin/palo; \ 133 fi) 134 135PALOCONF := $(shell if [ -f $(srctree)/palo.conf ]; then echo $(srctree)/palo.conf; \ 136 else echo $(objtree)/palo.conf; \ 137 fi) 138 139palo lifimage: vmlinuz 140 @if test ! -x "$(PALO)"; then \ 141 echo 'ERROR: Please install palo first (apt-get install palo)';\ 142 echo 'or build it from source and install it somewhere in your $$PATH';\ 143 false; \ 144 fi 145 @if test ! -f "$(PALOCONF)"; then \ 146 cp $(srctree)/arch/parisc/defpalo.conf $(objtree)/palo.conf; \ 147 echo 'A generic palo config file ($(objree)/palo.conf) has been created for you.'; \ 148 echo 'You should check it and re-run "make palo".'; \ 149 echo 'WARNING: the "lifimage" file is now placed in this directory by default!'; \ 150 false; \ 151 fi 152 $(PALO) -f $(PALOCONF) 153 154BOOT_TARGETS = zImage Image palo lifimage 155INSTALL_TARGETS = zinstall install 156 157PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS) 158 159# Default kernel to build 160all: bzImage 161 162zImage: vmlinuz 163Image: vmlinux 164 165bzImage: vmlinux 166 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 167 168ifdef CONFIG_PARISC_SELF_EXTRACT 169vmlinuz: bzImage 170 $(OBJCOPY) $(boot)/bzImage $@ 171else 172vmlinuz: vmlinux 173 @$(KGZIP) -cf -9 $< > $@ 174endif 175 176ifeq ($(KBUILD_EXTMOD),) 177# We need to generate vdso-offsets.h before compiling certain files in kernel/. 178# In order to do that, we should use the archprepare target, but we can't since 179# asm-offsets.h is included in some files used to generate vdso-offsets.h, and 180# asm-offsets.h is built in prepare0, for which archprepare is a dependency. 181# Therefore we need to generate the header after prepare0 has been made, hence 182# this hack. 183prepare: vdso_prepare 184vdso_prepare: prepare0 185 $(if $(CONFIG_64BIT),$(Q)$(MAKE) \ 186 $(build)=arch/parisc/kernel/vdso64 include/generated/vdso64-offsets.h) 187 $(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 include/generated/vdso32-offsets.h 188endif 189 190PHONY += vdso_install 191 192vdso_install: 193 $(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso $@ 194 $(if $(CONFIG_COMPAT_VDSO), \ 195 $(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 $@) 196install: 197 $(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \ 198 $(KERNELRELEASE) vmlinux System.map "$(INSTALL_PATH)" 199zinstall: 200 $(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \ 201 $(KERNELRELEASE) vmlinuz System.map "$(INSTALL_PATH)" 202 203CLEAN_FILES += lifimage 204MRPROPER_FILES += palo.conf 205 206define archhelp 207 @echo '* vmlinux - Uncompressed kernel image (./vmlinux)' 208 @echo ' vmlinuz - Compressed kernel image (./vmlinuz)' 209 @echo ' palo - Bootable image (./lifimage)' 210 @echo ' install - Install uncompressed vmlinux kernel using' 211 @echo ' (your) ~/bin/$(INSTALLKERNEL) or' 212 @echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 213 @echo ' copy to $$(INSTALL_PATH)' 214 @echo ' zinstall - Install compressed vmlinuz kernel' 215endef 216 217archheaders: 218 $(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all 219