Makefile 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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_MMU
  23. isa-y := $(isa-y)-nommu
  24. endif
  25. ifndef CONFIG_SH_DSP
  26. ifndef CONFIG_SH_FPU
  27. isa-y := $(isa-y)-nofpu
  28. endif
  29. endif
  30. isa-y := $(isa-y)-up
  31. cflags-$(CONFIG_CPU_SH2) := $(call cc-option,-m2,)
  32. cflags-$(CONFIG_CPU_SH2A) += $(call cc-option,-m2a,) \
  33. $(call cc-option,-m2a-nofpu,)
  34. cflags-$(CONFIG_CPU_SH3) := $(call cc-option,-m3,)
  35. cflags-$(CONFIG_CPU_SH4) := $(call cc-option,-m4,) \
  36. $(call cc-option,-mno-implicit-fp,-m4-nofpu)
  37. cflags-$(CONFIG_CPU_SH4A) += $(call cc-option,-m4a,) \
  38. $(call cc-option,-m4a-nofpu,)
  39. cflags-$(CONFIG_CPU_SH5) := $(call cc-option,-m5-32media-nofpu,)
  40. cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb
  41. cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml
  42. #
  43. # -Wa,-isa= tuning implies -Wa,-dsp for the versions of binutils that
  44. # support it, while -Wa,-dsp by itself limits the range of usable opcodes
  45. # on certain CPU subtypes. Try the ISA variant first, and if that fails,
  46. # fall back on -Wa,-dsp for the old binutils versions. Even without DSP
  47. # opcodes, we always want the best ISA tuning the version of binutils
  48. # will provide.
  49. #
  50. isaflags-y := $(call as-option,-Wa$(comma)-isa=$(isa-y),)
  51. isaflags-$(CONFIG_SH_DSP) := \
  52. $(call as-option,-Wa$(comma)-isa=$(isa-y),-Wa$(comma)-dsp)
  53. cflags-y += $(isaflags-y) -ffreestanding
  54. cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \
  55. $(shell echo $(CONFIG_COMPILE_OPTIONS) | sed -e 's/"//g')
  56. OBJCOPYFLAGS := -O binary -R .note -R .note.gnu.build-id -R .comment \
  57. -R .stab -R .stabstr -S
  58. # Give the various platforms the opportunity to set default image types
  59. defaultimage-$(CONFIG_SUPERH32) := zImage
  60. # Set some sensible Kbuild defaults
  61. KBUILD_DEFCONFIG := r7780rp_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. LDFLAGS_vmlinux += -e _stext
  69. else
  70. LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_PAGE_OFFSET) \
  71. --defsym phys_stext_shmedia=phys_stext+1 \
  72. -e phys_stext_shmedia
  73. endif
  74. ifdef CONFIG_CPU_LITTLE_ENDIAN
  75. LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64'
  76. LDFLAGS += -EL
  77. else
  78. LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64+4'
  79. LDFLAGS += -EB
  80. endif
  81. KBUILD_CFLAGS += -pipe $(cflags-y)
  82. KBUILD_AFLAGS += $(cflags-y)
  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. LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
  87. core-y += arch/sh/kernel/ arch/sh/mm/
  88. core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/
  89. # Boards
  90. machdir-$(CONFIG_SH_SOLUTION_ENGINE) += se/770x
  91. machdir-$(CONFIG_SH_7722_SOLUTION_ENGINE) += se/7722
  92. machdir-$(CONFIG_SH_7751_SOLUTION_ENGINE) += se/7751
  93. machdir-$(CONFIG_SH_7780_SOLUTION_ENGINE) += se/7780
  94. machdir-$(CONFIG_SH_7343_SOLUTION_ENGINE) += se/7343
  95. machdir-$(CONFIG_SH_HP6XX) += hp6xx
  96. machdir-$(CONFIG_SH_DREAMCAST) += dreamcast
  97. machdir-$(CONFIG_SH_MPC1211) += mpc1211
  98. machdir-$(CONFIG_SH_SH03) += sh03
  99. machdir-$(CONFIG_SH_SECUREEDGE5410) += snapgear
  100. machdir-$(CONFIG_SH_HS7751RVOIP) += renesas/hs7751rvoip
  101. machdir-$(CONFIG_SH_RTS7751R2D) += renesas/rts7751r2d
  102. machdir-$(CONFIG_SH_7751_SYSTEMH) += renesas/systemh
  103. machdir-$(CONFIG_SH_EDOSK7705) += renesas/edosk7705
  104. machdir-$(CONFIG_SH_HIGHLANDER) += renesas/r7780rp
  105. machdir-$(CONFIG_SH_7710VOIPGW) += renesas/sh7710voipgw
  106. machdir-$(CONFIG_SH_X3PROTO) += renesas/x3proto
  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. core-$(CONFIG_MFD_SM501) += arch/sh/cchips/voyagergx/
  124. cpuincdir-$(CONFIG_CPU_SH2) := cpu-sh2
  125. cpuincdir-$(CONFIG_CPU_SH2A) := cpu-sh2a
  126. cpuincdir-$(CONFIG_CPU_SH3) := cpu-sh3
  127. cpuincdir-$(CONFIG_CPU_SH4) := cpu-sh4
  128. cpuincdir-$(CONFIG_CPU_SH5) := cpu-sh5
  129. libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y)
  130. libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y)
  131. libs-y += $(LIBGCC)
  132. drivers-y += arch/sh/drivers/
  133. drivers-$(CONFIG_OPROFILE) += arch/sh/oprofile/
  134. boot := arch/sh/boot
  135. CPPFLAGS_vmlinux.lds := -traditional
  136. incdir-prefix := $(srctree)/include/asm-sh/
  137. # Update machine arch and proc symlinks if something which affects
  138. # them changed. We use .arch and .mach to indicate when they were
  139. # updated last, otherwise make uses the target directory mtime.
  140. include/asm-sh/.cpu: $(wildcard include/config/cpu/*.h) \
  141. include/config/auto.conf FORCE
  142. @echo ' SYMLINK include/asm-sh/cpu -> include/asm-sh/$(cpuincdir-y)'
  143. $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
  144. $(Q)ln -fsn $(incdir-prefix)$(cpuincdir-y) include/asm-sh/cpu
  145. @touch $@
  146. # Most boards have their own mach directories. For the ones that
  147. # don't, just reference the parent directory so the semantics are
  148. # kept roughly the same.
  149. #
  150. # When multiple boards are compiled in at the same time, preference
  151. # for the mach link is given to whichever has a directory for its
  152. # headers. However, this is only a workaround until platforms that
  153. # can live in the same kernel image back away from relying on the
  154. # mach link.
  155. include/asm-sh/.mach: $(wildcard include/config/sh/*.h) \
  156. include/config/auto.conf FORCE
  157. $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
  158. $(Q)rm -f include/asm-sh/mach
  159. $(Q)for i in $(incdir-y); do \
  160. if [ -d $(incdir-prefix)$$i ]; then \
  161. echo -n ' SYMLINK include/asm-sh/mach -> '; \
  162. echo -e "include/asm-sh/$$i"; \
  163. ln -fsn $(incdir-prefix)$$i \
  164. include/asm-sh/mach; \
  165. else \
  166. if [ ! -d include/asm-sh/mach ]; then \
  167. echo -n ' SYMLINK include/asm-sh/mach -> '; \
  168. echo -e 'include/asm-sh'; \
  169. ln -fsn $(incdir-prefix) include/asm-sh/mach; \
  170. fi; \
  171. fi; \
  172. done
  173. @touch $@
  174. PHONY += maketools FORCE
  175. maketools: include/linux/version.h FORCE
  176. $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h
  177. all: $(KBUILD_IMAGE)
  178. zImage uImage uImage.srec vmlinux.srec: vmlinux
  179. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  180. compressed: zImage
  181. archprepare: include/asm-sh/.cpu include/asm-sh/.mach maketools \
  182. arch/sh/lib64/syscalltab.h
  183. archclean:
  184. $(Q)$(MAKE) $(clean)=$(boot)
  185. define archhelp
  186. @echo '* zImage - Compressed kernel image'
  187. @echo ' vmlinux.srec - Create an ELF S-record'
  188. @echo ' uImage - Create a bootable image for U-Boot'
  189. @echo ' uImage.srec - Create an S-record for U-Boot'
  190. endef
  191. define filechk_gen-syscalltab
  192. (set -e; \
  193. echo "/*"; \
  194. echo " * DO NOT MODIFY."; \
  195. echo " *"; \
  196. echo " * This file was generated by arch/sh/Makefile"; \
  197. echo " * Any changes will be reverted at build time."; \
  198. echo " */"; \
  199. echo ""; \
  200. echo "#ifndef __SYSCALLTAB_H"; \
  201. echo "#define __SYSCALLTAB_H"; \
  202. echo ""; \
  203. echo "#include <linux/kernel.h>"; \
  204. echo ""; \
  205. echo "struct syscall_info {"; \
  206. echo " const char *name;"; \
  207. echo "} syscall_info_table[] = {"; \
  208. sed -e '/^.*\.long /!d;s// { "/;s/\(\([^/]*\)\/\)\{1\}.*/\2/; \
  209. s/[ \t]*$$//g;s/$$/" },/;s/\("\)sys_/\1/g'; \
  210. echo "};"; \
  211. echo ""; \
  212. echo "#define NUM_SYSCALL_INFO_ENTRIES ARRAY_SIZE(syscall_info_table)";\
  213. echo ""; \
  214. echo "#endif /* __SYSCALLTAB_H */" )
  215. endef
  216. arch/sh/lib64/syscalltab.h: arch/sh/kernel/syscalls_64.S
  217. $(call filechk,gen-syscalltab)
  218. CLEAN_FILES += arch/sh/lib64/syscalltab.h \
  219. include/asm-sh/machtypes.h \
  220. include/asm-sh/cpu include/asm-sh/.cpu \
  221. include/asm-sh/mach include/asm-sh/.mach