From f731bcb320752f41c80aec9190a036be604c45db Mon Sep 17 00:00:00 2001 From: Abdoulaye Walsimou Gaye Date: Thu, 14 Jul 2011 01:06:01 +0200 Subject: Build system: Add macros to install automatically packages using Makefile and install target Signed-off-by: Abdoulaye Walsimou Gaye --- mk/macros.mk | 66 +++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 19 deletions(-) diff --git a/mk/macros.mk b/mk/macros.mk index 417487a..1fc4848 100644 --- a/mk/macros.mk +++ b/mk/macros.mk @@ -304,9 +304,7 @@ define embtk_configure_hostpkg endef # -# A macro to install automatically a package intended to run on the target. -# Usage: -# $(call embtk_install_pkg,PACKAGE) +# Various helpers macros for different steps while installing packages. # __embtk_multi_make = $(foreach builddir,$($(PKGV)_MAKE_DIRS), \ $($(PKGV)_MAKE_ENV) \ @@ -337,39 +335,29 @@ __embtk_single_make_hostinstall = $($(PKGV)_MAKE_ENV) \ $(if $($(PKGV)_DESTDIR),DESTDIR=$($(PKGV)_DESTDIR)) \ $($(PKGV)_MAKE_OPTS) install +__embtk_autotolspkg-y=$(2) define __embtk_install_pkg_make $(call embtk_generic_msg,"Compiling and installing $($(PKGV)_NAME)-$($(PKGV)_VERSION) in your root filesystem...") $(Q)$(if $(strip $($(PKGV)_DEPS)),$(MAKE) $($(PKGV)_DEPS)) $(Q)$(call embtk_download_pkg,$(1)) $(Q)$(call embtk_decompress_pkg,$(1)) - $(Q)$(call embtk_configure_pkg,$(1)) + $(Q)$(if $(__embtk_autotolspkg-y),$(call embtk_configure_pkg,$(1))) $(Q)$(if $($(PKGV)_MAKE_DIRS), \ $(__embtk_multi_make), \ $(__embtk_single_make)) $(Q)$(if $($(PKGV)_MAKE_DIRS), \ $(__embtk_multi_make_install), \ $(__embtk_single_make_install)) - $(Q)$(call __embtk_fix_libtool_files) - $(Q)$(call __embtk_fix_pkgconfig_files) + $(Q)$(if $(__embtk_autotolspkg-y),$(call __embtk_fix_libtool_files)) + $(Q)$(if $(__embtk_autotolspkg-y),$(call __embtk_fix_pkgconfig_files)) @touch $($(PKGV)_BUILD_DIR)/.installed endef -define embtk_install_pkg - @$(if $(shell test -e $($(PKGV)_BUILD_DIR)/.installed && echo y),true, \ - $(call __embtk_install_pkg_make,$(1))) -endef - -# -# A macro to install automatically a package intended to run on the host -# development machine. -# Usage: -# $(call embtk_install_hostpkg,PACKAGE) -# define __embtk_install_hostpkg_make $(call embtk_generic_msg,"Compiling and installing $($(PKGV)_NAME)-$($(PKGV)_VERSION) for host...") $(Q)$(if $(strip $($(PKGV)_DEPS)),$(MAKE) $($(PKGV)_DEPS)) $(Q)$(call embtk_download_pkg,$(1)) $(Q)$(call embtk_decompress_hostpkg,$(1)) - $(Q)$(call embtk_configure_hostpkg,$(1)) + $(Q)$(if $(__embtk_autotolspkg-y),$(call embtk_configure_hostpkg,$(1))) $(Q)$(if $($(PKGV)_MAKE_DIRS), \ $(__embtk_multi_make), \ $(__embtk_single_make)) @@ -378,8 +366,48 @@ define __embtk_install_hostpkg_make $(__embtk_single_make_hostinstall)) @touch $($(PKGV)_BUILD_DIR)/.installed endef + +# +# A macro to install automatically a package, using autotools scripts, intended +# to run on the target +# Usage: +# $(call embtk_install_pkg,package) +# +define embtk_install_pkg + $(Q)$(if $(__embtk_pkg_installed-y), \ + true,$(call __embtk_install_pkg_make,$(1),autotools)) +endef + +# +# A macro to install automatically a package, using simple Makefile and an +# install target, intented to run on the target. +# Usage: +# $(call embtk_makeinstall_pkg,package) +# +define embtk_makeinstall_pkg + $(Q)$(if $(__embtk_pkg_installed-y), \ + true,$(call __embtk_install_pkg_make,$(1))) +endef + +# +# A macro to install automatically a package, using autotools scripts, intended +# to run on the host development machine. +# Usage: +# $(call embtk_install_hostpkg,package) +# define embtk_install_hostpkg - @$(if $(shell test -e $($(PKGV)_BUILD_DIR)/.installed && echo y),true, \ + $(Q)$(if $(__embtk_pkg_installed-y),true, \ + $(call __embtk_install_hostpkg_make,$(1)),autotools) +endef + +# +# A macro to install automatically a package, using simple Makefile and an +# install target, intended to run on the host development machine. +# Usage: +# $(call embtk_makeinstall_hostpkg,package) +# +define embtk_makeinstall_hostpkg + $(Q)$(if $(__embtk_pkg_installed-y),true, \ $(call __embtk_install_hostpkg_make,$(1))) endef -- cgit v1.2.3