]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
tools/coreutils: add maintainer-clean to clean target
authorMichael Pratt <mcpratt@pm.me>
Fri, 27 Sep 2024 03:30:51 +0000 (23:30 -0400)
committerRobert Marko <robimarko@gmail.com>
Sat, 26 Jul 2025 12:38:08 +0000 (14:38 +0200)
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 <gvalkov@gmail.com> # macOS
Signed-off-by: Michael Pratt <mcpratt@pm.me>
Link: https://github.com/openwrt/openwrt/pull/16522
Signed-off-by: Robert Marko <robimarko@gmail.com>
tools/coreutils/Makefile

index 3dc82afafcfc8f352593a4a613297c15ce14d4f2..42f03317d9f84987c5dbc369b42238c9d2630998 100644 (file)
@@ -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))