2009-03-02 05:03:21 +02:00
|
|
|
#
|
2010-03-05 22:15:12 +02:00
|
|
|
# Copyright (C) 2006-2010 OpenWrt.org
|
2006-06-27 03:35:46 +03:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
2006-10-10 16:25:18 +03:00
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
HOST_BUILD_DIR ?= $(BUILD_DIR_HOST)/$(PKG_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION))
|
2009-02-22 20:10:05 +02:00
|
|
|
HOST_INSTALL_DIR ?= $(HOST_BUILD_DIR)/host-install
|
2010-08-18 17:23:06 +03:00
|
|
|
HOST_BUILD_PARALLEL ?=
|
2010-10-16 21:42:58 +03:00
|
|
|
|
2012-09-15 15:34:48 +03:00
|
|
|
ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),)
|
|
|
|
HOST_MAKE_J:=$(if $(MAKE_JOBSERVER),$(MAKE_JOBSERVER) -j)
|
|
|
|
else
|
|
|
|
HOST_MAKE_J:=-j$(CONFIG_PKG_BUILD_JOBS)
|
|
|
|
endif
|
|
|
|
|
2010-10-16 21:42:58 +03:00
|
|
|
ifeq ($(strip $(HOST_BUILD_PARALLEL)),0)
|
|
|
|
HOST_JOBS?=-j1
|
|
|
|
else
|
2010-10-16 21:46:22 +03:00
|
|
|
HOST_JOBS?=$(if $(HOST_BUILD_PARALLEL)$(CONFIG_PKG_DEFAULT_PARALLEL),\
|
2012-09-15 15:34:48 +03:00
|
|
|
$(if $(CONFIG_PKG_BUILD_PARALLEL),$(HOST_MAKE_J),-j1),-j1)
|
2010-10-16 21:42:58 +03:00
|
|
|
endif
|
2007-08-07 03:04:25 +03:00
|
|
|
|
2006-10-10 19:58:47 +03:00
|
|
|
include $(INCLUDE_DIR)/host.mk
|
2006-10-14 03:40:27 +03:00
|
|
|
include $(INCLUDE_DIR)/unpack.mk
|
2007-04-15 21:28:24 +03:00
|
|
|
include $(INCLUDE_DIR)/depends.mk
|
|
|
|
|
2009-03-17 04:20:34 +02:00
|
|
|
BUILD_TYPES += host
|
2009-04-27 19:02:21 +03:00
|
|
|
HOST_STAMP_PREPARED=$(HOST_BUILD_DIR)/.prepared$(if $(HOST_QUILT)$(DUMP),,$(shell $(call find_md5,${CURDIR} $(PKG_FILE_DEPENDS),)))
|
2009-02-22 06:37:20 +02:00
|
|
|
HOST_STAMP_CONFIGURED:=$(HOST_BUILD_DIR)/.configured
|
|
|
|
HOST_STAMP_BUILT:=$(HOST_BUILD_DIR)/.built
|
|
|
|
HOST_STAMP_INSTALLED:=$(STAGING_DIR_HOST)/stamp/.$(PKG_NAME)_installed
|
2007-08-07 03:04:25 +03:00
|
|
|
|
2007-07-31 00:14:08 +03:00
|
|
|
override MAKEFLAGS=
|
2006-10-10 16:25:18 +03:00
|
|
|
|
2007-09-29 03:05:48 +03:00
|
|
|
include $(INCLUDE_DIR)/download.mk
|
2007-06-03 10:33:00 +03:00
|
|
|
include $(INCLUDE_DIR)/quilt.mk
|
2010-12-13 21:04:33 +02:00
|
|
|
include $(INCLUDE_DIR)/autotools.mk
|
2007-06-03 10:33:00 +03:00
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
Host/Patch:=$(Host/Patch/Default)
|
|
|
|
ifneq ($(strip $(HOST_UNPACK)),)
|
|
|
|
define Host/Prepare/Default
|
2009-03-02 05:03:21 +02:00
|
|
|
$(HOST_UNPACK)
|
2009-02-22 06:37:20 +02:00
|
|
|
$(Host/Patch)
|
2006-06-21 09:19:43 +03:00
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Prepare
|
|
|
|
$(call Host/Prepare/Default)
|
2006-06-21 09:19:43 +03:00
|
|
|
endef
|
|
|
|
|
2009-02-28 23:03:17 +02:00
|
|
|
HOST_CONFIGURE_VARS = \
|
2012-01-15 13:43:13 +02:00
|
|
|
CC="$(HOSTCC)" \
|
2009-10-31 00:52:27 +02:00
|
|
|
CFLAGS="$(HOST_CFLAGS)" \
|
2012-09-10 00:35:42 +03:00
|
|
|
CPPFLAGS="$(HOST_CPPFLAGS)" \
|
2009-02-28 23:03:17 +02:00
|
|
|
LDFLAGS="$(HOST_LDFLAGS)" \
|
|
|
|
SHELL="$(BASH)"
|
|
|
|
|
|
|
|
HOST_CONFIGURE_ARGS = \
|
|
|
|
--target=$(GNU_HOST_NAME) \
|
|
|
|
--host=$(GNU_HOST_NAME) \
|
|
|
|
--build=$(GNU_HOST_NAME) \
|
|
|
|
--program-prefix="" \
|
|
|
|
--program-suffix="" \
|
|
|
|
--prefix=$(STAGING_DIR_HOST) \
|
|
|
|
--exec-prefix=$(STAGING_DIR_HOST) \
|
|
|
|
--sysconfdir=$(STAGING_DIR_HOST)/etc \
|
2010-11-22 20:49:18 +02:00
|
|
|
--localstatedir=$(STAGING_DIR_HOST)/var \
|
|
|
|
--sbindir=$(STAGING_DIR_HOST)/bin
|
2009-02-28 23:03:17 +02:00
|
|
|
|
2012-09-22 23:10:28 +03:00
|
|
|
HOST_MAKE_FLAGS =
|
|
|
|
|
2009-02-28 23:03:17 +02:00
|
|
|
HOST_CONFIGURE_CMD = ./configure
|
|
|
|
|
2012-08-12 15:34:25 +03:00
|
|
|
ifneq ($(HOST_OS),Darwin)
|
2012-08-13 03:26:34 +03:00
|
|
|
ifeq ($(CONFIG_BUILD_STATIC_TOOLS),y)
|
|
|
|
HOST_STATIC_LINKING = -static
|
|
|
|
endif
|
2012-08-12 15:34:25 +03:00
|
|
|
endif
|
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Configure/Default
|
2012-09-23 12:50:01 +03:00
|
|
|
$(if $(HOST_CONFIGURE_PARALLEL),+)(cd $(HOST_BUILD_DIR)/$(3); \
|
2009-02-28 23:03:17 +02:00
|
|
|
if [ -x configure ]; then \
|
|
|
|
$(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/$(3)/ && \
|
|
|
|
$(2) \
|
|
|
|
$(HOST_CONFIGURE_CMD) \
|
2009-03-02 05:03:21 +02:00
|
|
|
$(HOST_CONFIGURE_VARS) \
|
2009-02-28 23:03:17 +02:00
|
|
|
$(HOST_CONFIGURE_ARGS) \
|
|
|
|
$(1); \
|
|
|
|
fi \
|
2006-06-21 09:19:43 +03:00
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Configure
|
|
|
|
$(call Host/Configure/Default)
|
2006-06-21 09:19:43 +03:00
|
|
|
endef
|
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Compile/Default
|
2012-09-23 12:50:01 +03:00
|
|
|
+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) \
|
2012-09-22 23:10:28 +03:00
|
|
|
$(HOST_MAKE_FLAGS) \
|
|
|
|
$(1)
|
2006-06-21 09:19:43 +03:00
|
|
|
endef
|
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
define Host/Compile
|
|
|
|
$(call Host/Compile/Default)
|
2006-06-21 09:19:43 +03:00
|
|
|
endef
|
|
|
|
|
2009-04-06 12:56:06 +03:00
|
|
|
define Host/Install/Default
|
2010-03-05 22:15:12 +02:00
|
|
|
$(_SINGLE)$(MAKE) -C $(HOST_BUILD_DIR) install
|
2009-04-06 12:56:06 +03:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Host/Install
|
|
|
|
$(call Host/Install/Default)
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
2009-03-17 05:21:52 +02:00
|
|
|
ifneq ($(if $(HOST_QUILT),,$(CONFIG_AUTOREBUILD)),)
|
2009-02-22 06:37:20 +02:00
|
|
|
define HostHost/Autoclean
|
2009-04-27 19:02:21 +03:00
|
|
|
$(call rdep,${CURDIR} $(PKG_FILE_DEPENDS),$(HOST_STAMP_PREPARED))
|
2009-02-22 06:37:20 +02:00
|
|
|
$(if $(if $(Host/Compile),$(filter prepare,$(MAKECMDGOALS)),1),,$(call rdep,$(HOST_BUILD_DIR),$(HOST_STAMP_BUILT)))
|
2007-04-15 21:28:24 +03:00
|
|
|
endef
|
2006-06-21 09:19:43 +03:00
|
|
|
endif
|
|
|
|
|
2007-09-29 03:05:48 +03:00
|
|
|
define Download/default
|
|
|
|
FILE:=$(PKG_SOURCE)
|
|
|
|
URL:=$(PKG_SOURCE_URL)
|
|
|
|
PROTO:=$(PKG_SOURCE_PROTO)
|
2008-11-22 06:38:20 +02:00
|
|
|
SUBDIR:=$(PKG_SOURCE_SUBDIR)
|
2007-09-29 03:05:48 +03:00
|
|
|
VERSION:=$(PKG_SOURCE_VERSION)
|
|
|
|
MD5SUM:=$(PKG_MD5SUM)
|
2012-06-06 17:08:47 +03:00
|
|
|
MIRROR_MD5SUM:=$(PKG_MIRROR_MD5SUM)
|
2007-09-29 03:05:48 +03:00
|
|
|
endef
|
|
|
|
|
2009-04-23 01:05:55 +03:00
|
|
|
define Host/Exports/Default
|
|
|
|
$(1) : export ACLOCAL_INCLUDE=$$(foreach p,$$(wildcard $$(STAGING_DIR_HOST)/share/aclocal $$(STAGING_DIR_HOST)/share/aclocal-*),-I $$(p))
|
|
|
|
$(1) : export STAGING_PREFIX=$$(STAGING_DIR_HOST)
|
|
|
|
$(1) : export PKG_CONFIG_PATH=$$(STAGING_DIR_HOST)/lib/pkgconfig
|
|
|
|
$(1) : export PKG_CONFIG_LIBDIR=$$(STAGING_DIR_HOST)/lib/pkgconfig
|
|
|
|
endef
|
|
|
|
Host/Exports=$(Host/Exports/Default)
|
|
|
|
|
2012-09-17 14:17:26 +03:00
|
|
|
.NOTPARALLEL:
|
|
|
|
|
2009-02-22 20:10:05 +02:00
|
|
|
ifndef DUMP
|
|
|
|
define HostBuild
|
2009-03-17 05:21:52 +02:00
|
|
|
$(if $(HOST_QUILT),$(Host/Quilt))
|
2009-03-17 04:37:04 +02:00
|
|
|
$(if $(if $(PKG_HOST_ONLY),,$(STAMP_PREPARED)),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)))
|
2009-02-22 06:37:20 +02:00
|
|
|
$(if $(DUMP),,$(call HostHost/Autoclean))
|
2009-03-02 05:03:21 +02:00
|
|
|
|
2009-02-22 06:37:20 +02:00
|
|
|
$(HOST_STAMP_PREPARED):
|
|
|
|
@-rm -rf $(HOST_BUILD_DIR)
|
|
|
|
@mkdir -p $(HOST_BUILD_DIR)
|
2010-12-13 21:04:33 +02:00
|
|
|
$(foreach hook,$(Hooks/HostPrepare/Pre),$(call $(hook))$(sep))
|
2009-02-22 06:37:20 +02:00
|
|
|
$(call Host/Prepare)
|
2010-12-13 21:04:33 +02:00
|
|
|
$(foreach hook,$(Hooks/HostPrepare/Post),$(call $(hook))$(sep))
|
2006-06-21 09:19:43 +03:00
|
|
|
touch $$@
|
|
|
|
|
2009-04-30 17:15:45 +03:00
|
|
|
$(call Host/Exports,$(HOST_STAMP_CONFIGURED))
|
2009-02-22 06:37:20 +02:00
|
|
|
$(HOST_STAMP_CONFIGURED): $(HOST_STAMP_PREPARED)
|
2010-12-13 21:04:33 +02:00
|
|
|
$(foreach hook,$(Hooks/HostConfigure/Pre),$(call $(hook))$(sep))
|
2009-02-22 06:37:20 +02:00
|
|
|
$(call Host/Configure)
|
2010-12-13 21:04:33 +02:00
|
|
|
$(foreach hook,$(Hooks/HostConfigure/Post),$(call $(hook))$(sep))
|
2006-06-21 09:19:43 +03:00
|
|
|
touch $$@
|
|
|
|
|
2009-04-30 17:15:45 +03:00
|
|
|
$(call Host/Exports,$(HOST_STAMP_BUILT))
|
2012-10-15 16:19:41 +03:00
|
|
|
$(HOST_STAMP_BUILT): $(HOST_STAMP_CONFIGURED)
|
2010-12-13 21:04:33 +02:00
|
|
|
$(foreach hook,$(Hooks/HostCompile/Pre),$(call $(hook))$(sep))
|
2010-01-03 20:00:28 +02:00
|
|
|
$(call Host/Compile)
|
2010-12-13 21:04:33 +02:00
|
|
|
$(foreach hook,$(Hooks/HostCompile/Post),$(call $(hook))$(sep))
|
2010-01-03 20:00:28 +02:00
|
|
|
touch $$@
|
|
|
|
|
2012-10-15 16:19:41 +03:00
|
|
|
$(HOST_STAMP_INSTALLED): $(HOST_STAMP_BUILT) $(if $(FORCE_HOST_INSTALL),FORCE)
|
2010-01-03 20:00:28 +02:00
|
|
|
$(call Host/Install)
|
2010-12-13 21:04:33 +02:00
|
|
|
$(foreach hook,$(Hooks/HostInstall/Post),$(call $(hook))$(sep))
|
2010-01-03 20:00:28 +02:00
|
|
|
mkdir -p $$(shell dirname $$@)
|
|
|
|
touch $$@
|
2012-10-15 16:19:41 +03:00
|
|
|
|
|
|
|
ifndef STAMP_BUILT
|
|
|
|
prepare: host-prepare
|
|
|
|
compile: host-compile
|
|
|
|
install: host-install
|
|
|
|
clean: host-clean
|
|
|
|
update: host-update
|
|
|
|
refresh: host-refresh
|
2009-03-17 04:20:34 +02:00
|
|
|
endif
|
2012-10-15 16:19:41 +03:00
|
|
|
|
2009-02-22 20:10:05 +02:00
|
|
|
host-prepare: $(HOST_STAMP_PREPARED)
|
|
|
|
host-configure: $(HOST_STAMP_CONFIGURED)
|
2012-10-15 16:19:41 +03:00
|
|
|
host-compile: $(HOST_STAMP_BUILT) $(if $(STAMP_BUILT),$(HOST_STAMP_INSTALLED))
|
|
|
|
host-install: $(HOST_STAMP_INSTALLED)
|
2009-02-22 20:10:05 +02:00
|
|
|
host-clean: FORCE
|
2009-02-22 06:37:20 +02:00
|
|
|
$(call Host/Clean)
|
|
|
|
$(call Host/Uninstall)
|
2009-02-22 20:10:05 +02:00
|
|
|
rm -rf $(HOST_BUILD_DIR) $(HOST_STAMP_INSTALLED) $(HOST_STAMP_BUILT)
|
2006-06-21 09:19:43 +03:00
|
|
|
|
2009-02-22 20:10:05 +02:00
|
|
|
endef
|
|
|
|
|
2009-03-12 16:07:08 +02:00
|
|
|
download:
|
2009-03-17 04:20:34 +02:00
|
|
|
prepare:
|
|
|
|
compile:
|
|
|
|
install:
|
|
|
|
clean:
|
2009-02-22 20:10:05 +02:00
|
|
|
|
|
|
|
endif
|