Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. ###############################################################################
  2. #
  3. # MN10300 Kernel makefile system specifications
  4. #
  5. # Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
  6. # Modified by David Howells (dhowells@redhat.com)
  7. #
  8. # This program is free software; you can redistribute it and/or
  9. # modify it under the terms of the GNU General Public Licence
  10. # as published by the Free Software Foundation; either version
  11. # 2 of the Licence, or (at your option) any later version.
  12. #
  13. ###############################################################################
  14. KBUILD_DEFCONFIG := asb2303_defconfig
  15. CCSPECS := $(shell $(CC) -v 2>&1 | grep "^Reading specs from " | head -1 | cut -c20-)
  16. CCDIR := $(strip $(patsubst %/specs,%,$(CCSPECS)))
  17. KBUILD_CPPFLAGS += -nostdinc -I$(CCDIR)/include
  18. LDFLAGS :=
  19. OBJCOPYFLAGS := -O binary -R .note -R .comment -S
  20. #LDFLAGS_vmlinux := -Map linkmap.txt
  21. CHECKFLAGS +=
  22. PROCESSOR := unset
  23. UNIT := unset
  24. KBUILD_CFLAGS += -mam33 -mmem-funcs -DCPU=AM33
  25. KBUILD_AFLAGS += -mam33 -DCPU=AM33
  26. ifeq ($(CONFIG_MN10300_CURRENT_IN_E2),y)
  27. KBUILD_CFLAGS += -ffixed-e2 -fcall-saved-e5
  28. endif
  29. ifeq ($(CONFIG_MN10300_PROC_MN103E010),y)
  30. PROCESSOR := mn103e010
  31. endif
  32. ifeq ($(CONFIG_MN10300_UNIT_ASB2303),y)
  33. UNIT := asb2303
  34. endif
  35. ifeq ($(CONFIG_MN10300_UNIT_ASB2305),y)
  36. UNIT := asb2305
  37. endif
  38. head-y := arch/mn10300/kernel/head.o arch/mn10300/kernel/init_task.o
  39. core-y += arch/mn10300/kernel/ arch/mn10300/mm/
  40. ifneq ($(PROCESSOR),unset)
  41. core-y += arch/mn10300/proc-$(PROCESSOR)/
  42. endif
  43. ifneq ($(UNIT),unset)
  44. core-y += arch/mn10300/unit-$(UNIT)/
  45. endif
  46. libs-y += arch/mn10300/lib/
  47. drivers-$(CONFIG_OPROFILE) += arch/mn10300/oprofile/
  48. boot := arch/mn10300/boot
  49. .PHONY: zImage
  50. KBUILD_IMAGE := $(boot)/zImage
  51. CLEAN_FILES += $(boot)/zImage
  52. CLEAN_FILES += $(boot)/compressed/vmlinux
  53. CLEAN_FILES += $(boot)/compressed/vmlinux.bin
  54. CLEAN_FILES += $(boot)/compressed/vmlinux.bin.gz
  55. zImage: vmlinux
  56. $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
  57. all: zImage
  58. bootstrap:
  59. $(Q)$(MAKEBOOT) bootstrap
  60. archclean:
  61. $(Q)$(MAKE) $(clean)=arch/mn10300/proc-mn103e010
  62. $(Q)$(MAKE) $(clean)=arch/mn10300/unit-asb2303
  63. $(Q)$(MAKE) $(clean)=arch/mn10300/unit-asb2305
  64. define archhelp
  65. echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
  66. endef
  67. # If you make sure the .S files get compiled with debug info,
  68. # uncomment the following to disable optimisations
  69. # that are unhelpful whilst debugging.
  70. ifdef CONFIG_DEBUG_INFO
  71. #KBUILD_CFLAGS += -O1
  72. KBUILD_AFLAGS += -Wa,--gdwarf2
  73. endif
  74. ###################################################################################################
  75. #
  76. # juggle some symlinks in the MN10300 asm include dir
  77. #
  78. # Update machine proc and unit symlinks if something which affects
  79. # them changed. We use .proc / .unit to indicate when they were
  80. # updated last, otherwise make uses the target directory mtime.
  81. #
  82. ###################################################################################################
  83. # processor specific definitions
  84. include/asm-mn10300/.proc: $(wildcard include/config/proc/*.h) include/config/auto.conf
  85. @echo ' SYMLINK include/asm-mn10300/proc -> include/asm-mn10300/proc-$(PROCESSOR)'
  86. ifneq ($(KBUILD_SRC),)
  87. $(Q)mkdir -p include/asm-mn10300
  88. $(Q)ln -fsn $(srctree)/include/asm-mn10300/proc-$(PROCESSOR) include/asm-mn10300/proc
  89. else
  90. $(Q)ln -fsn proc-$(PROCESSOR) include/asm-mn10300/proc
  91. endif
  92. @touch $@
  93. CLEAN_FILES += include/asm-mn10300/proc include/asm-mn10300/.proc
  94. prepare: include/asm-mn10300/.proc
  95. # unit specific definitions
  96. include/asm-mn10300/.unit: $(wildcard include/config/unit/*.h) include/config/auto.conf
  97. @echo ' SYMLINK include/asm-mn10300/unit -> include/asm-mn10300/unit-$(UNIT)'
  98. ifneq ($(KBUILD_SRC),)
  99. $(Q)mkdir -p include/asm-mn10300
  100. $(Q)ln -fsn $(srctree)/include/asm-mn10300/unit-$(UNIT) include/asm-mn10300/unit
  101. else
  102. $(Q)ln -fsn unit-$(UNIT) include/asm-mn10300/unit
  103. endif
  104. @touch $@
  105. CLEAN_FILES += include/asm-mn10300/unit include/asm-mn10300/.unit
  106. prepare: include/asm-mn10300/.unit