Makefile 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. #
  2. # arch/sh/Makefile
  3. #
  4. # Copyright (C) 1999 Kaz Kojima
  5. # Copyright (C) 2002 - 2008 Paul Mundt
  6. # Copyright (C) 2002 M. R. Brown
  7. #
  8. # This file is subject to the terms and conditions of the GNU General Public
  9. # License. See the file "COPYING" in the main directory of this archive
  10. # for more details.
  11. #
  12. isa-y := any
  13. isa-$(CONFIG_SH_DSP) := sh
  14. isa-$(CONFIG_CPU_SH2) := sh2
  15. isa-$(CONFIG_CPU_SH2A) := sh2a
  16. isa-$(CONFIG_CPU_SH3) := sh3
  17. isa-$(CONFIG_CPU_SH4) := sh4
  18. isa-$(CONFIG_CPU_SH4A) := sh4a
  19. isa-$(CONFIG_CPU_SH4AL_DSP) := sh4al
  20. isa-$(CONFIG_CPU_SH5) := shmedia
  21. ifeq ($(CONFIG_SUPERH32),y)
  22. isa-$(CONFIG_SH_DSP) := $(isa-y)-dsp
  23. isa-y := $(isa-y)-up
  24. endif
  25. cflags-$(CONFIG_CPU_SH2) := $(call cc-option,-m2,)
  26. cflags-$(CONFIG_CPU_SH2A) += $(call cc-option,-m2a,) \
  27. $(call cc-option,-m2a-nofpu,)
  28. cflags-$(CONFIG_CPU_SH3) := $(call cc-option,-m3,)
  29. cflags-$(CONFIG_CPU_SH4) := $(call cc-option,-m4,) \
  30. $(call cc-option,-mno-implicit-fp,-m4-nofpu)
  31. cflags-$(CONFIG_CPU_SH4A) += $(call cc-option,-m4a,) \
  32. $(call cc-option,-m4a-nofpu,)
  33. cflags-$(CONFIG_CPU_SH4AL_DSP) += $(call cc-option,-m4al,)
  34. cflags-$(CONFIG_CPU_SH5) := $(call cc-option,-m5-32media-nofpu,)
  35. cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb
  36. cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml
  37. cflags-y += $(call cc-option,-mno-fdpic)
  38. #
  39. # -Wa,-isa= tuning implies -Wa,-dsp for the versions of binutils that
  40. # support it, while -Wa,-dsp by itself limits the range of usable opcodes
  41. # on certain CPU subtypes. Try the ISA variant first, and if that fails,
  42. # fall back on -Wa,-dsp for the old binutils versions. Even without DSP
  43. # opcodes, we always want the best ISA tuning the version of binutils
  44. # will provide.
  45. #
  46. isaflags-y := $(call as-option,-Wa$(comma)-isa=$(isa-y),)
  47. isaflags-$(CONFIG_SH_DSP) := \
  48. $(call as-option,-Wa$(comma)-isa=$(isa-y),-Wa$(comma)-dsp)
  49. cflags-y += $(isaflags-y) -ffreestanding
  50. cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \
  51. $(shell echo $(CONFIG_COMPILE_OPTIONS) | sed -e 's/"//g')
  52. OBJCOPYFLAGS := -O binary -R .note -R .note.gnu.build-id -R .comment \
  53. -R .stab -R .stabstr -S
  54. # Give the various platforms the opportunity to set default image types
  55. defaultimage-$(CONFIG_SUPERH32) := zImage
  56. defaultimage-$(CONFIG_SH_SH7785LCR) := uImage
  57. defaultimage-$(CONFIG_SH_RSK7203) := uImage
  58. defaultimage-$(CONFIG_SH_7206_SOLUTION_ENGINE) := vmlinux
  59. defaultimage-$(CONFIG_SH_7619_SOLUTION_ENGINE) := vmlinux
  60. # Set some sensible Kbuild defaults
  61. KBUILD_DEFCONFIG := shx3_defconfig
  62. KBUILD_IMAGE := $(defaultimage-y)
  63. #
  64. # Choosing incompatible machines durings configuration will result in
  65. # error messages during linking.
  66. #
  67. ifdef CONFIG_SUPERH32
  68. UTS_MACHINE := sh
  69. LDFLAGS_vmlinux += -e _stext
  70. else
  71. UTS_MACHINE := sh64
  72. LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_PAGE_OFFSET) \
  73. --defsym phys_stext_shmedia=phys_stext+1 \
  74. -e phys_stext_shmedia
  75. endif
  76. ifdef CONFIG_CPU_LITTLE_ENDIAN
  77. LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64'
  78. LDFLAGS += -EL
  79. else
  80. LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64+4'
  81. LDFLAGS += -EB
  82. endif
  83. head-y := arch/sh/kernel/init_task.o
  84. head-$(CONFIG_SUPERH32) += arch/sh/kernel/head_32.o
  85. head-$(CONFIG_SUPERH64) += arch/sh/kernel/head_64.o
  86. core-y += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/
  87. core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/
  88. # Mach groups
  89. machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se
  90. machdir-$(CONFIG_SH_HP6XX) += mach-hp6xx
  91. machdir-$(CONFIG_SH_DREAMCAST) += mach-dreamcast
  92. machdir-$(CONFIG_SH_SH03) += mach-sh03
  93. machdir-$(CONFIG_SH_SECUREEDGE5410) += mach-snapgear
  94. machdir-$(CONFIG_SH_RTS7751R2D) += mach-r2d
  95. machdir-$(CONFIG_SH_7751_SYSTEMH) += mach-systemh
  96. machdir-$(CONFIG_SH_EDOSK7705) += mach-edosk7705
  97. machdir-$(CONFIG_SH_HIGHLANDER) += mach-highlander
  98. machdir-$(CONFIG_SH_MIGOR) += mach-migor
  99. machdir-$(CONFIG_SH_SDK7780) += mach-sdk7780
  100. machdir-$(CONFIG_SH_X3PROTO) += mach-x3proto
  101. machdir-$(CONFIG_SH_SH7763RDP) += mach-sh7763rdp
  102. machdir-$(CONFIG_SH_SH4202_MICRODEV) += mach-microdev
  103. machdir-$(CONFIG_SH_LANDISK) += mach-landisk
  104. machdir-$(CONFIG_SH_TITAN) += mach-titan
  105. machdir-$(CONFIG_SH_LBOX_RE2) += mach-lboxre2
  106. machdir-$(CONFIG_SH_CAYMAN) += mach-cayman
  107. ifneq ($(machdir-y),)
  108. core-y += $(addprefix arch/sh/boards/, \
  109. $(filter-out ., $(patsubst %,%/,$(machdir-y))))
  110. endif
  111. # Common machine type headers. Not part of the arch/sh/boards/ hierarchy.
  112. machdir-y += mach-common
  113. # Companion chips
  114. core-$(CONFIG_HD6446X_SERIES) += arch/sh/cchips/hd6446x/
  115. #
  116. # CPU header paths
  117. #
  118. # These are ordered by optimization level. A CPU family that is a subset
  119. # of another (ie, SH-2A / SH-2), is picked up first, with increasing
  120. # levels of genericness if nothing more suitable is situated in the
  121. # hierarchy.
  122. #
  123. # As an example, in order of preference, SH-2A > SH-2 > common definitions.
  124. #
  125. cpuincdir-$(CONFIG_CPU_SH2A) += cpu-sh2a
  126. cpuincdir-$(CONFIG_CPU_SH2) += cpu-sh2
  127. cpuincdir-$(CONFIG_CPU_SH3) += cpu-sh3
  128. cpuincdir-$(CONFIG_CPU_SH4) += cpu-sh4
  129. cpuincdir-$(CONFIG_CPU_SH5) += cpu-sh5
  130. cpuincdir-y += cpu-common # Must be last
  131. drivers-y += arch/sh/drivers/
  132. drivers-$(CONFIG_OPROFILE) += arch/sh/oprofile/
  133. boot := arch/sh/boot
  134. cflags-y += $(foreach d, $(cpuincdir-y), -Iarch/sh/include/$(d)) \
  135. $(foreach d, $(machdir-y), -Iarch/sh/include/$(d))
  136. KBUILD_CFLAGS += -pipe $(cflags-y)
  137. KBUILD_CPPFLAGS += $(cflags-y)
  138. KBUILD_AFLAGS += $(cflags-y)
  139. LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
  140. libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y)
  141. libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y) $(LIBGCC)
  142. PHONY += maketools FORCE
  143. maketools: include/linux/version.h FORCE
  144. $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h
  145. all: $(KBUILD_IMAGE)
  146. zImage uImage uImage.srec vmlinux.srec: vmlinux
  147. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  148. compressed: zImage
  149. archprepare: maketools arch/sh/lib64/syscalltab.h
  150. archclean:
  151. $(Q)$(MAKE) $(clean)=$(boot)
  152. define archhelp
  153. @echo '* zImage - Compressed kernel image'
  154. @echo ' vmlinux.srec - Create an ELF S-record'
  155. @echo ' uImage - Create a bootable image for U-Boot'
  156. @echo ' uImage.srec - Create an S-record for U-Boot'
  157. endef
  158. define filechk_gen-syscalltab
  159. (set -e; \
  160. echo "/*"; \
  161. echo " * DO NOT MODIFY."; \
  162. echo " *"; \
  163. echo " * This file was generated by arch/sh/Makefile"; \
  164. echo " * Any changes will be reverted at build time."; \
  165. echo " */"; \
  166. echo ""; \
  167. echo "#ifndef __SYSCALLTAB_H"; \
  168. echo "#define __SYSCALLTAB_H"; \
  169. echo ""; \
  170. echo "#include <linux/kernel.h>"; \
  171. echo ""; \
  172. echo "struct syscall_info {"; \
  173. echo " const char *name;"; \
  174. echo "} syscall_info_table[] = {"; \
  175. sed -e '/^.*\.long /!d;s// { "/;s/\(\([^/]*\)\/\)\{1\}.*/\2/; \
  176. s/[ \t]*$$//g;s/$$/" },/;s/\("\)sys_/\1/g'; \
  177. echo "};"; \
  178. echo ""; \
  179. echo "#define NUM_SYSCALL_INFO_ENTRIES ARRAY_SIZE(syscall_info_table)";\
  180. echo ""; \
  181. echo "#endif /* __SYSCALLTAB_H */" )
  182. endef
  183. arch/sh/lib64/syscalltab.h: arch/sh/kernel/syscalls_64.S
  184. $(call filechk,gen-syscalltab)
  185. CLEAN_FILES += arch/sh/lib64/syscalltab.h \
  186. include/asm-sh/machtypes.h