[openwrt/openwrt] tools/elfutils: add maintainer-clean to clean target
LEDE Commits
lede-commits at lists.infradead.org
Sat Jul 26 05:38:51 PDT 2025
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/c83941d288408308126a6f6bda12eca06a43253c
commit c83941d288408308126a6f6bda12eca06a43253c
Author: Michael Pratt <mcpratt at pm.me>
AuthorDate: Tue Sep 24 18:50:15 2024 -0400
tools/elfutils: 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 delete itself or libtool.
In order to enable rules for building what is removed,
maintainer mode is required for configuring.
Building from tracked sources only with maintainer mode
requires a lexical analyzer, so add dependency for bison.
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.
The function obstack_printf() is not present on macOS,
so use the available gnulib module and their dependencies.
Many more modules from gnulib are now needed,
and some replacements of some functions must be skipped
to prevent build errors at link time.
Tested-by: Georgi Valkov <gvalkov at gmail.com> # macOS
Signed-off-by: Michael Pratt <mcpratt at pm.me>
Link: https://github.com/openwrt/openwrt/pull/16522
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
tools/Makefile | 2 +-
tools/elfutils/Makefile | 32 +++++++++++++++++++++++++++++++-
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/tools/Makefile b/tools/Makefile
index 800647762f..9188622eb9 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -100,7 +100,7 @@ $(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/ninja/compile $(
$(curdir)/coreutils/compile := $(curdir)/automake/compile $(curdir)/bison/compile $(curdir)/gnulib/compile
$(curdir)/dosfstools/compile := $(curdir)/automake/compile
$(curdir)/e2fsprogs/compile := $(curdir)/libtool/compile $(curdir)/util-linux/compile
-$(curdir)/elfutils/compile := $(curdir)/m4/compile $(curdir)/zlib/compile $(curdir)/gnulib/compile $(curdir)/libtool/compile
+$(curdir)/elfutils/compile := $(curdir)/bison/compile $(curdir)/gnulib/compile $(curdir)/m4/compile $(curdir)/zlib/compile
$(curdir)/erofs-utils/compile := $(curdir)/libtool/compile $(curdir)/xz/compile $(curdir)/lz4/compile $(curdir)/util-linux/compile
$(curdir)/fakeroot/compile := $(curdir)/libtool/compile
$(curdir)/findutils/compile := $(curdir)/bison/compile
diff --git a/tools/elfutils/Makefile b/tools/elfutils/Makefile
index 6aa23bfbc5..625cecf58c 100644
--- a/tools/elfutils/Makefile
+++ b/tools/elfutils/Makefile
@@ -43,7 +43,7 @@ PKG_GNULIB_MODS = \
fallocate-posix \
fnmatch-gnu \
fts \
- obstack \
+ obstack-printf-posix \
progname \
strchrnul \
tsearch
@@ -51,16 +51,39 @@ PKG_GNULIB_MODS = \
include $(INCLUDE_DIR)/host-build.mk
export $(PKG_GNULIB_BASE)=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/.libs/$(PKG_GNULIB_BASE).a
+
+export $(PKG_GNULIB_BASE)_exitfail=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/$(PKG_GNULIB_BASE)_la-exitfail.o
export $(PKG_GNULIB_BASE)_fallocate-posix=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/$(PKG_GNULIB_BASE)_la-posix_fallocate.o
+export $(PKG_GNULIB_BASE)_mbszero=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/$(PKG_GNULIB_BASE)_la-mbszero.o
+export $(PKG_GNULIB_BASE)_obstack=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/$(PKG_GNULIB_BASE)_la-obstack.o
+export $(PKG_GNULIB_BASE)_obstack-printf=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/$(PKG_GNULIB_BASE)_la-obstack_printf.o
+export $(PKG_GNULIB_BASE)_printf-args=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/$(PKG_GNULIB_BASE)_la-printf-args.o
+export $(PKG_GNULIB_BASE)_printf-frexp=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/$(PKG_GNULIB_BASE)_la-printf-frexp.o
+export $(PKG_GNULIB_BASE)_printf-frexpl=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/$(PKG_GNULIB_BASE)_la-printf-frexpl.o
+export $(PKG_GNULIB_BASE)_printf-parse=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/$(PKG_GNULIB_BASE)_la-printf-parse.o
export $(PKG_GNULIB_BASE)_tsearch=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/$(PKG_GNULIB_BASE)_la-tsearch.o
+export $(PKG_GNULIB_BASE)_vasnprintf=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/$(PKG_GNULIB_BASE)_la-vasnprintf.o
+export $(PKG_GNULIB_BASE)_xsize=$(HOST_BUILD_DIR)/$(PKG_GNULIB_BASE)/$(PKG_GNULIB_BASE)_la-xsize.o
HOST_MAKE_FLAGS += \
+ am__CONFIG_DISTCLEAN_FILES= \
DEFAULT_INCLUDES='-iquote . -I$$$$(top_builddir) -I$$$$(top_srcdir)/$(PKG_GNULIB_BASE)' \
AM_LDFLAGS='$$$$(STACK_USAGE_NO_ERROR)' \
LIBS+='$$$$(if $$$$(findstring $(lastword $(PKG_SUBDIRS)),$$$$(subdir)), $$$$($(PKG_GNULIB_BASE)))' \
+ LIBS+='$$$$(wildcard $$$$($(PKG_GNULIB_BASE)_exitfail))' \
LIBS+='$$$$(wildcard $$$$($(PKG_GNULIB_BASE)_fallocate-posix))' \
+ LIBS+='$$$$(wildcard $$$$($(PKG_GNULIB_BASE)_mbszero))' \
+ LIBS+='$$$$(wildcard $$$$($(PKG_GNULIB_BASE)_obstack))' \
+ LIBS+='$$$$(wildcard $$$$($(PKG_GNULIB_BASE)_obstack-printf))' \
+ LIBS+='$$$$(wildcard $$$$($(PKG_GNULIB_BASE)_printf-args))' \
+ LIBS+='$$$$(wildcard $$$$($(PKG_GNULIB_BASE)_printf-frexp))' \
+ LIBS+='$$$$(wildcard $$$$($(PKG_GNULIB_BASE)_printf-frexpl))' \
+ LIBS+='$$$$(wildcard $$$$($(PKG_GNULIB_BASE)_printf-parse))' \
LIBS+='$$$$(wildcard $$$$($(PKG_GNULIB_BASE)_tsearch))' \
+ LIBS+='$$$$(wildcard $$$$($(PKG_GNULIB_BASE)_vasnprintf))' \
+ LIBS+='$$$$(wildcard $$$$($(PKG_GNULIB_BASE)_xsize))' \
REPLACE_FCNTL=0 REPLACE_FREE=0 REPLACE_FSTAT=0 REPLACE_OPEN=0 \
+ REPLACE_OBSTACK=0 REPLACE_OBSTACK_PRINTF=0 \
bin_PROGRAMS='$(PKG_PROGRAMS)' EXEEXT=
HOST_CPPFLAGS += "'-I$$$$(top_srcdir)/lib'"
@@ -72,6 +95,7 @@ endif
HOST_CFLAGS += -Wno-error -fPIC -std=gnu17
HOST_CONFIGURE_ARGS += \
+ --enable-maintainer-mode \
--without-libintl-prefix \
--without-libiconv-prefix \
--disable-debuginfod \
@@ -96,8 +120,14 @@ HOST_CONFIGURE_VARS += \
Hooks/HostConfigure/Pre := Host/Gnulib/Prepare $(Hooks/HostConfigure/Pre)
Hooks/HostCompile/Pre := Host/Gnulib/Compile $(Hooks/HostCompile/Pre)
+define Host/Configure
+ $(call Host/Configure/Default)
+ $(call Host/Uninstall)
+endef
+
define Host/Uninstall
-$(call Host/Compile/Default,uninstall)
+ -$(call Host/Compile/Default,maintainer-clean) # Clean bootstrap files from the release
endef
$(eval $(call HostBuild))
More information about the lede-commits
mailing list