source: trunk/include/host-build.mk @ 23482

Last change on this file since 23482 was 23482, checked in by mb, 6 years ago

Fix typo

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