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 $(TOPDIR)/.host.mk
10 $(TOPDIR)/.host.mk: $(INCLUDE_DIR)/host-build.mk
11 echo "HOST_OS:=`uname`" > $@
13 $(HOSTCC) -dumpmachine | sed -e s'/-.*//' \
14 -e 's/sparc.*/sparc/' \
20 -e 's/mips-.*/mips/' \
21 -e 's/mipsel-.*/mipsel/' \
23 -e 's/i[3-9]86/i386/'`" >> $@
24 echo "GNU_HOST_NAME:=`$(HOSTCC) -dumpmachine`" >> $@
27 ifneq ($(strip $(PKG_CAT)),)
28 ifeq ($(PKG_CAT),unzip)
29 UNPACK=unzip -d $(PKG_BUILD_DIR) $(DL_DIR)/$(PKG_SOURCE)
31 UNPACK=$(PKG_CAT) $(DL_DIR)/$(PKG_SOURCE) | tar -C $(PKG_BUILD_DIR)/.. $(TAR_OPTIONS) -
33 define Build/Prepare/Default
35 @if [ -d ./patches ]; then \
36 $(PATCH) $(PKG_BUILD_DIR) ./patches; \
42 $(call Build/Prepare/Default)
45 define Build/Configure/Default
46 @(cd $(PKG_BUILD_DIR)/$(3); \
49 CPPFLAGS="-I$(STAGING_DIR)/host/include" \
50 LDFLAGS="-L$(STAGING_DIR)/host/lib" \
52 --target=$(GNU_TARGET_NAME) \
53 --host=$(GNU_TARGET_NAME) \
54 --build=$(GNU_HOST_NAME) \
61 --libexecdir=/usr/lib \
63 --datadir=/usr/share \
64 --localstatedir=/var \
73 define Build/Configure
74 $(call Build/Configure/Default)
77 define Build/Compile/Default
78 $(MAKE) -C $(PKG_BUILD_DIR) $(1)
82 $(call Build/Compile/Default)
86 ifneq ($(strip $(PKG_SOURCE)),)
87 download: $(DL_DIR)/$(PKG_SOURCE)
89 $(DL_DIR)/$(PKG_SOURCE):
91 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
93 $(PKG_BUILD_DIR)/.prepared: $(DL_DIR)/$(PKG_SOURCE)
97 $(PKG_BUILD_DIR)/.prepared:
98 @-rm -rf $(PKG_BUILD_DIR)
99 @mkdir -p $(PKG_BUILD_DIR)
100 $(call Build/Prepare)
103 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.prepared
104 $(call Build/Configure)
107 $(PKG_BUILD_DIR)/.built: $(PKG_BUILD_DIR)/.configured
108 $(call Build/Compile)
111 $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed: $(PKG_BUILD_DIR)/.built
112 $(call Build/Install)
116 install-targets: $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
121 $(call Build/Uninstall)
122 rm -f $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
125 prepare: $(PKG_BUILD_DIR)/.prepared
126 configure: $(PKG_BUILD_DIR)/.configured
128 compile-targets: $(PKG_BUILD_DIR)/.built
129 compile: compile-targets
132 install: install-targets
136 @$(MAKE) clean-targets
138 rm -rf $(PKG_BUILD_DIR)