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