use newer config.guess and config.sub for packages then the shipped ones
[openwrt/svn-archive/archive.git] / include / host-build.mk
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(INCLUDE_DIR)/host.mk
9 include $(INCLUDE_DIR)/unpack.mk
10 include $(INCLUDE_DIR)/depends.mk
11
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
15
16 include $(INCLUDE_DIR)/quilt.mk
17
18 Build/Patch:=$(Build/Patch/Default)
19 ifneq ($(strip $(PKG_UNPACK)),)
20 define Build/Prepare/Default
21 $(PKG_UNPACK)
22 $(Build/Patch)
23 endef
24 endif
25
26 define Build/Prepare
27 $(call Build/Prepare/Default)
28 endef
29
30 define Build/Configure/Default
31 @(cd $(PKG_BUILD_DIR)/$(3); \
32 [ -x configure ] && \
33 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(PKG_BUILD_DIR)/$(3)/ && \
34 $(2) \
35 CPPFLAGS="-I$(STAGING_DIR)/host/include" \
36 LDFLAGS="-L$(STAGING_DIR)/host/lib" \
37 ./configure \
38 --target=$(GNU_TARGET_NAME) \
39 --host=$(GNU_TARGET_NAME) \
40 --build=$(GNU_HOST_NAME) \
41 --program-prefix="" \
42 --program-suffix="" \
43 --prefix=/usr \
44 --exec-prefix=/usr \
45 --bindir=/usr/bin \
46 --sbindir=/usr/sbin \
47 --libexecdir=/usr/lib \
48 --sysconfdir=/etc \
49 --datadir=/usr/share \
50 --localstatedir=/var \
51 --mandir=/usr/man \
52 --infodir=/usr/info \
53 $(DISABLE_NLS) \
54 $(1); \
55 true; \
56 )
57 endef
58
59 define Build/Configure
60 $(call Build/Configure/Default)
61 endef
62
63 define Build/Compile/Default
64 $(MAKE) -C $(PKG_BUILD_DIR) $(1)
65 endef
66
67 define Build/Compile
68 $(call Build/Compile/Default)
69 endef
70
71
72 ifneq ($(strip $(PKG_SOURCE)),)
73 download: $(DL_DIR)/$(PKG_SOURCE)
74
75 $(DL_DIR)/$(PKG_SOURCE):
76 mkdir -p $(DL_DIR)
77 $(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(PKG_SOURCE)" "$(PKG_MD5SUM)" $(PKG_SOURCE_URL)
78
79 $(STAMP_PREPARED): $(DL_DIR)/$(PKG_SOURCE)
80 endif
81
82 ifneq ($(CONFIG_AUTOREBUILD),)
83 define HostBuild/Autoclean
84 $(PKG_BUILD_DIR)/.dep_files: $(STAMP_PREPARED)
85 $(call rdep,${CURDIR} $(PKG_FILE_DEPEND),$(STAMP_PREPARED))
86 $(call rdep,$(PKG_BUILD_DIR),$(STAMP_BUILT),$(PKG_BUILD_DIR)/.dep_files, -and -not -path "/.*" -and -not -path "*/ipkg*")
87 endef
88 endif
89
90 define HostBuild
91 ifeq ($(DUMP),)
92 $(call HostBuild/Autoclean)
93 endif
94
95 $(STAMP_PREPARED):
96 @-rm -rf $(PKG_BUILD_DIR)
97 @mkdir -p $(PKG_BUILD_DIR)
98 $(call Build/Prepare)
99 touch $$@
100
101 $(STAMP_CONFIGURED): $(STAMP_PREPARED)
102 $(call Build/Configure)
103 touch $$@
104
105 $(STAMP_BUILT): $(STAMP_CONFIGURED)
106 $(call Build/Compile)
107 @$(NO_TRACE_MAKE) $(PKG_BUILD_DIR)/.dep_files
108 touch $$@
109
110 $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed: $(STAMP_BUILT)
111 $(call Build/Install)
112 mkdir -p $$(shell dirname $$@)
113 touch $$@
114
115 ifdef Build/Install
116 install: $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
117 endif
118
119 package-clean: FORCE
120 $(call Build/Clean)
121 $(call Build/Uninstall)
122 rm -f $(STAGING_DIR)/stampfiles/.host_$(PKG_NAME)-installed
123
124 download:
125 prepare: $(STAMP_PREPARED)
126 configure: $(STAMP_CONFIGURED)
127 compile: $(STAMP_BUILT)
128 install:
129 clean: FORCE
130 $(call Build/Clean)
131 rm -rf $(PKG_BUILD_DIR)
132
133 endef