2 # Copyright (C) 2006,2007 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 all: $(if $(DUMP),dumpinfo,compile)
10 PKG_BUILD_DIR ?= $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
11 PKG_INSTALL_DIR ?= $(PKG_BUILD_DIR)/ipkg-install
13 include $(INCLUDE_DIR)/prereq.mk
14 include $(INCLUDE_DIR)/host.mk
15 include $(INCLUDE_DIR)/unpack.mk
16 include $(INCLUDE_DIR)/package-defaults.mk
17 include $(INCLUDE_DIR)/package-dumpinfo.mk
18 include $(INCLUDE_DIR)/package-ipkg.mk
20 STAMP_PREPARED:=$(PKG_BUILD_DIR)/.prepared
21 STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured
22 STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
23 export CONFIG_SITE:=$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)
25 define Build/DefaultTargets
26 ifneq ($(strip $(PKG_SOURCE_URL)),)
27 download: $(DL_DIR)/$(PKG_SOURCE)
29 $(DL_DIR)/$(PKG_SOURCE):
31 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
33 $(STAMP_PREPARED): $(DL_DIR)/$(PKG_SOURCE)
37 ifeq ($(CONFIG_AUTOREBUILD),y)
38 ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p $(PKG_BUILD_DIR) . $(PKG_FILE_DEPEND)),$(PKG_BUILD_DIR))
39 $$(info Forcing package rebuild)
40 $(STAMP_PREPARED): clean
46 @-rm -rf $(PKG_BUILD_DIR)
47 @mkdir -p $(PKG_BUILD_DIR)
51 $(STAMP_CONFIGURED): $(STAMP_PREPARED)
55 $(STAMP_BUILT): $(STAMP_CONFIGURED)
59 ifdef Build/InstallDev
60 ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p -x ipkg -x ipkg-install $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed $(PKG_BUILD_DIR)),$(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed)
61 $(STAMP_BUILT): package-rebuild
64 compile: $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed
65 $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed: $(STAMP_BUILT)
66 mkdir -p $(STAGING_DIR)/stampfiles
71 package-rebuild: FORCE
72 @-rm -f $(STAMP_BUILT)
74 define Build/DefaultTargets
79 $(eval $(Package/Default))
80 $(eval $(Package/$(1)))
82 # <HACK> Support obsolete DESCRIPTION field
83 ifndef Package/$(1)/description
84 define Package/$(1)/description
91 $(foreach FIELD, TITLE CATEGORY PRIORITY SECTION VERSION,
93 $$(error Package/$(1) is missing the $(FIELD) field)
97 $(call shexport,Package/$(1)/description)
98 $(call shexport,Package/$(1)/config)
105 $(call Build/Prepare/Default,)
108 define Build/Configure
109 $(call Build/Configure/Default,)
113 $(call Build/Compile/Default,)
121 prepare: $(STAMP_PREPARED)
122 configure: $(STAMP_CONFIGURED)
126 $(Build/UninstallDev)
128 @rm -f $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed
129 @rm -rf $(PKG_BUILD_DIR)