# package, and more.
#
-define KCONFIG_ENABLE_OPT # (option, file)
- $(SED) "/\\<$(1)\\>/d" $(2)
- echo '$(1)=y' >> $(2)
-endef
-
-define KCONFIG_SET_OPT # (option, value, file)
- $(SED) "/\\<$(1)\\>/d" $(3)
- echo '$(1)=$(2)' >> $(3)
-endef
-
-define KCONFIG_DISABLE_OPT # (option, file)
- $(SED) "/\\<$(1)\\>/d" $(2)
- echo '# $(1) is not set' >> $(2)
-endef
+# KCONFIG_MUNGE_DOT_CONFIG (option, newline, file)
+define KCONFIG_MUNGE_DOT_CONFIG
+ $(SED) "/\\<$(strip $(1))\\>/d" $(strip $(3))
+ echo '$(strip $(2))' >> $(strip $(3))
+endef
+
+# KCONFIG_ENABLE_OPT (option, file)
+KCONFIG_ENABLE_OPT = $(call KCONFIG_MUNGE_DOT_CONFIG, $(1), $(1)=y, $(2))
+# KCONFIG_SET_OPT (option, value, file)
+KCONFIG_SET_OPT = $(call KCONFIG_MUNGE_DOT_CONFIG, $(1), $(1)=$(2), $(3))
+# KCONFIG_DISABLE_OPT (option, file)
+KCONFIG_DISABLE_OPT = $(call KCONFIG_MUNGE_DOT_CONFIG, $(1), $(SHARP_SIGN) $(1) is not set, $(2))
# Helper functions to determine the name of a package and its
# directory from its makefile directory, using the $(MAKEFILE_LIST)