package/pkg-kconfig: hide defconfig targets if defconfig not supported

When the savedefconfig target is not supported by a kconfig package,
(like is the case for busybox) it doesn't make sense to define
busybox-savedefconfig or busybox-update-defconfig. Calling these leads
to an error from busybox itself "No rule to make target
'savedefconfig'.", which may be confusing.

Only define the savedefconfig and update-defconfig target if
$(2)_KCONFIG_SUPPORTS_DEFCONFIG is YES.

Note that we also need to define it as phony in the condition, otherwise
'make busybox-update-defconfig' will just say "Nothing to be done" and
we really want the error "No rule to make target
'busybox-update-defconfig'".

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
[yann.morin.1998@free.fr: move PHONY before corresponding rule]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Arnout Vandecappelle (Essensium/Mind) 2021-07-25 16:11:45 +02:00 committed by Yann E. MORIN
parent 3d63951ab8
commit d0c82f20c7

View File

@ -279,8 +279,11 @@ $(1)-check-configuration-done:
exit 1; \
fi
ifeq ($$($(2)_KCONFIG_SUPPORTS_DEFCONFIG),YES)
.PHONY: $(1)-savedefconfig
$(1)-savedefconfig: $(1)-check-configuration-done
$$(call kconfig-package-savedefconfig,$(2))
endif
# Target to copy back the configuration to the source configuration file
# Even though we could use 'cp --preserve-timestamps' here, the separate
@ -289,13 +292,16 @@ $(1)-update-config: PKG=$(2)
$(1)-update-config: $(1)-check-configuration-done
$$(call kconfig-package-update-config,$$($(2)_KCONFIG_DOTCONFIG))
ifeq ($$($(2)_KCONFIG_SUPPORTS_DEFCONFIG),YES)
# Note: make sure the timestamp of the stored configuration is not newer than
# the .config to avoid a useless rebuild. Note that, contrary to
# $(1)-update-config, the reference for 'touch' is _not_ the file from which
# we copy.
.PHONY: $(1)-update-defconfig
$(1)-update-defconfig: PKG=$(2)
$(1)-update-defconfig: $(1)-savedefconfig
$$(call kconfig-package-update-config,defconfig)
endif
# Target to output differences between the configuration obtained via the
# defconfig + fragments (if any) and the current configuration.
@ -315,9 +321,7 @@ endif # package enabled
.PHONY: \
$(1)-update-config \
$(1)-update-defconfig \
$(1)-diff-config \
$(1)-savedefconfig \
$(1)-check-configuration-done \
$$($(2)_DIR)/.kconfig_editor_% \
$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS))