host-build.mk 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #
  2. # Copyright (C) 2006 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 $(INCLUDE_DIR)/host.mk
  8. include $(INCLUDE_DIR)/unpack.mk
  9. ifneq ($(strip $(PKG_UNPACK)),)
  10. define Build/Prepare/Default
  11. $(PKG_UNPACK)
  12. @if [ -d ./patches ]; then \
  13. $(PATCH) $(PKG_BUILD_DIR) ./patches; \
  14. fi
  15. endef
  16. endif
  17. define Build/Prepare
  18. $(call Build/Prepare/Default)
  19. endef
  20. define Build/Configure/Default
  21. @(cd $(PKG_BUILD_DIR)/$(3); \
  22. [ -x configure ] && \
  23. $(2) \
  24. CPPFLAGS="-I$(STAGING_DIR)/host/include" \
  25. LDFLAGS="-L$(STAGING_DIR)/host/lib" \
  26. ./configure \
  27. --target=$(GNU_TARGET_NAME) \
  28. --host=$(GNU_TARGET_NAME) \
  29. --build=$(GNU_HOST_NAME) \
  30. --program-prefix="" \
  31. --program-suffix="" \
  32. --prefix=/usr \
  33. --exec-prefix=/usr \
  34. --bindir=/usr/bin \
  35. --sbindir=/usr/sbin \
  36. --libexecdir=/usr/lib \
  37. --sysconfdir=/etc \
  38. --datadir=/usr/share \
  39. --localstatedir=/var \
  40. --mandir=/usr/man \
  41. --infodir=/usr/info \
  42. $(DISABLE_NLS) \
  43. $(1); \
  44. true; \
  45. )
  46. endef
  47. define Build/Configure
  48. $(call Build/Configure/Default)
  49. endef
  50. define Build/Compile/Default
  51. $(MAKE) -C $(PKG_BUILD_DIR) $(1)
  52. endef
  53. define Build/Compile
  54. $(call Build/Compile/Default)
  55. endef
  56. ifneq ($(strip $(PKG_SOURCE)),)
  57. download: $(DL_DIR)/$(PKG_SOURCE)
  58. $(DL_DIR)/$(PKG_SOURCE):
  59. mkdir -p $(DL_DIR)
  60. $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
  61. $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
  62. endif
  63. define HostBuild
  64. $(PKG_BUILD_DIR)/.prepared:
  65. @-rm -rf $(PKG_BUILD_DIR)
  66. @mkdir -p $(PKG_BUILD_DIR)
  67. $(call Build/Prepare)
  68. touch $$@
  69. $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
  70. $(call Build/Configure)
  71. touch $$@
  72. $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured
  73. $(call Build/Compile)
  74. touch $$@
  75. $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed: $(PKG_BUILD_DIR)/.built
  76. $(call Build/Install)
  77. touch $$@
  78. ifdef Build/Install
  79. install-targets: $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
  80. endif
  81. package-clean: FORCE
  82. $(call Build/Clean)
  83. $(call Build/Uninstall)
  84. rm -f $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
  85. download:
  86. prepare: $(PKG_BUILD_DIR)/.prepared
  87. configure: $(PKG_BUILD_DIR)/.configured
  88. compile-targets: $(PKG_BUILD_DIR)/.built
  89. compile: compile-targets
  90. install-targets:
  91. install: install-targets
  92. clean-targets:
  93. clean: FORCE
  94. @$(MAKE) clean-targets
  95. $(call Build/Clean)
  96. rm -rf $(PKG_BUILD_DIR)
  97. endef