host-build.mk 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. include $(INCLUDE_DIR)/depends.mk
  10. STAMP_PREPARED:=$(PKG_BUILD_DIR)/.prepared_$(shell find ${CURDIR} $(PKG_FILE_DEPEND) $(DEP_FINDPARAMS) | md5s)
  11. STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured
  12. STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
  13. include $(INCLUDE_DIR)/quilt.mk
  14. Build/Patch:=$(Build/Patch/Default)
  15. ifneq ($(strip $(PKG_UNPACK)),)
  16. define Build/Prepare/Default
  17. $(PKG_UNPACK)
  18. $(Build/Patch)
  19. endef
  20. endif
  21. define Build/Prepare
  22. $(call Build/Prepare/Default)
  23. endef
  24. define Build/Configure/Default
  25. @(cd $(PKG_BUILD_DIR)/$(3); \
  26. [ -x configure ] && \
  27. $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(PKG_BUILD_DIR)/$(3)/ && \
  28. $(2) \
  29. CPPFLAGS="-I$(STAGING_DIR)/host/include" \
  30. LDFLAGS="-L$(STAGING_DIR)/host/lib" \
  31. ./configure \
  32. --target=$(GNU_TARGET_NAME) \
  33. --host=$(GNU_TARGET_NAME) \
  34. --build=$(GNU_HOST_NAME) \
  35. --program-prefix="" \
  36. --program-suffix="" \
  37. --prefix=/usr \
  38. --exec-prefix=/usr \
  39. --bindir=/usr/bin \
  40. --sbindir=/usr/sbin \
  41. --libexecdir=/usr/lib \
  42. --sysconfdir=/etc \
  43. --datadir=/usr/share \
  44. --localstatedir=/var \
  45. --mandir=/usr/man \
  46. --infodir=/usr/info \
  47. $(DISABLE_NLS) \
  48. $(1); \
  49. true; \
  50. )
  51. endef
  52. define Build/Configure
  53. $(call Build/Configure/Default)
  54. endef
  55. define Build/Compile/Default
  56. $(MAKE) -C $(PKG_BUILD_DIR) $(1)
  57. endef
  58. define Build/Compile
  59. $(call Build/Compile/Default)
  60. endef
  61. ifneq ($(strip $(PKG_SOURCE)),)
  62. download: $(DL_DIR)/$(PKG_SOURCE)
  63. $(DL_DIR)/$(PKG_SOURCE):
  64. mkdir -p $(DL_DIR)
  65. $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
  66. $(STAMP_PREPARED): $(DL_DIR)/$(PKG_SOURCE)
  67. endif
  68. ifneq ($(CONFIG_AUTOREBUILD),)
  69. define HostBuild/Autoclean
  70. $(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
  71. $(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED))
  72. $(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),$(PKG_BUILD_DIR)/.dep_files, -and -not -path "/.*" -and -not -path "*/ipkg*")
  73. endef
  74. endif
  75. define HostBuild
  76. ifeq ($(DUMP),)
  77. $(call HostBuild/Autoclean)
  78. endif
  79. $(STAMP_PREPARED):
  80. @-rm -rf $(PKG_BUILD_DIR)
  81. @mkdir -p $(PKG_BUILD_DIR)
  82. $(call Build/Prepare)
  83. touch $$@
  84. $(STAMP_CONFIGURED): $(STAMP_PREPARED)
  85. $(call Build/Configure)
  86. touch $$@
  87. $(STAMP_BUILT): $(STAMP_CONFIGURED)
  88. $(call Build/Compile)
  89. @$(NO_TRACE_MAKE) $(PKG_BUILD_DIR)/.dep_files
  90. touch $$@
  91. $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed: $(STAMP_BUILT)
  92. $(call Build/Install)
  93. mkdir -p $$(shell dirname $$@)
  94. touch $$@
  95. ifdef Build/Install
  96. install: $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
  97. endif
  98. package-clean: FORCE
  99. $(call Build/Clean)
  100. $(call Build/Uninstall)
  101. rm -f $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
  102. download:
  103. prepare: $(STAMP_PREPARED)
  104. configure: $(STAMP_CONFIGURED)
  105. compile: $(STAMP_BUILT)
  106. install:
  107. clean: FORCE
  108. $(call Build/Clean)
  109. rm -rf $(PKG_BUILD_DIR)
  110. endef