mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-26 03:50:44 -09:00
package/pkg-*.mk: do not conditionally set empty variables
Setting an unset variable to an empty value is useless in make; an unset
variable just expands to an empty string anyway. So what we do currently
has no side effect:
variable set and not empty -> variable not modified
variable set and empty -> variable not modified
variable unset -> set to an empty string
However, additional variables do have an impact on the parsing time of
the Makefiles, and the more variables, the more collisions in the hash
table used internally by make, which slows down the parsing.
By dropping those conditionally-set-empty variables, we gain about 3%:
Run Before After
1 5.572 5.325
2 5.434 5.354
3 5.490 5.320
4 5.525 5.330
5 5.476 5.330
6 5.511 5.434
7 5.498 5.388
8 5.524 5.371
9 5.479 5.346
10 5.637 5.324
Mean: 5.515 5.352
Yeah, 0.163s does not look like much, and this does not make
autocompletion any more usable. Still, that 3% gain is not to be
ashamed of either.
Note that there are 3 others case where we do set empty variables, but
those are unconditional and serve other purposes:
- pkg-virtual: this is done on purpose to avoid a bug when the
environment may have TOOLCHAIN_VERSION or _SOURCE set, and we really
want those to be empty, so the assignment is not conditional;
- pkg-python: the reason for setting those to empty is dubious at
best; it's been there since the inception of the python infra, back
in 2013; still, the case is different than this patch addresses;
- pkg-toolchain-external: this is the case for a toolchain already
installed, so indeed we want to set _SOURCE and _VERSION to empty.
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
committed by
Thomas Petazzoni
parent
1b7017c62c
commit
1f6b283dd9
@@ -160,10 +160,6 @@ ifeq ($(4),host)
|
||||
$(2)_AUTORECONF_OPTS ?= $$($(3)_AUTORECONF_OPTS)
|
||||
endif
|
||||
|
||||
$(2)_CONF_ENV ?=
|
||||
$(2)_CONF_OPTS ?=
|
||||
$(2)_MAKE_ENV ?=
|
||||
$(2)_MAKE_OPTS ?=
|
||||
$(2)_INSTALL_OPTS ?= install
|
||||
$(2)_INSTALL_STAGING_OPTS ?= DESTDIR=$$(STAGING_DIR) install
|
||||
$(2)_INSTALL_TARGET_OPTS ?= DESTDIR=$$(TARGET_DIR) install
|
||||
|
||||
@@ -51,11 +51,7 @@ endif
|
||||
|
||||
define inner-cmake-package
|
||||
|
||||
$(2)_CONF_ENV ?=
|
||||
$(2)_CONF_OPTS ?=
|
||||
$(2)_MAKE ?= $$(MAKE)
|
||||
$(2)_MAKE_ENV ?=
|
||||
$(2)_MAKE_OPTS ?=
|
||||
$(2)_INSTALL_OPTS ?= install
|
||||
$(2)_INSTALL_STAGING_OPTS ?= DESTDIR=$$(STAGING_DIR) install/fast
|
||||
$(2)_INSTALL_TARGET_OPTS ?= DESTDIR=$$(TARGET_DIR) install/fast
|
||||
|
||||
@@ -540,8 +540,6 @@ $(2)_DIR = $$(BUILD_DIR)/$$($(2)_BASENAME)
|
||||
ifndef $(2)_SUBDIR
|
||||
ifdef $(3)_SUBDIR
|
||||
$(2)_SUBDIR = $$($(3)_SUBDIR)
|
||||
else
|
||||
$(2)_SUBDIR ?=
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -838,31 +836,6 @@ $(2)_EXTRACT_CMDS ?= \
|
||||
$$(TAR_OPTIONS) -)
|
||||
|
||||
# pre/post-steps hooks
|
||||
$(2)_PRE_DOWNLOAD_HOOKS ?=
|
||||
$(2)_POST_DOWNLOAD_HOOKS ?=
|
||||
$(2)_PRE_EXTRACT_HOOKS ?=
|
||||
$(2)_POST_EXTRACT_HOOKS ?=
|
||||
$(2)_PRE_RSYNC_HOOKS ?=
|
||||
$(2)_POST_RSYNC_HOOKS ?=
|
||||
$(2)_PRE_PATCH_HOOKS ?=
|
||||
$(2)_POST_PATCH_HOOKS ?=
|
||||
$(2)_PRE_CONFIGURE_HOOKS ?=
|
||||
$(2)_POST_CONFIGURE_HOOKS ?=
|
||||
$(2)_PRE_BUILD_HOOKS ?=
|
||||
$(2)_POST_BUILD_HOOKS ?=
|
||||
$(2)_PRE_INSTALL_HOOKS ?=
|
||||
$(2)_POST_INSTALL_HOOKS ?=
|
||||
$(2)_PRE_INSTALL_STAGING_HOOKS ?=
|
||||
$(2)_POST_INSTALL_STAGING_HOOKS ?=
|
||||
$(2)_PRE_INSTALL_TARGET_HOOKS ?=
|
||||
$(2)_POST_INSTALL_TARGET_HOOKS ?=
|
||||
$(2)_PRE_INSTALL_IMAGES_HOOKS ?=
|
||||
$(2)_POST_INSTALL_IMAGES_HOOKS ?=
|
||||
$(2)_PRE_LEGAL_INFO_HOOKS ?=
|
||||
$(2)_POST_LEGAL_INFO_HOOKS ?=
|
||||
$(2)_TARGET_FINALIZE_HOOKS ?=
|
||||
$(2)_ROOTFS_PRE_CMD_HOOKS ?=
|
||||
|
||||
$(2)_POST_PREPARE_HOOKS += FIXUP_PYTHON_SYSCONFIGDATA
|
||||
|
||||
ifeq ($$($(2)_TYPE),target)
|
||||
|
||||
@@ -81,9 +81,6 @@ define inner-kconfig-package
|
||||
# Default values
|
||||
$(2)_MAKE ?= $$(MAKE)
|
||||
$(2)_KCONFIG_EDITORS ?= menuconfig
|
||||
$(2)_KCONFIG_OPTS ?=
|
||||
$(2)_KCONFIG_FIXUP_CMDS ?=
|
||||
$(2)_KCONFIG_FRAGMENT_FILES ?=
|
||||
$(2)_KCONFIG_DOTCONFIG ?= .config
|
||||
$(2)_KCONFIG_SUPPORTS_DEFCONFIG ?= YES
|
||||
|
||||
|
||||
@@ -45,10 +45,6 @@ NINJA_OPTS = $(if $(VERBOSE),-v) -j$(PARALLEL_JOBS)
|
||||
|
||||
define inner-meson-package
|
||||
|
||||
$(2)_CONF_ENV ?=
|
||||
$(2)_CONF_OPTS ?=
|
||||
$(2)_NINJA_ENV ?=
|
||||
|
||||
#
|
||||
# Configure step. Only define it if not already defined by the package
|
||||
# .mk file. And take care of the differences between host and target
|
||||
|
||||
@@ -108,10 +108,6 @@ HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \
|
||||
|
||||
define inner-python-package
|
||||
|
||||
$(2)_ENV ?=
|
||||
$(2)_BUILD_OPTS ?=
|
||||
$(2)_INSTALL_OPTS ?=
|
||||
|
||||
ifndef $(2)_SETUP_TYPE
|
||||
ifdef $(3)_SETUP_TYPE
|
||||
$(2)_SETUP_TYPE = $$($(3)_SETUP_TYPE)
|
||||
|
||||
@@ -40,10 +40,6 @@ endef
|
||||
|
||||
define inner-qmake-package
|
||||
|
||||
$(2)_CONF_ENV ?=
|
||||
$(2)_CONF_OPTS ?=
|
||||
$(2)_MAKE_ENV ?=
|
||||
$(2)_MAKE_OPTS ?=
|
||||
$(2)_INSTALL_STAGING_OPTS ?= install
|
||||
$(2)_INSTALL_TARGET_OPTS ?= $$($(2)_INSTALL_STAGING_OPTS)
|
||||
|
||||
|
||||
@@ -49,11 +49,6 @@ else
|
||||
$(2)_WAF ?= ./waf
|
||||
endif
|
||||
|
||||
$(2)_BUILD_OPTS ?=
|
||||
$(2)_INSTALL_STAGING_OPTS ?=
|
||||
$(2)_INSTALL_TARGET_OPTS ?=
|
||||
$(2)_WAF_OPTS ?=
|
||||
|
||||
#
|
||||
# Configure step. Only define it if not already defined by the package
|
||||
# .mk file.
|
||||
|
||||
Reference in New Issue
Block a user