From 6a3cfeb4a66763630cca9cb100ec86f5fddbd79b Mon Sep 17 00:00:00 2001 From: Michael Pratt Date: Thu, 26 Sep 2024 23:30:51 -0400 Subject: [PATCH] tools/coreutils: add maintainer-clean to clean target Use the clean recipe during build, so that files already generated by the bootstrapping within the release are removed before the bootstrap script is run again. Automake with modified rules must be ran in order to generate a Makefile that does not delete itself. Override an automake variable "am__CONFIG_DISTCLEAN_FILES" in order to prevent removing config.status and other configure files so that configure stage does not need to be ran twice. Redefine MAINTAINERCLEANFILES with Make functions to avoid deleting the targets of gettext and gperf rules. In order to prevent an inconsistent state of `install` since this utility must always be available as a prerequisite, do not allow it to be removed. Instead of preventing the removal of the config.h header, the Makefile supports regenerating it quickly. Tested-by: Georgi Valkov # macOS Signed-off-by: Michael Pratt Link: https://github.com/openwrt/openwrt/pull/16522 Signed-off-by: Robert Marko --- tools/coreutils/Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/coreutils/Makefile b/tools/coreutils/Makefile index 3dc82afafc..42f03317d9 100644 --- a/tools/coreutils/Makefile +++ b/tools/coreutils/Makefile @@ -35,6 +35,8 @@ HOST_CONFIGURE_ARGS += \ HOST_MAKE_FLAGS += \ $(AM_TOOL_PATHS) AUTOPOINT="$(TRUE)" GTKDOCIZE="$(TRUE)" \ + am__CONFIG_DISTCLEAN_FILES= \ + MAINTAINERCLEANFILES='$$$$(filter-out lib/iconv_open% %.texi,$$$$(BUILT_SOURCES))' \ PROGRAMS="$(patsubst %,src/%,$(PKG_PROGRAMS))" \ LIBRARIES= MANS= SUBDIRS=. @@ -60,6 +62,8 @@ define Host/Configure $(if $(QUILT),$(call Host/Bootstrap)) $(foreach src,$(HOST_GNULIB_SKIP),mv -f $(HOST_BUILD_DIR)/$(src)~ $(HOST_BUILD_DIR)/$(src) || true; ) $(call Host/Configure/Default) + $(call Host/Uninstall) + $(call Host/Compile/Default,lib/config.h) endef define Host/Install @@ -69,8 +73,8 @@ define Host/Install endef define Host/Uninstall - rm -f $(STAGING_DIR_HOST)/bin/install -$(call Host/Compile/Default,uninstall) + -$(call Host/Compile/Default,maintainer-clean) # Clean bootstrap files from the release endef $(eval $(call HostBuild))