Subject: error in distclean and maintainer-clean from releases
From: Michael Pratt <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Mon, 07 Oct 2024 00:32:22 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

After configuring with a release, on my system the variable $(LT_ARGZ_H) ends up being blank.
For building this is no problem, however, if I wanted to run the clean targets there is an error:

  This command is intended for maintainers to use
  it deletes files that may require special tools to rebuild.
  test -z "libtool libtoolize libltdl/libltdl/ ./.version" || rm -f libtool libtoolize libltdl/libltdl/ ./.version
  rm: cannot remove 'libltdl/libltdl/': Is a directory
  make[4]: [Makefile:2003: maintainer-clean-generic] Error 1 (ignored)

even though it is allowed to pass, the rest of the rules do not run for that subdirectory "."
A quick patch can workaround this:

--- a/libltdl/ltdl.mk
+++ b/libltdl/ltdl.mk
@@ -134,7 +134,7 @@ EXTRA_DIST	       += libltdl/COPYING.LIB
 ## Gnulib Makefile.am snippets ##
 ## --------------------------- ##

-BUILT_SOURCES	+= libltdl/libltdl/$(LT_ARGZ_H)
+BUILT_SOURCES	+= $(if $(LT_ARGZ_H),libltdl/libltdl/$(LT_ARGZ_H))
 EXTRA_DIST	+= libltdl/libltdl/lt__argz_.h \
 		   libltdl/lt__argz.c

however this results in a warning:

  libltdl/ltdl.mk:137: warning: if $(LT_ARGZ_H: non-POSIX variable name
  libltdl/ltdl.mk:137: (probably a GNU make extension)

so probably there is a better way to fix it...

--
MCP