Makefile 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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 .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. CFLAGS += -pipe $(cflags-y)
  79. AFLAGS += $(cflags-y)
  80. head-y := arch/sh/kernel/head.o arch/sh/kernel/init_task.o
  81. LIBGCC := $(shell $(CC) $(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_SH4202_MICRODEV) += superh/microdev
  102. machdir-$(CONFIG_SH_LANDISK) += landisk
  103. machdir-$(CONFIG_SH_TITAN) += titan
  104. machdir-$(CONFIG_SH_SHMIN) += shmin
  105. machdir-$(CONFIG_SH_7206_SOLUTION_ENGINE) += se/7206
  106. machdir-$(CONFIG_SH_7619_SOLUTION_ENGINE) += se/7619
  107. machdir-$(CONFIG_SH_LBOX_RE2) += lboxre2
  108. incdir-y := $(notdir $(machdir-y))
  109. ifneq ($(machdir-y),)
  110. core-y += $(addprefix arch/sh/boards/, \
  111. $(filter-out ., $(patsubst %,%/,$(machdir-y))))
  112. endif
  113. # Companion chips
  114. core-$(CONFIG_HD6446X_SERIES) += arch/sh/cchips/hd6446x/
  115. core-$(CONFIG_VOYAGERGX) += arch/sh/cchips/voyagergx/
  116. cpuincdir-$(CONFIG_CPU_SH2) := cpu-sh2
  117. cpuincdir-$(CONFIG_CPU_SH2A) := cpu-sh2a
  118. cpuincdir-$(CONFIG_CPU_SH3) := cpu-sh3
  119. cpuincdir-$(CONFIG_CPU_SH4) := cpu-sh4
  120. libs-y := arch/sh/lib/ $(libs-y) $(LIBGCC)
  121. drivers-y += arch/sh/drivers/
  122. drivers-$(CONFIG_OPROFILE) += arch/sh/oprofile/
  123. boot := arch/sh/boot
  124. CPPFLAGS_vmlinux.lds := -traditional
  125. incdir-prefix := $(srctree)/include/asm-sh/
  126. # Update machine arch and proc symlinks if something which affects
  127. # them changed. We use .arch and .mach to indicate when they were
  128. # updated last, otherwise make uses the target directory mtime.
  129. include/asm-sh/.cpu: $(wildcard include/config/cpu/*.h) \
  130. include/config/auto.conf FORCE
  131. @echo ' SYMLINK include/asm-sh/cpu -> include/asm-sh/$(cpuincdir-y)'
  132. $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
  133. $(Q)ln -fsn $(incdir-prefix)$(cpuincdir-y) include/asm-sh/cpu
  134. @touch $@
  135. # Most boards have their own mach directories. For the ones that
  136. # don't, just reference the parent directory so the semantics are
  137. # kept roughly the same.
  138. #
  139. # When multiple boards are compiled in at the same time, preference
  140. # for the mach link is given to whichever has a directory for its
  141. # headers. However, this is only a workaround until platforms that
  142. # can live in the same kernel image back away from relying on the
  143. # mach link.
  144. include/asm-sh/.mach: $(wildcard include/config/sh/*.h) \
  145. include/config/auto.conf FORCE
  146. $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
  147. $(Q)rm -f include/asm-sh/mach
  148. $(Q)for i in $(incdir-y); do \
  149. if [ -d $(incdir-prefix)$$i ]; then \
  150. echo -n ' SYMLINK include/asm-sh/mach -> '; \
  151. echo -e "include/asm-sh/$$i"; \
  152. ln -fsn $(incdir-prefix)$$i \
  153. include/asm-sh/mach; \
  154. else \
  155. if [ ! -d include/asm-sh/mach ]; then \
  156. echo -n ' SYMLINK include/asm-sh/mach -> '; \
  157. echo -e 'include/asm-sh'; \
  158. ln -fsn $(incdir-prefix) include/asm-sh/mach; \
  159. fi; \
  160. fi; \
  161. done
  162. @touch $@
  163. archprepare: include/asm-sh/.cpu include/asm-sh/.mach maketools
  164. PHONY += maketools FORCE
  165. maketools: include/linux/version.h FORCE
  166. $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h
  167. all: zImage
  168. zImage uImage uImage.srec vmlinux.srec: vmlinux
  169. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  170. compressed: zImage
  171. archclean:
  172. $(Q)$(MAKE) $(clean)=$(boot)
  173. CLEAN_FILES += include/asm-sh/machtypes.h \
  174. include/asm-sh/cpu include/asm-sh/.cpu \
  175. include/asm-sh/mach include/asm-sh/.mach
  176. define archhelp
  177. @echo '* zImage - Compressed kernel image'
  178. @echo ' vmlinux.srec - Create an ELF S-record'
  179. @echo ' uImage - Create a bootable image for U-Boot'
  180. @echo ' uImage.srec - Create an S-record for U-Boot'
  181. endef