[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Makefile.am and xxx_LDFLAGS seems not working
From: |
Stefano Lattarini |
Subject: |
Re: Makefile.am and xxx_LDFLAGS seems not working |
Date: |
Mon, 31 Jan 2011 17:59:21 +0100 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
On Monday 31 January 2011, Pauli Sundberg wrote:
> Hello!
>
> I am trying to add -all-static flag for binaries compiled with autotools.
>
> What i am doing wrong since to me it seems like _LDFLAGS is not working
> when i have _LDFLAGS defined in Automake.am:
>
> > bin_PROGRAMS = linearize
> >
> > linearize_SOURCES = \
> > Linearize/linearize_main.c Linearize/linearizeParameters.c \
> > Linearize/linearizeParameters.h
> >
> > if COND_STATIC_BIN
> > linearize_LDFLAGS = -all-static
>
Did you use a literal tab at the beginning of the line? If yes, then
automake won't consider this line as a variable assignement, but will
be confused into thinking that it's a make recipe (and will it output
unchanged).
My advice: never use leading whitespace before a variable assignement
or a target declaration. The annoying downside is that you can't use
nice indentation with conditionals, the upside is that you won't be
bitten by mistakes like this.
> > endif
>
> If i look at the generated Makefile i can find:
>
> linearize_LDFLAGS = -all-static
>
> but the link command:
> linearize$(EXEEXT): $(linearize_OBJECTS) $(linearize_DEPENDENCIES)
> @rm -f linearize$(EXEEXT)
> $(LINK) $(linearize_OBJECTS) $(linearize_LDADD) $(LIBS)
>
> Where link is:
> LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
> --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
> $(LDFLAGS) -o $@
>
> seems to ignore these linearize_LDFLAGS.
>
> Full Automake.am can be found from:
> http://susundberg.pastebin.com/LuhKbU1K
>
> Generated automake.in:
> http://susundberg.pastebin.com/7HTrC737
>
> And generated Makefile:
> http://susundberg.pastebin.com/rQHUXZc1
>
Thanks for posting these links, they seem to confirm the diagnosis
I've made above.
> Any tips how to start figure out whats wrong? The project has lots of
> Autoconf files and i would rather not post them all here.
>
Removing that leading tab should be enough to solve your problem.
> Thanks!
> Pauli Sundberg
>
>
HTH,
Stefano