Discussion:
warning: TEST_LDFLAGS' is defined but no program or library has 'TEST' as canonical name
Thomas Martitz
2017-11-20 16:17:08 UTC
Permalink
Hello,

here's some quite annoying warning. I'm trying to define a variable
TEST_LDFLAGS that multiple programs use. There is no program named TEST.
The same works fine with TEST_CFLAGS (i.e. no warning is displayed).

Here's the warning:

Makefile.am:4: warning: variable 'TEST_LDFLAGS' is defined but no program or
Makefile.am:4: library has 'TEST' as canonical name (possible typo)

Here's the Makefile.am

TEST_CFLAGS = -g
TEST_LDFLAGS = -Wl,-z,defs

bin_PROGRAMS = test

test_CFLAGS = $(TEST_CFLAGS)
test_LDFLAGS = $(TEST_LDFLAGS)

Is this known? Is there a workaround? Can I ignore the warning?

Best regards.
Nick Bowler
2017-11-20 18:01:38 UTC
Permalink
Hi,
Post by Thomas Martitz
here's some quite annoying warning. I'm trying to define a variable
TEST_LDFLAGS that multiple programs use. There is no program named TEST.
The same works fine with TEST_CFLAGS (i.e. no warning is displayed).
Makefile.am:4: warning: variable 'TEST_LDFLAGS' is defined but no program or
Makefile.am:4: library has 'TEST' as canonical name (possible typo)
I'm surprised there is no warning with CFLAGS; it appears this warning
is issued for mumble_SOURCES, LIBADD, LDADD, LDFLAGS and DEPENDENCIES
only.
Post by Thomas Martitz
Here's the Makefile.am
TEST_CFLAGS = -g
TEST_LDFLAGS = -Wl,-z,defs
bin_PROGRAMS = test
test_CFLAGS = $(TEST_CFLAGS)
test_LDFLAGS = $(TEST_LDFLAGS)
Is this known? Is there a workaround? Can I ignore the warning?
If you were to later add a program called TEST, then the results could
be surprising. But you can certainly ignore the warning if you'd like.

Alternately you can perhaps use a different name that does not conflict
with the Automake naming structure. Perhaps LDFLAGS_FOR_TEST?

You can disable the warning outright with -Wno-syntax (but this might
disable more than you'd like).

Finally, this warning is not issued for variables substituted by configure.

Cheers,
Nick
Thomas Martitz
2017-11-20 18:18:14 UTC
Permalink
Post by Nick Bowler
Hi,
If you were to later add a program called TEST, then the results could
be surprising. But you can certainly ignore the warning if you'd like.
I understand that, however we're extremely unlikely to build programs
named in all-upper case.
Post by Nick Bowler
Alternately you can perhaps use a different name that does not conflict
with the Automake naming structure. Perhaps LDFLAGS_FOR_TEST?
Thanks,

somehow the idea of simply adding a suffix didn't occur to me, besides
being so obvious and simple. I'll go with that.

Best regards

Loading...