bug-automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54020: Impossible to pass `-no-suppress` to `libtool` via automake f


From: Mike Frysinger
Subject: bug#54020: Impossible to pass `-no-suppress` to `libtool` via automake files
Date: Wed, 23 Feb 2022 01:12:40 -0500

On 17 Feb 2022 16:33, Karl Berry wrote:
> Hi Damian - thanks for the report.
> 
>     LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
>             $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
>             $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
>             $(AM_CFLAGS) $(CFLAGS)
>     ...
>     `libtool` has a command line option, `-no-suppress` ...
> 
> Well, the immediate answer would apparently be to add yet another
> variable after the --mode=compile, say LTMODEOPTS for the sake of
> argument (have to think about the name), so the output is
> 
> LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
>         $(LIBTOOLFLAGS) --mode=compile $(LTMODEOPTS) $(CC) ...

to clarify, Damian isn't saying it has to be between --mode=compile & $(CC).
in fact, pretty sure this doesn't work as libtool expects the argv to be the
arguments right after --mode=compile.

$ libtool --tag=CC --mode=compile -no-suppress gcc test.c -c -o test.o
Usage: /usr/bin/libtool [OPTION]... [MODE-ARG]...
Try 'libtool --help' for more information.
libtool:   error: unrecognised option: '-no-suppress'

the right command line is:
$ libtool --tag=CC --mode=compile gcc test.c -c -o test.o -no-suppress

so i think we can reframe the request as: Automake offers no way of specifying
flags that are only used at compile time.  breaking down LTCOMPILE (for C):
* $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) 
--mode=compile:
  doesn't help as comes before $(CC) and we need flags to be after
* $(CC): used for preprocessing & compiling, and linking, and default for
  linking via `CCLD = $(CC)`
* $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS): used for
  preprocessing (dep generation, etc...) and compiling
* $(AM_CFLAGS) $(CFLAGS): used for preprocessing, compiling, and linking

if we look at the linking phase specifically, it's possible to put libtool
flags into xxx_LDFLAGS.  this is good, and what we already document+recommend.

my inclination is to introduce two new variables that would be used for libtool
& non-libtool, and only when compiling.
* xxx_COMPILE: to provide parity with existing xxx_LINK setting -- override
  the compiler on a per-program basis
* xxx_COMPILEFLAGS: appended only to compile calls so it can override all the
  variables that are shared with other commands

my only gripe is the lack of parity between other stages from a naming pov,
but i think we just have to swallow this pill.  most flags are based on the
language selection rather than the phase (e.g. CFLAGS is for C language and
is used for preprocessing, compiling, and linking C code).  LDFLAGS is only
for linking -- it's language independent.  if we added xxx_LINKFLAGS, it
would serve the same exact purpose as xxx_LDFLAGS, so doesn't add a whole
lot of value.
-mike

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]