automake
[Top][All Lists]
Advanced

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

Re: Generate Custom Compiler / Build Rules?


From: Ralf Wildenhues
Subject: Re: Generate Custom Compiler / Build Rules?
Date: Sun, 13 Sep 2009 19:09:31 +0200
User-agent: Mutt/1.5.20 (2009-08-09)

Hello Xochitl,

* Xochitl Lunde wrote on Thu, Sep 10, 2009 at 09:27:31PM CEST:
> I have an embedded platform for which I override all the make rules by 
> writing the make rules by hand in Makefile.am.  I have tested this out, 
> and it works great, but because we have many unit tests, I have to copy 
> and paste the rules over and over and over as we add unit tests. 

Ouch.  Do you require GNU make or do you target portable make?
If the former, then you should be able to use pattern rules.

> This 
> is just getting unweildy if I ever have to adjust the rule a little bit. I 
> want to figure out how I can have automake create the correct rules for my 
> embedded platform for each item in bin_PROGRAMS. 

OK.

> Also, the 3rd party libraries which I am linking have circular 
> dependencies, and so I end up needing to use the --start-group and 
> --end-group flags in the linker command line.  I haven't been successful 
> trying to figure out which libraries to list in what order, although I am 
> getting closer.

Adding --preserve-dup-deps to AM_LIBTOOLFLAGS or <target>_LIBTOOLFLAGS
can help.

> Automake complains if I put --start-group in 
> networktest_LDFLAGS or in networktest_LDADD.  Is it not possible to use 
> this flag in Makefile.am without defining custom rules?

It ought to work for automake if you use
-Wl,--start-group,-lfoo,-lbar,--end-group but then libtool might reorder
this wrongly for you.  This is a problematic area alright.

> And the very last thing, Automake 1.10 complains about the "$(shell pwd)" 
> in my 'debugfile' definition in Makefile.am, but Automake 1.9.6 handles it 
> just fine.  Which one is confused or how should I write this?

That's due to (quoting automake/NEWS for 1.10):

  - `-Wportability' has finally been turned on by default for `gnu' and
    `gnits' strictness.  This means, automake will complain about %-rules
    or $(GNU Make functions) unless you switch to `foreign' strictness or
    use `-Wno-portability'.


Wrt. your posted Makefile.am file, I don't really see yet how the build
rules for your tests would be factorizable, it only seems to contain
them for one test, no?

> # From Makefile.appbuild.ns9215, additional code needs to be compiled.
> nodist_networktest_SOURCES= $(ac_netos_dir)/src/bsp/common/appconf_api.c
> 
> networktest_INCLUDES = -include 
> $(top_srcdir)/../common/tests/network/networktest.h

I don't think foo_INCLUDES works, you should use foo_CPPFLAGS instead.

> networktest_CXXFLAGS = -W -Wall -Werror --pedantic -O0 -g \
>         -DTESTCLASS=NetworkTest $(networktest_INCLUDES) \
>         -Wno-variadic-macros

Also, as another general remark, Automake makes it easy to have several
different build trees with different build options, e.g., one debug
build:
  ../source/configure CFLAGS=-g ...

and one optimized one:
  ../source/configure CFLAGS=-O42 ...

Glancing at your rules it might not be possible to separate things for
your code but you might at least want to think about it.

Hope that helps.

Cheers,
Ralf




reply via email to

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