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>
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=.
$(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
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))