summaryrefslogtreecommitdiff
path: root/mk/pkg-macros
diff options
context:
space:
mode:
Diffstat (limited to 'mk/pkg-macros')
-rw-r--r--mk/pkg-macros/incl.mk12
-rw-r--r--mk/pkg-macros/install.mk43
-rw-r--r--mk/pkg-macros/vars.mk4
3 files changed, 24 insertions, 35 deletions
diff --git a/mk/pkg-macros/incl.mk b/mk/pkg-macros/incl.mk
index 7641c15..bcd8402 100644
--- a/mk/pkg-macros/incl.mk
+++ b/mk/pkg-macros/incl.mk
@@ -32,10 +32,10 @@ define embtk_include_pkg
$(eval $(call __embtk_include_pkg,$(1),$(2)))
endef
define __embtk_include_pkg
- $(eval __embtk_inckconfig := $(or $(2),$(PKGV)))
+ $(eval __embtk_inc_pkgname := $(or $(2),$(PKGV)))
$(eval __embtk_incmk := $(embtk_pkgincdir)/$(pkgv)/$(pkgv).mk)
$(eval __embtk_incinstalled-y := $(if $(wildcard $(__embtk_pkg_dotinstalled_f)),y))
- $(eval __embtk_incenabled-y := $(CONFIG_EMBTK_HAVE_$(__embtk_inckconfig)))
+ $(eval __embtk_incenabled-y := $(CONFIG_EMBTK_HAVE_$(__embtk_inc_pkgname)))
$(eval __embtk_incmk-y := $(if $(__embtk_incenabled-y)$(__embtk_incinstalled-y),y))
# Is it necessary to include the .mk file?
$(eval __embtk_incmk-y := $(if $(findstring $(__embtk_incmk),$(MAKEFILE_LIST)),,$(__embtk_incmk-y)))
@@ -47,19 +47,21 @@ define __embtk_include_pkg
else ifeq (x$(__embtk_incinstalled-y),xy)
ROOTFS_COMPONENTS- += $(pkgv)_install
endif
+ # also include old package kconfig entries if any
+ -include $(__embtk_pkg_dotkconfig_f)
endef
define embtk_include_hostpkg
$(eval $(call __embtk_include_hostpkg,$(1),$(2)))
endef
define __embtk_include_hostpkg
- $(eval __embtk_inckconfig := $(or $(2),$(PKGV)))
+ $(eval __embtk_inc_pkgname := $(or $(2),$(PKGV)))
# Case where foo and foo_host are in the same .mk file
$(eval __embtk_incmk0 := $(embtk_pkgincdir)/$(pkgv)/$(pkgv).mk)
$(eval __embtk_incmk1 := $(embtk_pkgincdir)/$(patsubst %_host,%,$(pkgv))/$(patsubst %_host,%,$(pkgv)).mk)
$(eval __embtk_incmk := $(or $(wildcard $(__embtk_incmk0)),$(wildcard $(__embtk_incmk1)),$(wildcard $(__embtk_incmk0))))
$(eval __embtk_incinstalled-y := $(if $(wildcard $(__embtk_pkg_dotinstalled_f)),y))
- $(eval __embtk_incenabled-y := $(CONFIG_EMBTK_HOST_HAVE_$(patsubst %_HOST,%,$(__embtk_inckconfig))))
+ $(eval __embtk_incenabled-y := $(CONFIG_EMBTK_HOST_HAVE_$(patsubst %_HOST,%,$(__embtk_inc_pkgname))))
$(eval __embtk_incmk-y := $(if $(__embtk_incenabled-y)$(__embtk_incinstalled-y),y))
# Is it necessary to include the .mk file?
$(eval __embtk_incmk-y := $(if $(findstring $(__embtk_incmk),$(MAKEFILE_LIST)),,$(__embtk_incmk-y)))
@@ -71,4 +73,6 @@ define __embtk_include_hostpkg
else ifeq (x$(__embtk_incinstalled-y),xy)
HOSTTOOLS_COMPONENTS- += $(pkgv)_install
endif
+ # also include old package kconfig entries if any
+ -include $(__embtk_pkg_dotkconfig_f)
endef
diff --git a/mk/pkg-macros/install.mk b/mk/pkg-macros/install.mk
index 8938f69..07d1f32 100644
--- a/mk/pkg-macros/install.mk
+++ b/mk/pkg-macros/install.mk
@@ -105,40 +105,19 @@ __embtk_pkg_configured-y = $(call __embtk_mk_pathexist,$(__embtk_pkg_dotconfigur
__embtk_pkg_notconfigured-y = $(call __embtk_mk_pathnotexist,$(__embtk_pkg_dotconfigured_f))
#
-# A macro to print kconfig entries of a package
-#
-__embtk_pkg_printkconfigs = \
- grep 'CONFIG_K*EMBTK_.*$(__embtk_pkg_kconfigsname)_.*' \
- $(EMBTK_DOTCONFIG)
-
-#
# A macro to generate a package __embtk_pkg_dotkconfig_f file.
#
define __embtk_pkg_gen_dotkconfig_f
- $(call __embtk_pkg_printkconfigs,$(1)) \
- > $(__embtk_pkg_dotkconfig_f) 2>/dev/null \
- $(if $(__embtk_pkg_deps), \
- $(foreach dep,$(call __embtk_pkg_depspkgv,$(1)),; \
- $(call __embtk_pkg_printkconfigs,$(dep)) \
- >> $(__embtk_pkg_dotkconfig_f)))
+ echo '__embtk_$(pkgv)_okconfigs := $(__embtk_pkg_kconfigs_all_v)' > $(__embtk_pkg_dotkconfig_f)
endef
#
-# A macro to test if a package is already installed.
-# It returns y if installed and nothing if not.
+# A macro to test if a package build recipe needs to be run or not.
#
-__installed_f = $(__embtk_pkg_dotinstalled_f)
-__pkgkconfig_f = $(__embtk_pkg_dotkconfig_f)
-__pkgkconfig_f_old = $(__embtk_pkg_dotkconfig_f).old
-__embtk_pkg_installed-y = $(shell \
- if [ -e $(__installed_f) ] && [ -e $(__pkgkconfig_f) ]; then \
- cp $(__pkgkconfig_f) $(__pkgkconfig_f_old); \
- $(call __embtk_pkg_gen_dotkconfig_f,$(1)); \
- cmp -s $(__pkgkconfig_f) $(__pkgkconfig_f_old); \
- if [ "x$$?" = "x0" ]; then \
- echo y; \
- fi; \
- fi;)
+__embtk_pkg_runrecipe-y = $(or $(__embtk_pkg_ninstalled-y),$(__embtk_pkg_confchanged-y))
+__embtk_pkg_installed-y = $(or $(__embtk_$(pkgv)_installed),$(wildcard $(__embtk_pkg_dotinstalled_f)))
+__embtk_pkg_ninstalled-y = $(if $(__embtk_pkg_installed-y),,y)
+__embtk_pkg_confchanged-y = $(call __embtk_strneq,$(__embtk_pkg_kconfigs_all_v),$(__embtk_$(pkgv)_okconfigs))
#
# Various helpers macros for different steps while installing packages.
@@ -197,6 +176,7 @@ define __embtk_install_pkg_make
$(call __embtk_fix_pkgconfig_files))
$(call __embtk_setinstalled_pkg,$(1))
$(call __embtk_pkg_gen_dotkconfig_f,$(1))
+ $(eval __embtk_$(pkgv)_installed := y)
endef
define __embtk_install_hostpkg_make
$(Q)$(if $(__embtk_pkg_deps),$(MAKE) $(__embtk_pkg_deps))
@@ -213,6 +193,7 @@ define __embtk_install_hostpkg_make
$(__embtk_single_make_hostinstall))
$(call __embtk_setinstalled_pkg,$(1))
$(call __embtk_pkg_gen_dotkconfig_f,$(1))
+ $(eval __embtk_$(pkgv)_installed := y)
endef
#
@@ -267,7 +248,7 @@ __embtk_xinstall_xpkg_allvarset-y = $(and $(__embtk_pkg_name), \
# $(call embtk_install_pkg,package)
#
define __embtk_install_pkg
- $(if $(__embtk_pkg_installed-y),,
+ $(if $(__embtk_pkg_runrecipe-y),
$(Q)mkdir -p $(__embtk_pkg_builddir)
$(Q)$(call __embtk_install_pkg_make,$(1),autotools)
$(embtk_postinstallonce_$(pkgv))
@@ -290,7 +271,7 @@ endef
#
define embtk_makeinstall_pkg
$(if $(__embtk_xinstall_xpkg_allvarset-y),
- $(if $(__embtk_pkg_installed-y),,
+ $(if $(__embtk_pkg_runrecipe-y),
$(Q)mkdir -p $(__embtk_pkg_builddir)
$(Q)$(call __embtk_install_pkg_make,$(1))
$(embtk_postinstallonce_$(pkgv))
@@ -307,7 +288,7 @@ endef
#
define __embtk_install_hostpkg
- $(if $(__embtk_pkg_installed-y),,
+ $(if $(__embtk_pkg_runrecipe-y),
$(Q)mkdir -p $(__embtk_pkg_builddir)
$(Q)$(call __embtk_install_hostpkg_make,$(1),autotools)
$(embtk_postinstallonce_$(pkgv))
@@ -328,7 +309,7 @@ endef
#
define embtk_makeinstall_hostpkg
$(if $(__embtk_xinstall_xpkg_allvarset-y),
- $(if $(__embtk_pkg_installed-y),,
+ $(if $(__embtk_pkg_runrecipe-y),
$(Q)mkdir -p $(__embtk_pkg_builddir)
$(Q)$(call __embtk_install_hostpkg_make,$(1))
$(embtk_postinstallonce_$(pkgv))
diff --git a/mk/pkg-macros/vars.mk b/mk/pkg-macros/vars.mk
index b360d64..d9a478b 100644
--- a/mk/pkg-macros/vars.mk
+++ b/mk/pkg-macros/vars.mk
@@ -106,6 +106,10 @@ __embtk_pkg_deps = $(strip $($(PKGV)_DEPS))
__embtk_pkg_depspkgv = $(sort $(patsubst %_install,%,$(__embtk_pkg_deps)))
___embtk_pkg_kconfigsname = $(strip $(or $($(PKGV)_KCONFIGS_NAME),$(PKGV)))
__embtk_pkg_kconfigsname = $(patsubst %_HOST,%,$(___embtk_pkg_kconfigsname))
+__embtk_pkg_kconfigs = $(sort $(filter CONFIG_EMBTK_$(__embtk_pkg_kconfigsname)_%,$(.VARIABLES)))
+__embtk_pkg_kconfigs_v = $(foreach k,$(__embtk_pkg_kconfigs),$(k)=$($(k)))
+__embtk_pkg_deps_kconfigs_v = $(foreach d,$(__embtk_pkg_depspkgv),$(call __embtk_pkg_kconfigs_v,$(d)))
+__embtk_pkg_kconfigs_all_v = $(strip $(__embtk_pkg_kconfigs_v) $(__embtk_pkg_deps_kconfigs_v))
__embtk_pkg_cflags = $(strip $($(PKGV)_CFLAGS))
__embtk_pkg_cppflags = $(strip $($(PKGV)_CPPFLAGS))
__embtk_pkg_cxxflags = $(strip $($(PKGV)_CXXFLAGS))