2 # Copyright (C) 2006-2007 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
17 include $(INCLUDE_DIR)/quilt.mk
19 Build/Patch:=$(Build/Patch/Default)
20 ifneq ($(strip $(PKG_UNPACK)),)
21 define Build/Prepare/Default
28 $(call Build/Prepare/Default)
31 define Build/Configure/Default
32 @(cd $(PKG_BUILD_DIR)/$(3); \
34 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(PKG_BUILD_DIR)/$(3)/ && \
36 CPPFLAGS="-I$(STAGING_DIR)/host/include" \
37 LDFLAGS="-L$(STAGING_DIR)/host/lib" \
39 --target=$(GNU_TARGET_NAME) \
40 --host=$(GNU_TARGET_NAME) \
41 --build=$(GNU_HOST_NAME) \
48 --libexecdir=/usr/lib \
50 --datadir=/usr/share \
51 --localstatedir=/var \
60 define Build/Configure
61 $(call Build/Configure/Default)
64 define Build/Compile/Default
65 $(MAKE) -C $(PKG_BUILD_DIR) $(1)
69 $(call Build/Compile/Default)
73 ifneq ($(strip $(PKG_SOURCE)),)
74 download: $(DL_DIR)/$(PKG_SOURCE)
76 $(DL_DIR)/$(PKG_SOURCE):
78 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
80 $(STAMP_PREPARED): $(DL_DIR)/$(PKG_SOURCE)
83 ifneq ($(if $(QUILT),,$(CONFIG_AUTOREBUILD)),)
84 define HostBuild/Autoclean
85 $(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
86 $(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED))
87 $(if $(filter prepare,$(MAKECMDGOALS)),,$(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),$(PKG_BUILD_DIR)/.dep_files, -and -not -path "/.*" -and -not -path "*/ipkg*"))
93 $(call HostBuild/Autoclean)
97 @-rm -rf $(PKG_BUILD_DIR)
98 @mkdir -p $(PKG_BUILD_DIR)
102 $(STAMP_CONFIGURED): $(STAMP_PREPARED)
103 $(call Build/Configure)
106 $(STAMP_BUILT): $(STAMP_CONFIGURED)
107 $(call Build/Compile)
110 $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed: $(STAMP_BUILT)
111 $(call Build/Install)
112 mkdir -p $$(shell dirname $$@)
116 install: $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
121 $(call Build/Uninstall)
122 rm -f $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
125 prepare: $(STAMP_PREPARED)
126 configure: $(STAMP_CONFIGURED)
127 compile: $(STAMP_BUILT)
131 rm -rf $(PKG_BUILD_DIR)