Subject: bug#61278: Automake warns about LDFLAGS for defined library

From: Reuben Thomas <[email-masked]>
Date: Sat, 4 Feb 2023 18:27:40 +0000

Using automake 1.16.5, in my Makefile.am, I have the following lines:

noinst_LTLIBRARIES = liba2ps.la
liba2ps_la_LDFLAGS = $(LIBGC_LIBS)
liba2ps_la_SOURCES = $(liba2pssources) $(libitsources) $(mylibitsources)
liba2ps_la_LIBADD = ../lib/libgnu.la $(LIBINTL) $(LIBSOCKET)
$(GETHOSTNAME_LIB)

noinst_LIBRARIES = libnowarnings.a
libnowarnings_a_CFLAGS = $(LIBGC_FLAGS)
libnowarnings_a_LDFLAGS = $(LIBGC_LIBS)
libnowarnings_a_SOURCES = fonts.l lexppd.l parseppd.y regex.c regex.h
confg.c confg.h

(This is from GNU a2ps <https://savannah.gnu.org/projects/a2ps>'s
liba2ps/Makefile.am.)

When automake is run, it warns:

liba2ps/Makefile.am:63: warning: variable 'libnowarnings_a_LDFLAGS' is
defined but no program or
liba2ps/Makefile.am:63: library has 'libnowarnings_a' as canonical name
(possible typo)

I don't understand this, because libnowarnings.a is defined as the
canonical name of a library.

In src/Makfile.am, I have the following lines:

noinst_LIBRARIES = libparse.a
libparse_a_SOURCES = parsessh.y lexssh.l lexps.l sheets-map.l
libparse_a_CFLAGS = $(LIBGC_FLAGS)

and I get no warnings. I have no LTLIBRARIES in this Makefile.am.

If in the first Makefile.am I change the convenience library
"libnowarnings.a" to a libtool library "libnowarnings.la", and add it to
noinst_LTLIBRARIES, and rename the other variables accordingly, then again
I get no warnings.

-- 
https://rrt.sc3d.org