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)/depends.mk
17 include $(INCLUDE_DIR)/package-defaults.mk
18 include $(INCLUDE_DIR)/package-dumpinfo.mk
19 include $(INCLUDE_DIR)/package-ipkg.mk
21 STAMP_PREPARED:=$(PKG_BUILD_DIR)/.prepared$(if $(DUMP),,_$(shell find ${CURDIR} $(PKG_FILE_DEPEND) $(DEP_FINDPARAMS) | md5s))
22 STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured
23 STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
24 export CONFIG_SITE:=$(INCLUDE_DIR)/site/$(REAL_GNU_TARGET_NAME)
26 ifneq ($(CONFIG_AUTOREBUILD),)
27 define Build/Autoclean
28 $(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
29 $(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED))
30 $(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),$(PKG_BUILD_DIR)/.dep_files, -and -not -path "/.*" -and -not -path "*/ipkg*")
34 define Build/DefaultTargets
35 ifneq ($(strip $(PKG_SOURCE_URL)),)
36 download: $(DL_DIR)/$(PKG_SOURCE)
38 $(DL_DIR)/$(PKG_SOURCE):
40 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
42 $(STAMP_PREPARED): $(DL_DIR)/$(PKG_SOURCE)
45 $(call Build/Autoclean)
48 @-rm -rf $(PKG_BUILD_DIR)
49 @mkdir -p $(PKG_BUILD_DIR)
53 $(STAMP_CONFIGURED): $(STAMP_PREPARED)
57 $(STAMP_BUILT): $(STAMP_CONFIGURED)
59 @$(NO_TRACE_MAKE) $(PKG_BUILD_DIR)/.dep_files
62 ifdef Build/InstallDev
63 compile: $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed
64 $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed: $(STAMP_BUILT)
65 mkdir -p $(STAGING_DIR)/stampfiles
70 define Build/DefaultTargets
75 $(eval $(Package/Default))
76 $(eval $(Package/$(1)))
78 # <HACK> Support obsolete DESCRIPTION field
79 ifndef Package/$(1)/description
80 define Package/$(1)/description
87 $(foreach FIELD, TITLE CATEGORY PRIORITY SECTION VERSION,
89 $$(error Package/$(1) is missing the $(FIELD) field)
93 $(call shexport,Package/$(1)/description)
94 $(call shexport,Package/$(1)/config)
101 $(call Build/Prepare/Default,)
104 define Build/Configure
105 $(call Build/Configure/Default,)
109 $(call Build/Compile/Default,)
117 prepare: $(STAMP_PREPARED)
118 configure: $(STAMP_CONFIGURED)
122 $(Build/UninstallDev)
124 @rm -f $(STAGING_DIR)/stampfiles/.$(PKG_NAME)-installed
125 @rm -rf $(PKG_BUILD_DIR)