Makefile 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. # $Id: Makefile,v 1.35 2004/04/15 03:39:20 sugioka Exp $
  2. #
  3. # This file is subject to the terms and conditions of the GNU General Public
  4. # License. See the file "COPYING" in the main directory of this archive
  5. # for more details.
  6. #
  7. # Copyright (C) 1999 Kaz Kojima
  8. # Copyright (C) 2002, 2003, 2004 Paul Mundt
  9. # Copyright (C) 2002 M. R. Brown
  10. #
  11. # This file is included by the global makefile so that you can add your own
  12. # architecture-specific flags and dependencies. Remember to do have actions
  13. # for "archclean" and "archdep" for cleaning up and making dependencies for
  14. # this architecture
  15. #
  16. isa-y := any
  17. isa-$(CONFIG_SH_DSP) := sh
  18. isa-$(CONFIG_CPU_SH2) := sh2
  19. isa-$(CONFIG_CPU_SH2A) := sh2a
  20. isa-$(CONFIG_CPU_SH3) := sh3
  21. isa-$(CONFIG_CPU_SH4) := sh4
  22. isa-$(CONFIG_CPU_SH4A) := sh4a
  23. isa-$(CONFIG_CPU_SH4AL_DSP) := sh4al
  24. isa-$(CONFIG_CPU_SH5) := shmedia
  25. isa-$(CONFIG_SH_DSP) := $(isa-y)-dsp
  26. ifndef CONFIG_MMU
  27. isa-y := $(isa-y)-nommu
  28. endif
  29. ifndef CONFIG_SH_DSP
  30. ifndef CONFIG_SH_FPU
  31. isa-y := $(isa-y)-nofpu
  32. endif
  33. endif
  34. isa-y := $(isa-y)-up
  35. cflags-$(CONFIG_CPU_SH2) := $(call cc-option,-m2,)
  36. cflags-$(CONFIG_CPU_SH2A) += $(call cc-option,-m2a,) \
  37. $(call cc-option,-m2a-nofpu,)
  38. cflags-$(CONFIG_CPU_SH3) := $(call cc-option,-m3,)
  39. cflags-$(CONFIG_CPU_SH4) := $(call cc-option,-m4,) \
  40. $(call cc-option,-mno-implicit-fp,-m4-nofpu)
  41. cflags-$(CONFIG_CPU_SH4A) += $(call cc-option,-m4a,) \
  42. $(call cc-option,-m4a-nofpu,)
  43. cflags-$(CONFIG_CPU_SH5) := $(call cc-option,-m5-32media-nofpu,)
  44. cflags-$(CONFIG_CPU_BIG_ENDIAN) += -mb
  45. cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -ml
  46. #
  47. # -Wa,-isa= tuning implies -Wa,-dsp for the versions of binutils that
  48. # support it, while -Wa,-dsp by itself limits the range of usable opcodes
  49. # on certain CPU subtypes. Try the ISA variant first, and if that fails,
  50. # fall back on -Wa,-dsp for the old binutils versions. Even without DSP
  51. # opcodes, we always want the best ISA tuning the version of binutils
  52. # will provide.
  53. #
  54. isaflags-y := $(call as-option,-Wa$(comma)-isa=$(isa-y),)
  55. isaflags-$(CONFIG_SH_DSP) := \
  56. $(call as-option,-Wa$(comma)-isa=$(isa-y),-Wa$(comma)-dsp)
  57. cflags-y += $(isaflags-y) -ffreestanding
  58. cflags-$(CONFIG_MORE_COMPILE_OPTIONS) += \
  59. $(shell echo $(CONFIG_COMPILE_OPTIONS) | sed -e 's/"//g')
  60. OBJCOPYFLAGS := -O binary -R .note -R .note.gnu.build-id -R .comment -R .stab -R .stabstr -S
  61. #
  62. # arch/sh/defconfig doesn't reflect any real hardware, and as such should
  63. # never be used by anyone. Use a board-specific defconfig that has a
  64. # reasonable chance of being current instead.
  65. #
  66. KBUILD_DEFCONFIG := r7780rp_defconfig
  67. KBUILD_IMAGE := arch/sh/boot/zImage
  68. #
  69. # Choosing incompatible machines durings configuration will result in
  70. # error messages during linking.
  71. #
  72. ifdef CONFIG_SUPERH32
  73. LDFLAGS_vmlinux += -e _stext
  74. else
  75. LDFLAGS_vmlinux += --defsym phys_stext=_stext-$(CONFIG_PAGE_OFFSET) \
  76. --defsym phys_stext_shmedia=phys_stext+1 \
  77. -e phys_stext_shmedia
  78. endif
  79. ifdef CONFIG_CPU_LITTLE_ENDIAN
  80. LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64'
  81. LDFLAGS += -EL
  82. else
  83. LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64+4'
  84. LDFLAGS += -EB
  85. endif
  86. KBUILD_CFLAGS += -pipe $(cflags-y)
  87. KBUILD_AFLAGS += $(cflags-y)
  88. head-y := arch/sh/kernel/init_task.o
  89. head-$(CONFIG_SUPERH32) += arch/sh/kernel/head_32.o
  90. head-$(CONFIG_SUPERH64) += arch/sh/kernel/head_64.o
  91. LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
  92. core-y += arch/sh/kernel/ arch/sh/mm/
  93. core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/
  94. # Boards
  95. machdir-$(CONFIG_SH_SOLUTION_ENGINE) += se/770x
  96. machdir-$(CONFIG_SH_7722_SOLUTION_ENGINE) += se/7722
  97. machdir-$(CONFIG_SH_7751_SOLUTION_ENGINE) += se/7751
  98. machdir-$(CONFIG_SH_7780_SOLUTION_ENGINE) += se/7780
  99. machdir-$(CONFIG_SH_7343_SOLUTION_ENGINE) += se/7343
  100. machdir-$(CONFIG_SH_HP6XX) += hp6xx
  101. machdir-$(CONFIG_SH_DREAMCAST) += dreamcast
  102. machdir-$(CONFIG_SH_MPC1211) += mpc1211
  103. machdir-$(CONFIG_SH_SH03) += sh03
  104. machdir-$(CONFIG_SH_SECUREEDGE5410) += snapgear
  105. machdir-$(CONFIG_SH_HS7751RVOIP) += renesas/hs7751rvoip
  106. machdir-$(CONFIG_SH_RTS7751R2D) += renesas/rts7751r2d
  107. machdir-$(CONFIG_SH_7751_SYSTEMH) += renesas/systemh
  108. machdir-$(CONFIG_SH_EDOSK7705) += renesas/edosk7705
  109. machdir-$(CONFIG_SH_HIGHLANDER) += renesas/r7780rp
  110. machdir-$(CONFIG_SH_7710VOIPGW) += renesas/sh7710voipgw
  111. machdir-$(CONFIG_SH_X3PROTO) += renesas/x3proto
  112. machdir-$(CONFIG_SH_SH4202_MICRODEV) += superh/microdev
  113. machdir-$(CONFIG_SH_LANDISK) += landisk
  114. machdir-$(CONFIG_SH_TITAN) += titan
  115. machdir-$(CONFIG_SH_SHMIN) += shmin
  116. machdir-$(CONFIG_SH_7206_SOLUTION_ENGINE) += se/7206
  117. machdir-$(CONFIG_SH_7619_SOLUTION_ENGINE) += se/7619
  118. machdir-$(CONFIG_SH_LBOX_RE2) += lboxre2
  119. machdir-$(CONFIG_SH_MAGIC_PANEL_R2) += magicpanelr2
  120. incdir-y := $(notdir $(machdir-y))
  121. ifneq ($(machdir-y),)
  122. core-y += $(addprefix arch/sh/boards/, \
  123. $(filter-out ., $(patsubst %,%/,$(machdir-y))))
  124. endif
  125. # Companion chips
  126. core-$(CONFIG_HD6446X_SERIES) += arch/sh/cchips/hd6446x/
  127. core-$(CONFIG_MFD_SM501) += arch/sh/cchips/voyagergx/
  128. cpuincdir-$(CONFIG_CPU_SH2) := cpu-sh2
  129. cpuincdir-$(CONFIG_CPU_SH2A) := cpu-sh2a
  130. cpuincdir-$(CONFIG_CPU_SH3) := cpu-sh3
  131. cpuincdir-$(CONFIG_CPU_SH4) := cpu-sh4
  132. cpuincdir-$(CONFIG_CPU_SH5) := cpu-sh5
  133. libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y)
  134. libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y)
  135. libs-y += $(LIBGCC)
  136. drivers-y += arch/sh/drivers/
  137. drivers-$(CONFIG_OPROFILE) += arch/sh/oprofile/
  138. boot := arch/sh/boot
  139. CPPFLAGS_vmlinux.lds := -traditional
  140. incdir-prefix := $(srctree)/include/asm-sh/
  141. # Update machine arch and proc symlinks if something which affects
  142. # them changed. We use .arch and .mach to indicate when they were
  143. # updated last, otherwise make uses the target directory mtime.
  144. include/asm-sh/.cpu: $(wildcard include/config/cpu/*.h) \
  145. include/config/auto.conf FORCE
  146. @echo ' SYMLINK include/asm-sh/cpu -> include/asm-sh/$(cpuincdir-y)'
  147. $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
  148. $(Q)ln -fsn $(incdir-prefix)$(cpuincdir-y) include/asm-sh/cpu
  149. @touch $@
  150. # Most boards have their own mach directories. For the ones that
  151. # don't, just reference the parent directory so the semantics are
  152. # kept roughly the same.
  153. #
  154. # When multiple boards are compiled in at the same time, preference
  155. # for the mach link is given to whichever has a directory for its
  156. # headers. However, this is only a workaround until platforms that
  157. # can live in the same kernel image back away from relying on the
  158. # mach link.
  159. include/asm-sh/.mach: $(wildcard include/config/sh/*.h) \
  160. include/config/auto.conf FORCE
  161. $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
  162. $(Q)rm -f include/asm-sh/mach
  163. $(Q)for i in $(incdir-y); do \
  164. if [ -d $(incdir-prefix)$$i ]; then \
  165. echo -n ' SYMLINK include/asm-sh/mach -> '; \
  166. echo -e "include/asm-sh/$$i"; \
  167. ln -fsn $(incdir-prefix)$$i \
  168. include/asm-sh/mach; \
  169. else \
  170. if [ ! -d include/asm-sh/mach ]; then \
  171. echo -n ' SYMLINK include/asm-sh/mach -> '; \
  172. echo -e 'include/asm-sh'; \
  173. ln -fsn $(incdir-prefix) include/asm-sh/mach; \
  174. fi; \
  175. fi; \
  176. done
  177. @touch $@
  178. archprepare: include/asm-sh/.cpu include/asm-sh/.mach maketools
  179. PHONY += maketools FORCE
  180. maketools: include/linux/version.h FORCE
  181. $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h
  182. all: zImage
  183. zImage uImage uImage.srec vmlinux.srec: vmlinux
  184. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  185. compressed: zImage
  186. archclean:
  187. $(Q)$(MAKE) $(clean)=$(boot)
  188. CLEAN_FILES += include/asm-sh/machtypes.h \
  189. include/asm-sh/cpu include/asm-sh/.cpu \
  190. include/asm-sh/mach include/asm-sh/.mach
  191. define archhelp
  192. @echo '* zImage - Compressed kernel image'
  193. @echo ' vmlinux.srec - Create an ELF S-record'
  194. @echo ' uImage - Create a bootable image for U-Boot'
  195. @echo ' uImage.srec - Create an S-record for U-Boot'
  196. endef