Makefile 6.9 KB

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