Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. #
  2. # Copyright (C) 2006-2009 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. KERNEL_BUILD_DIR := $(BUILD_DIR_TOOLCHAIN)
  9. BUILD_DIR := $(KERNEL_BUILD_DIR)
  10. override QUILT:=
  11. override HOST_QUILT:=
  12. include $(INCLUDE_DIR)/kernel.mk
  13. PKG_NAME:=linux
  14. PKG_VERSION:=$(LINUX_VERSION)
  15. PKG_SOURCE:=$(LINUX_SOURCE)
  16. PKG_SOURCE_URL:=$(LINUX_SITE)
  17. HOST_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
  18. PKG_HASH:=$(LINUX_KERNEL_HASH)
  19. LINUX_DIR := $(HOST_BUILD_DIR)
  20. FILES_DIR :=
  21. PATCH_DIR := ./patches$(if $(wildcard ./patches-$(LINUX_VERSION)),-$(LINUX_VERSION))
  22. include $(INCLUDE_DIR)/toolchain-build.mk
  23. include $(INCLUDE_DIR)/kernel-defaults.mk
  24. ifeq ($(strip $(BOARD)),uml)
  25. LINUX_KARCH:=$(subst x86_64,x86,$(subst i386,x86,$(ARCH)))
  26. endif
  27. HOST_EXTRACFLAGS=
  28. LINUX_HAS_HEADERS_INSTALL:=y
  29. KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
  30. HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
  31. ARCH=$(LINUX_KARCH) \
  32. CC="$(KERNEL_CC)" \
  33. CFLAGS="$(TARGET_CFLAGS)" \
  34. CROSS_COMPILE=$(TARGET_CROSS) \
  35. KBUILD_HAVE_NLS=no \
  36. CONFIG_SHELL=$(BASH)
  37. define Host/Configure/all
  38. mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev
  39. $(KMAKE) \
  40. INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
  41. headers_install
  42. endef
  43. # XXX: the following is needed to build lzma-loader
  44. ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
  45. define Host/Configure/lzma
  46. $(CP) \
  47. $(HOST_BUILD_DIR)/arch/mips/include/asm/asm.h \
  48. $(HOST_BUILD_DIR)/arch/mips/include/asm/regdef.h \
  49. $(HOST_BUILD_DIR)/arch/mips/include/asm/asm-eva.h \
  50. $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
  51. endef
  52. endif
  53. define Host/Configure/post/mips
  54. $(call Host/Configure/lzma)
  55. endef
  56. define Host/Configure/post/mipsel
  57. $(call Host/Configure/lzma)
  58. endef
  59. define Host/Prepare
  60. $(call Kernel/Prepare/Default)
  61. rm -f $(BUILD_DIR_TOOLCHAIN)/linux
  62. ln -s linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
  63. $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
  64. endef
  65. define Host/Configure
  66. env
  67. yes '' | $(KMAKE) oldconfig
  68. $(call Host/Configure/all)
  69. $(call Host/Configure/post/$(ARCH))
  70. endef
  71. define Host/Compile
  72. endef
  73. define Host/Install
  74. $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
  75. endef
  76. define Host/Clean
  77. rm -rf \
  78. $(HOST_BUILD_DIR) \
  79. $(BUILD_DIR_TOOLCHAIN)/linux \
  80. $(BUILD_DIR_TOOLCHAIN)/linux-dev
  81. endef
  82. $(eval $(call HostBuild))