Makefile 5.3 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#
# parisc/Makefile
#
# This file is included by the global makefile so that you can add your own
# architecture-specific flags and dependencies. Remember to do have actions
# for "archclean" and "archdep" for cleaning up and making dependencies for
# this architecture
#
# This file is subject to the terms and conditions of the GNU General Public
# License.  See the file "COPYING" in the main directory of this archive
# for more details.
#
# Copyright (C) 1994 by Linus Torvalds
# Portions Copyright (C) 1999 The Puffin Group
#
# Modified for PA-RISC Linux by Paul Lahaie, Alex deVries, 
# Mike Shaver, Helge Deller and Martin K. Petersen
#
19

20 21
KBUILD_IMAGE := vmlinuz

L
Linus Torvalds 已提交
22
NM		= sh $(srctree)/arch/parisc/nm
23
CHECKFLAGS	+= -D__hppa__=1
24
LIBGCC		= $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
25
export LIBGCC
L
Linus Torvalds 已提交
26 27 28

ifdef CONFIG_64BIT
UTS_MACHINE	:= parisc64
29
CHECKFLAGS	+= -D__LP64__=1
30
CC_ARCHES	= hppa64
31
LD_BFD		:= elf64-hppa-linux
32
else # 32-bit
33
CC_ARCHES	= hppa hppa2.0 hppa1.1
34
LD_BFD		:= elf32-hppa-linux
L
Linus Torvalds 已提交
35 36
endif

37 38
export LD_BFD

