2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(INCLUDE_DIR)/host.mk
9 include $(INCLUDE_DIR)/unpack.mk
11 ifneq ($(strip $(PKG_UNPACK)),)
12 define Build/Prepare/Default
14 @if [ -d ./patches ]; then \
15 $(PATCH) $(PKG_BUILD_DIR) ./patches; \
21 $(call Build/Prepare/Default)
24 define Build/Configure/Default
25 @(cd $(PKG_BUILD_DIR)/$(3); \
28 CPPFLAGS="-I$(STAGING_DIR)/host/include" \
29 LDFLAGS="-L$(STAGING_DIR)/host/lib" \
31 --target=$(GNU_TARGET_NAME) \
32 --host=$(GNU_TARGET_NAME) \
33 --build=$(GNU_HOST_NAME) \
40 --libexecdir=/usr/lib \
42 --datadir=/usr/share \
43 --localstatedir=/var \
52 define Build/Configure
53 $(call Build/Configure/Default)
56 define Build/Compile/Default
57 $(MAKE) -C $(PKG_BUILD_DIR) $(1)
61 $(call Build/Compile/Default)
65 ifneq ($(strip $(PKG_SOURCE)),)
66 download: $(DL_DIR)/$(PKG_SOURCE)
68 $(DL_DIR)/$(PKG_SOURCE):
70 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
72 $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
77 ifeq ($(CONFIG_AUTOREBUILD),y)
78 ifneq ($$(shell $(SCRIPT_DIR)/timestamp.pl -p $(PKG_BUILD_DIR) . $(PKG_FILE_DEPEND)),$(PKG_BUILD_DIR))
79 $$(info Forcing package rebuild)
80 $(PKG_BUILD_DIR)/.prepared: package-clean
85 $(PKG_BUILD_DIR)/.prepared:
86 @-rm -rf $(PKG_BUILD_DIR)
87 @mkdir -p $(PKG_BUILD_DIR)
91 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
92 $(call Build/Configure)
95 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured
99 $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed: $(PKG_BUILD_DIR)/.built
100 $(call Build/Install)
101 mkdir -p $$(shell dirname $$@)
105 install: $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
110 $(call Build/Uninstall)
111 rm -f $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
114 prepare: $(PKG_BUILD_DIR)/.prepared
115 configure: $(PKG_BUILD_DIR)/.configured
116 compile: $(PKG_BUILD_DIR)/.built
120 rm -rf $(PKG_BUILD_DIR)