[include] prime .ipk control files with Status: field to introduce hold for post...
[openwrt.git] / include / host-build.mk
1 #
2 # Copyright (C) 2006-2010 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 HOST_BUILD_DIR ?= $(BUILD_DIR_HOST)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
9 HOST_INSTALL_DIR ?= $(HOST_BUILD_DIR)/host-install
10 HOST_BUILD_PARALLEL ?=
11 HOST_JOBS ?= $(if $(HOST_BUILD_PARALLEL)$(CONFIG_PKG_DEFAULT_PARALLEL),$(if $(CONFIG_PKG_BUILD_PARALLEL),-j$(CONFIG_PKG_BUILD_JOBS)))
12
13 include $(INCLUDE_DIR)/host.mk
14 include $(INCLUDE_DIR)/unpack.mk
15 include $(INCLUDE_DIR)/depends.mk
16
17 BUILD_TYPES += host
18 HOST_STAMP_PREPARED=$(HOST_BUILD_DIR)/.prepared$(if $(HOST_QUILT)$(DUMP),,$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPENDS),)))
19 HOST_STAMP_CONFIGURED:=$(HOST_BUILD_DIR)/.configured
20 HOST_STAMP_BUILT:=$(HOST_BUILD_DIR)/.built
21 HOST_STAMP_INSTALLED:=$(STAGING_DIR_HOST)/stamp/.$(PKG_NAME)_installed
22
23 override MAKEFLAGS=
24
25 include $(INCLUDE_DIR)/download.mk
26 include $(INCLUDE_DIR)/quilt.mk
27
28 Host/Patch:=$(Host/Patch/Default)
29 ifneq ($(strip $(HOST_UNPACK)),)
30 define Host/Prepare/Default
31 $(HOST_UNPACK)
32 $(Host/Patch)
33 endef
34 endif
35
36 define Host/Prepare
37 $(call Host/Prepare/Default)
38 endef
39
40 HOST_CONFIGURE_VARS = \
41 CFLAGS="$(HOST_CFLAGS)" \
42 CPPFLAGS="$(HOST_CFLAGS)" \
43 LDFLAGS="$(HOST_LDFLAGS)" \
44 SHELL="$(BASH)"
45
46 HOST_CONFIGURE_ARGS = \
47 --target=$(GNU_HOST_NAME) \
48 --host=$(GNU_HOST_NAME) \
49 --build=$(GNU_HOST_NAME) \
50 --program-prefix="" \
51 --program-suffix="" \
52 --prefix=$(STAGING_DIR_HOST) \
53 --exec-prefix=$(STAGING_DIR_HOST) \
54 --sysconfdir=$(STAGING_DIR_HOST)/etc \
55 --localstatedir=$(STAGING_DIR_HOST)/var
56
57 HOST_CONFIGURE_CMD = ./configure
58
59 define Host/Configure/Default
60 (cd $(HOST_BUILD_DIR)/$(3); \
61 if [ -x configure ]; then \
62 $(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/$(3)/ && \
63 $(2) \
64 $(HOST_CONFIGURE_CMD) \
65 $(HOST_CONFIGURE_VARS) \
66 $(HOST_CONFIGURE_ARGS) \
67 $(1); \
68 fi \
69 )
70 endef
71
72 define Host/Configure
73 $(call Host/Configure/Default)
74 endef
75
76 define Host/Compile/Default
77 $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) $(1)
78 endef
79
80 define Host/Compile
81 $(call Host/Compile/Default)
82 endef
83
84 define Host/Install/Default
85 $(_SINGLE)$(MAKE) -C $(HOST_BUILD_DIR) install
86 endef
87
88 define Host/Install
89 $(call Host/Install/Default)
90 endef
91
92
93 ifneq ($(if $(HOST_QUILT),,$(CONFIG_AUTOREBUILD)),)
94 define HostHost/Autoclean
95 $(call rdep,${CURDIR} $(PKG_FILE_DEPENDS),$(HOST_STAMP_PREPARED))
96 $(if $(if $(Host/Compile),$(filter prepare,$(MAKECMDGOALS)),1),,$(call rdep,$(HOST_BUILD_DIR),$(HOST_STAMP_BUILT)))
97 endef
98 endif
99
100 define Download/default
101 FILE:=$(PKG_SOURCE)
102 URL:=$(PKG_SOURCE_URL)
103 PROTO:=$(PKG_SOURCE_PROTO)
104 SUBDIR:=$(PKG_SOURCE_SUBDIR)
105 VERSION:=$(PKG_SOURCE_VERSION)
106 MD5SUM:=$(PKG_MD5SUM)
107 endef
108
109 define Host/Exports/Default
110 $(1) : export ACLOCAL_INCLUDE=$$(foreach p,$$(wildcard $$(STAGING_DIR_HOST)/share/aclocal $$(STAGING_DIR_HOST)/share/aclocal-*),-I $$(p))
111 $(1) : export STAGING_PREFIX=$$(STAGING_DIR_HOST)
112 $(1) : export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig
113 $(1) : export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
114 endef
115 Host/Exports=$(Host/Exports/Default)
116
117 ifndef DUMP
118 define HostBuild
119 $(if $(HOST_QUILT),$(Host/Quilt))
120 $(if $(if $(PKG_HOST_ONLY),,$(STAMP_PREPARED)),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
121 $(if $(DUMP),,$(call HostHost/Autoclean))
122
123 $(HOST_STAMP_PREPARED):
124 @-rm -rf $(HOST_BUILD_DIR)
125 @mkdir -p $(HOST_BUILD_DIR)
126 $(call Host/Prepare)
127 touch $$@
128
129 $(call Host/Exports,$(HOST_STAMP_CONFIGURED))
130 $(HOST_STAMP_CONFIGURED): $(HOST_STAMP_PREPARED)
131 $(call Host/Configure)
132 touch $$@
133
134 $(call Host/Exports,$(HOST_STAMP_BUILT))
135 ifdef Host/Install
136 host-install: $(if $(STAMP_BUILT),$(HOST_STAMP_BUILT),$(HOST_STAMP_INSTALLED))
137 endif
138
139 ifndef STAMP_BUILT
140 prepare: host-prepare
141 compile: host-compile
142 install: host-install
143 clean: host-clean
144 update: host-update
145
146 $(HOST_STAMP_BUILT): $(HOST_STAMP_CONFIGURED)
147 $(call Host/Compile)
148 touch $$@
149
150 $(HOST_STAMP_INSTALLED): $(HOST_STAMP_BUILT)
151 $(call Host/Install)
152 mkdir -p $$(shell dirname $$@)
153 touch $$@
154 else
155 $(HOST_STAMP_BUILT): $(HOST_STAMP_CONFIGURED)
156 $(call Host/Compile)
157 $(call Host/Install)
158 touch $$@
159 endif
160 host-prepare: $(HOST_STAMP_PREPARED)
161 host-configure: $(HOST_STAMP_CONFIGURED)
162 host-compile: $(HOST_STAMP_BUILT)
163 host-install:
164 host-clean: FORCE
165 $(call Host/Clean)
166 $(call Host/Uninstall)
167 rm -rf $(HOST_BUILD_DIR) $(HOST_STAMP_INSTALLED) $(HOST_STAMP_BUILT)
168
169 endef
170
171 download:
172 prepare:
173 compile:
174 install:
175 clean:
176
177 endif
178
This page took 0.046435 seconds and 5 git commands to generate.