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