Makefile 7.2 KB

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