Makefile 6.9 KB

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