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.
7 ifneq ($(strip $(PKG_CAT)),)
8 ifeq ($(PKG_CAT),unzip)
9 UNPACK=unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
11 UNPACK=$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) -
13 define Build/Prepare/Default
15 @if [ -d ./patches ]; then \
16 $(PATCH) $(PKG_BUILD_DIR) ./patches; \
22 $(call Build/Prepare/Default)
25 define Build/Configure/Default
26 @(cd $(PKG_BUILD_DIR)/$(3); \
29 CPPFLAGS="-I$(STAGING_DIR)/host/include" \
30 LDFLAGS="-L$(STAGING_DIR)/host/lib" \
32 --target=$(GNU_TARGET_NAME) \
33 --host=$(GNU_TARGET_NAME) \
34 --build=$(GNU_HOST_NAME) \
41 --libexecdir=/usr/lib \
43 --datadir=/usr/share \
44 --localstatedir=/var \
53 define Build/Configure
54 $(call Build/Configure/Default)
57 define Build/Compile/Default
58 $(MAKE) -C $(PKG_BUILD_DIR) $(1)
62 $(call Build/Compile/Default)
66 ifneq ($(strip $(PKG_SOURCE)),)
67 download: $(DL_DIR)/$(PKG_SOURCE)
69 $(DL_DIR)/$(PKG_SOURCE):
71 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
73 $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
77 $(PKG_BUILD_DIR)/.prepared:
78 @-rm -rf $(PKG_BUILD_DIR)
79 @mkdir -p $(PKG_BUILD_DIR)
83 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
84 $(call Build/Configure)
87 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured
91 $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed: $(PKG_BUILD_DIR)/.built
96 install-targets: $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
101 $(call Build/Uninstall)
102 rm -f $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
105 prepare: $(PKG_BUILD_DIR)/.prepared
106 configure: $(PKG_BUILD_DIR)/.configured
108 compile-targets: $(PKG_BUILD_DIR)/.built
109 compile: compile-targets
112 install: install-targets
116 @$(MAKE) clean-targets
118 rm -rf $(PKG_BUILD_DIR)