Makefile 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. boot := arch/parisc/boot
  18. KBUILD_IMAGE := $(boot)/bzImage
  19. CHECKFLAGS += -D__hppa__=1
  20. ifdef CONFIG_64BIT
  21. UTS_MACHINE := parisc64
  22. CHECKFLAGS += -D__LP64__=1
  23. LD_BFD := elf64-hppa-linux
  24. else # 32-bit
  25. LD_BFD := elf32-hppa-linux
  26. endif
  27. # select defconfig based on actual architecture
  28. ifeq ($(ARCH),parisc64)
  29. KBUILD_DEFCONFIG := generic-64bit_defconfig
  30. CC_ARCHES := hppa64
  31. else
  32. KBUILD_DEFCONFIG := generic-32bit_defconfig
  33. CC_ARCHES := hppa hppa2.0 hppa1.1
  34. endif
  35. export LD_BFD
  36. # Set default 32 bits cross compilers for vdso
  37. CC_ARCHES_32 = hppa hppa2.0 hppa1.1
  38. CC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux
  39. CROSS32_COMPILE := $(call cc-cross-prefix, \
  40. $(foreach a,$(CC_ARCHES_32), \
  41. $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
  42. CROSS32CC := $(CROSS32_COMPILE)gcc
  43. export CROSS32CC
  44. # Set default cross compiler for kernel build
  45. ifdef cross_compiling
  46. ifeq ($(CROSS_COMPILE),)
  47. CC_SUFFIXES = linux linux-gnu unknown-linux-gnu suse-linux
  48. CROSS_COMPILE := $(call cc-cross-prefix, \
  49. $(foreach a,$(CC_ARCHES), \
  50. $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
  51. endif
  52. endif
  53. ifdef CONFIG_DYNAMIC_FTRACE
  54. ifdef CONFIG_64BIT
  55. NOP_COUNT := 8
  56. else
  57. NOP_COUNT := 5
  58. endif
  59. export CC_USING_RECORD_MCOUNT:=1
  60. export CC_USING_PATCHABLE_FUNCTION_ENTRY:=1
  61. KBUILD_AFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1
  62. KBUILD_CFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY=1 \
  63. -DFTRACE_PATCHABLE_FUNCTION_SIZE=$(NOP_COUNT)
  64. CC_FLAGS_FTRACE := -fpatchable-function-entry=$(NOP_COUNT),$(shell echo $$(($(NOP_COUNT)-1)))
  65. endif
  66. OBJCOPY_FLAGS =-O binary -R .note -R .comment -S
  67. cflags-y := -pipe
  68. # These flags should be implied by an hppa-linux configuration, but they
  69. # are not in gcc 3.2.
  70. cflags-y += -mno-space-regs
  71. # -mfast-indirect-calls is only relevant for 32-bit kernels.
  72. ifndef CONFIG_64BIT
  73. cflags-y += -mfast-indirect-calls
  74. endif
  75. # Currently we save and restore fpregs on all kernel entry/interruption paths.
  76. # If that gets optimized, we might need to disable the use of fpregs in the
  77. # kernel.
  78. cflags-y += -mdisable-fpregs
  79. # Use long jumps instead of long branches (needed if your linker fails to
  80. # link a too big vmlinux executable). Not enabled for building modules.
  81. ifdef CONFIG_MLONGCALLS
  82. KBUILD_CFLAGS_KERNEL += -mlong-calls
  83. endif
  84. # Without this, "ld -r" results in .text sections that are too big (> 0x40000)
  85. # for branches to reach stubs. And multiple .text sections trigger a warning
  86. # when creating the sysfs module information section.
  87. ifndef CONFIG_64BIT
  88. KBUILD_CFLAGS_MODULE += -ffunction-sections
  89. endif
  90. # select which processor to optimise for
  91. cflags-$(CONFIG_PA7000) += -march=1.1 -mschedule=7100
  92. cflags-$(CONFIG_PA7200) += -march=1.1 -mschedule=7200
  93. cflags-$(CONFIG_PA7100LC) += -march=1.1 -mschedule=7100LC
  94. cflags-$(CONFIG_PA7300LC) += -march=1.1 -mschedule=7300
  95. cflags-$(CONFIG_PA8X00) += -march=2.0 -mschedule=8000
  96. KBUILD_CFLAGS += $(cflags-y)
  97. LIBGCC := $(shell $(CC) -print-libgcc-file-name)
  98. export LIBGCC
  99. libs-y += arch/parisc/lib/ $(LIBGCC)
  100. boot := arch/parisc/boot
  101. PALO := $(shell if (which palo 2>&1); then : ; \
  102. elif [ -x /sbin/palo ]; then echo /sbin/palo; \
  103. fi)
  104. PALOCONF := $(shell if [ -f $(srctree)/palo.conf ]; then echo $(srctree)/palo.conf; \
  105. else echo $(objtree)/palo.conf; \
  106. fi)
  107. palo lifimage: vmlinuz
  108. @if test ! -x "$(PALO)"; then \
  109. echo 'ERROR: Please install palo first (apt-get install palo)';\
  110. echo 'or build it from source and install it somewhere in your $$PATH';\
  111. false; \
  112. fi
  113. @if test ! -f "$(PALOCONF)"; then \
  114. cp $(srctree)/arch/parisc/defpalo.conf $(objtree)/palo.conf; \
  115. echo 'A generic palo config file ($(objree)/palo.conf) has been created for you.'; \
  116. echo 'You should check it and re-run "make palo".'; \
  117. echo 'WARNING: the "lifimage" file is now placed in this directory by default!'; \
  118. false; \
  119. fi
  120. $(PALO) -f $(PALOCONF)
  121. BOOT_TARGETS = zImage Image palo lifimage
  122. INSTALL_TARGETS = zinstall install
  123. PHONY += bzImage $(BOOT_TARGETS) $(INSTALL_TARGETS)
  124. # Default kernel to build
  125. all: bzImage
  126. zImage: vmlinuz
  127. Image: vmlinux
  128. bzImage: vmlinux
  129. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  130. vmlinuz: bzImage
  131. $(OBJCOPY) $(boot)/bzImage $@
  132. ifeq ($(KBUILD_EXTMOD),)
  133. # We need to generate vdso-offsets.h before compiling certain files in kernel/.
  134. # In order to do that, we should use the archprepare target, but we can't since
  135. # asm-offsets.h is included in some files used to generate vdso-offsets.h, and
  136. # asm-offsets.h is built in prepare0, for which archprepare is a dependency.
  137. # Therefore we need to generate the header after prepare0 has been made, hence
  138. # this hack.
  139. prepare: vdso_prepare
  140. vdso_prepare: prepare0
  141. $(if $(CONFIG_64BIT),$(Q)$(MAKE) \
  142. $(build)=arch/parisc/kernel/vdso64 include/generated/vdso64-offsets.h)
  143. $(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 include/generated/vdso32-offsets.h
  144. endif
  145. PHONY += vdso_install
  146. vdso_install:
  147. $(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso $@
  148. $(if $(CONFIG_COMPAT_VDSO), \
  149. $(Q)$(MAKE) $(build)=arch/parisc/kernel/vdso32 $@)
  150. install: KBUILD_IMAGE := vmlinux
  151. zinstall: KBUILD_IMAGE := vmlinuz
  152. install zinstall:
  153. $(call cmd,install)
  154. CLEAN_FILES += lifimage
  155. MRPROPER_FILES += palo.conf
  156. define archhelp
  157. @echo '* vmlinux - Uncompressed kernel image (./vmlinux)'
  158. @echo ' vmlinuz - Compressed kernel image (./vmlinuz)'
  159. @echo ' palo - Bootable image (./lifimage)'
  160. @echo ' install - Install uncompressed vmlinux kernel using'
  161. @echo ' (your) ~/bin/$(INSTALLKERNEL) or'
  162. @echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
  163. @echo ' copy to $$(INSTALL_PATH)'
  164. @echo ' zinstall - Install compressed vmlinuz kernel'
  165. endef
  166. archheaders:
  167. $(Q)$(MAKE) $(build)=arch/parisc/kernel/syscalls all