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