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 ifneq ($(strip $(PKG_CAT)),)
9 ifeq ($(PKG_CAT),unzip)
10 UNPACK=unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
12 UNPACK=$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) -
14 define Build/Prepare/Default
16 @if [ -d ./patches ]; then \
17 $(PATCH) $(PKG_BUILD_DIR) ./patches; \
23 $(call Build/Prepare/Default)
26 define Build/Configure/Default
27 @(cd $(PKG_BUILD_DIR)/$(3); \
30 CPPFLAGS="-I$(STAGING_DIR)/host/include" \
31 LDFLAGS="-L$(STAGING_DIR)/host/lib" \
33 --target=$(GNU_TARGET_NAME) \
34 --host=$(GNU_TARGET_NAME) \
35 --build=$(GNU_HOST_NAME) \
42 --libexecdir=/usr/lib \
44 --datadir=/usr/share \
45 --localstatedir=/var \
54 define Build/Configure
55 $(call Build/Configure/Default)
58 define Build/Compile/Default
59 $(MAKE) -C $(PKG_BUILD_DIR) $(1)
63 $(call Build/Compile/Default)
67 ifneq ($(strip $(PKG_SOURCE)),)
68 download: $(DL_DIR)/$(PKG_SOURCE)
70 $(DL_DIR)/$(PKG_SOURCE):
72 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
74 $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
78 $(PKG_BUILD_DIR)/.prepared:
79 @-rm -rf $(PKG_BUILD_DIR)
80 @mkdir -p $(PKG_BUILD_DIR)
84 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
85 $(call Build/Configure)
88 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured
92 $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed: $(PKG_BUILD_DIR)/.built
97 install-targets: $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
102 $(call Build/Uninstall)
103 rm -f $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
106 prepare: $(PKG_BUILD_DIR)/.prepared
107 configure: $(PKG_BUILD_DIR)/.configured
109 compile-targets: $(PKG_BUILD_DIR)/.built
110 compile: compile-targets
113 install: install-targets
117 @$(MAKE) clean-targets
119 rm -rf $(PKG_BUILD_DIR)