39 40 41 42 43 44 45
ifneq ($(SUBARCH),$(UTS_MACHINE))
	ifeq ($(CROSS_COMPILE),)
		CC_SUFFIXES = linux linux-gnu unknown-linux-gnu
		CROSS_COMPILE := $(call cc-cross-prefix, \
			$(foreach a,$(CC_ARCHES), \
			$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
	endif
46
endif
L
Linus Torvalds 已提交
47

S
Sven Schnelle 已提交
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
ifdef CONFIG_DYNAMIC_FTRACE
ifdef CONFIG_64BIT
NOP_COUNT := 8
else
NOP_COUNT := 5
endif

export CC_USING_RECORD_MCOUNT:=1
export CC_USING_PATCHABLE_FUNCTION_ENTRY:=1

KBUILD_AFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1
KBUILD_CFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 \
		 -DFTRACE_PATCHABLE_FUNCTION_SIZE=$(NOP_COUNT)

CC_FLAGS_FTRACE := -fpatchable-function-entry=$(NOP_COUNT),$(shell echo $$(($(NOP_COUNT)-1)))
KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/parisc/kernel/module.lds
endif

L
Linus Torvalds 已提交
66 67 68 69 70 71
OBJCOPY_FLAGS =-O binary -R .note -R .comment -S

cflags-y	:= -pipe

# These flags should be implied by an hppa-linux configuration, but they
# are not in gcc 3.2.
72 73 74 75 76 77
cflags-y	+= -mno-space-regs

# -mfast-indirect-calls is only relevant for 32-bit kernels.
ifndef CONFIG_64BIT
cflags-y	+= -mfast-indirect-calls
endif
L
Linus Torvalds 已提交
78 79 80 81

# Currently we save and restore fpregs on all kernel entry/interruption paths.
# If that gets optimized, we might need to disable the use of fpregs in the
# kernel.
82
cflags-y	+= -mdisable-fpregs
L
Linus Torvalds 已提交
83

84
# Use long jumps instead of long branches (needed if your linker fails to
85 86 87 88
# link a too big vmlinux executable). Not enabled for building modules.
ifdef CONFIG_MLONGCALLS
KBUILD_CFLAGS_KERNEL += -mlong-calls
endif
89

90 91 92 93 94 95 96
# Without this, "ld -r" results in .text sections that are too big (> 0x40000)
# for branches to reach stubs. And multiple .text sections trigger a warning
# when creating the sysfs module information section.
ifndef CONFIG_64BIT
KBUILD_CFLAGS_MODULE += -ffunction-sections
endif

L
Linus Torvalds 已提交
97
# select which processor to optimise for
98
cflags-$(CONFIG_PA7000)		+= -march=1.1 -mschedule=7100
L
Linus Torvalds 已提交
99 100 101 102 103 104 105
cflags-$(CONFIG_PA7200)		+= -march=1.1 -mschedule=7200
cflags-$(CONFIG_PA7100LC)	+= -march=1.1 -mschedule=7100LC
cflags-$(CONFIG_PA7300LC)	+= -march=1.1 -mschedule=7300
cflags-$(CONFIG_PA8X00)		+= -march=2.0 -mschedule=8000

head-y			:= arch/parisc/kernel/head.o 

106
KBUILD_CFLAGS	+= $(cflags-y)
L
Linus Torvalds 已提交
107

T
Thomas Gleixner 已提交
108
kernel-y			:= mm/ kernel/ math-emu/
L
Linus Torvalds 已提交
109 110

core-y	+= $(addprefix arch/parisc/, $(kernel-y))
111
libs-y	+= arch/parisc/lib/ $(LIBGCC)
L
Linus Torvalds 已提交
112 113 114

drivers-$(CONFIG_OPROFILE)		+= arch/parisc/oprofile/

115 116
boot	:= arch/parisc/boot

117
PALO := $(shell if (which palo 2>&1); then : ; \
K
Kyle McMartin 已提交
118 119 120
	elif [ -x /sbin/palo ]; then echo /sbin/palo; \
	fi)

121 122
PALOCONF := $(shell if [ -f $(srctree)/palo.conf ]; then echo $(srctree)/palo.conf; \
	else echo $(objtree)/palo.conf; \
123 124
	fi)

125
palo lifimage: vmlinuz
126
	@if test ! -x "$(PALO)"; then \
K
Kyle McMartin 已提交
127 128 129 130
		echo 'ERROR: Please install palo first (apt-get install palo)';\
		echo 'or build it from source and install it somewhere in your $$PATH';\
		false; \
	fi
131
	@if test ! -f "$(PALOCONF)"; then \
132 133
		cp $(srctree)/arch/parisc/defpalo.conf $(objtree)/palo.conf; \
		echo 'A generic palo config file ($(objree)/palo.conf) has been created for you.'; \
K
Kyle McMartin 已提交
134 135 136 137
		echo 'You should check it and re-run "make palo".'; \
		echo 'WARNING: the "lifimage" file is now placed in this directory by default!'; \
		false; \
	fi
138
	$(PALO) -f $(PALOCONF)
K
Kyle McMartin 已提交
139

140 141 142 143 144
BOOT_TARGETS    = zImage Image palo lifimage
INSTALL_TARGETS = zinstall install

PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)

145 146 147
# Default kernel to build
all: bzImage

148
zImage: vmlinuz
149 150
Image: vmlinux

151 152 153
bzImage: vmlinux
	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@

154
ifdef CONFIG_PARISC_SELF_EXTRACT
155 156
vmlinuz: bzImage
	$(OBJCOPY) $(boot)/bzImage $@
157 158 159 160
else
vmlinuz: vmlinux
	@gzip -cf -9 $< > $@
endif
L
Linus Torvalds 已提交
161

162
install:
163
	$(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
164 165
			$(KERNELRELEASE) vmlinux System.map "$(INSTALL_PATH)"
zinstall:
166
	$(CONFIG_SHELL) $(srctree)/arch/parisc/install.sh \
167
			$(KERNELRELEASE) vmlinuz System.map "$(INSTALL_PATH)"
L
Linus Torvalds 已提交
168

169
CLEAN_FILES	+= lifimage
L
Linus Torvalds 已提交
170 171 172 173
MRPROPER_FILES	+= palo.conf

define archhelp
	@echo  '* vmlinux	- Uncompressed kernel image (./vmlinux)'
174
	@echo  '  vmlinuz	- Compressed kernel image (./vmlinuz)'
K
Kyle McMartin 已提交
175
	@echo  '  palo		- Bootable image (./lifimage)'
176
	@echo  '  install	- Install uncompressed vmlinux kernel using'
177 178
	@echo  '		  (your) ~/bin/$(INSTALLKERNEL) or'
	@echo  '		  (distribution) /sbin/$(INSTALLKERNEL) or'
L
Linus Torvalds 已提交
179
	@echo  '		  copy to $$(INSTALL_PATH)'
180
	@echo  '  zinstall	- Install compressed vmlinuz kernel'
L
Linus Torvalds 已提交
181
endef
182

183 184 185
archclean:
	$(Q)$(MAKE) $(clean)=$(boot)

186 187
archheaders:
	$(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all