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
10 include $(INCLUDE_DIR)/depends.mk
12 STAMP_PREPARED:=$(PKG_BUILD_DIR)/.prepared_$(shell find ${CURDIR} $(PKG_FILE_DEPEND) $(DEP_FINDPARAMS) | md5s)
13 STAMP_CONFIGURED:=$(PKG_BUILD_DIR)/.configured
14 STAMP_BUILT:=$(PKG_BUILD_DIR)/.built
16 ifneq ($(strip $(PKG_UNPACK)),)
17 define Build/Prepare/Default
19 @if [ -d ./patches ]; then \
20 $(PATCH) $(PKG_BUILD_DIR) ./patches; \
26 $(call Build/Prepare/Default)
29 define Build/Configure/Default
30 @(cd $(PKG_BUILD_DIR)/$(3); \
33 CPPFLAGS="-I$(STAGING_DIR)/host/include" \
34 LDFLAGS="-L$(STAGING_DIR)/host/lib" \
36 --target=$(GNU_TARGET_NAME) \
37 --host=$(GNU_TARGET_NAME) \
38 --build=$(GNU_HOST_NAME) \
45 --libexecdir=/usr/lib \
47 --datadir=/usr/share \
48 --localstatedir=/var \
57 define Build/Configure
58 $(call Build/Configure/Default)
61 define Build/Compile/Default
62 $(MAKE) -C $(PKG_BUILD_DIR) $(1)
66 $(call Build/Compile/Default)
70 ifneq ($(strip $(PKG_SOURCE)),)
71 download: $(DL_DIR)/$(PKG_SOURCE)
73 $(DL_DIR)/$(PKG_SOURCE):
75 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
77 $(STAMP_PREPARED): $(DL_DIR)/$(PKG_SOURCE)
80 ifneq ($(CONFIG_AUTOREBUILD),)
81 define HostBuild/Autoclean
82 $(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
83 $(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED))
84 $(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),$(PKG_BUILD_DIR)/.dep_files, -and -not -path "/.*" -and -not -path "*/ipkg*")
90 $(call HostBuild/Autoclean)
94 @-rm -rf $(PKG_BUILD_DIR)
95 @mkdir -p $(PKG_BUILD_DIR)
99 $(STAMP_CONFIGURED): $(STAMP_PREPARED)
100 $(call Build/Configure)
103 $(STAMP_BUILT): $(STAMP_CONFIGURED)
104 $(call Build/Compile)
105 @$(NO_TRACE_MAKE) $(PKG_BUILD_DIR)/.dep_files
108 $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed: $(STAMP_BUILT)
109 $(call Build/Install)
110 mkdir -p $$(shell dirname $$@)
114 install: $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
119 $(call Build/Uninstall)
120 rm -f $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
123 prepare: $(STAMP_PREPARED)
124 configure: $(STAMP_CONFIGURED)
125 compile: $(STAMP_BUILT)
129 rm -rf $(PKG_BUILD_DIR)