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
10 ifneq ($(strip $(PKG_CAT)),)
11 ifeq ($(PKG_CAT),unzip)
12 UNPACK=unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
14 UNPACK=$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) -
16 define Build/Prepare/Default
18 @if [ -d ./patches ]; then \
19 $(PATCH) $(PKG_BUILD_DIR) ./patches; \
25 $(call Build/Prepare/Default)
28 define Build/Configure/Default
29 @(cd $(PKG_BUILD_DIR)/$(3); \
32 CPPFLAGS="-I$(STAGING_DIR)/host/include" \
33 LDFLAGS="-L$(STAGING_DIR)/host/lib" \
35 --target=$(GNU_TARGET_NAME) \
36 --host=$(GNU_TARGET_NAME) \
37 --build=$(GNU_HOST_NAME) \
44 --libexecdir=/usr/lib \
46 --datadir=/usr/share \
47 --localstatedir=/var \
56 define Build/Configure
57 $(call Build/Configure/Default)
60 define Build/Compile/Default
61 $(MAKE) -C $(PKG_BUILD_DIR) $(1)
65 $(call Build/Compile/Default)
69 ifneq ($(strip $(PKG_SOURCE)),)
70 download: $(DL_DIR)/$(PKG_SOURCE)
72 $(DL_DIR)/$(PKG_SOURCE):
74 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
76 $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
80 $(PKG_BUILD_DIR)/.prepared:
81 @-rm -rf $(PKG_BUILD_DIR)
82 @mkdir -p $(PKG_BUILD_DIR)
86 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
87 $(call Build/Configure)
90 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured
94 $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed: $(PKG_BUILD_DIR)/.built
99 install-targets: $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
104 $(call Build/Uninstall)
105 rm -f $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
108 prepare: $(PKG_BUILD_DIR)/.prepared
109 configure: $(PKG_BUILD_DIR)/.configured
111 compile-targets: $(PKG_BUILD_DIR)/.built
112 compile: compile-targets
115 install: install-targets
119 @$(MAKE) clean-targets
121 rm -rf $(PKG_BUILD_DIR)