Unix Programming - automake question

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > October 2005 > automake question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author automake question
SamMiller0@gmail.com

2005-10-24, 3:48 pm

Hello,

I have a project configured with GNU autoconf and automake. My code is
setup in four different directories:

source
|
---> common
|
---> server
|
---> clients
|
---> nodes

Each directory has a correspoding Makefile.am to define build rules.
My problem is the binaries that are built according to my rules reside
in the same directory as the source. I'd like to have all the binaries
located a bin directory which is at the same level as the source
directory. Can anyone tell me if this is possible?

Måns Rullgård

2005-10-24, 3:48 pm

"SamMiller0@gmail.com" <SamMiller0@gmail.com> writes:

> Hello,
>
> I have a project configured with GNU autoconf and automake. My code is
> setup in four different directories:
>
> source
> |
> ---> common
> |
> ---> server
> |
> ---> clients
> |
> ---> nodes
>
> Each directory has a correspoding Makefile.am to define build rules.


I suggest you read Peter Miller's paper "Recursive Make Considered
Harmful" at http://www.pcug.org.au/~millerp/rmc...cons-harm.html.

> My problem is the binaries that are built according to my rules reside
> in the same directory as the source. I'd like to have all the binaries
> located a bin directory which is at the same level as the source
> directory. Can anyone tell me if this is possible?


I don't think automake supports it through the flip of a switch. It
can still be done with some tinkering.

--
Måns Rullgård
mru@inprovide.com
SamMiller0@gmail.com

2005-10-24, 3:48 pm

Hi M=E5ns, thank you for the link. I read the paper and re-organized my
multitude of Makefile.am's into one Makefile.am residing in the bin
directory of my project. This solved my original problem but now I
have a new problem...

Previously, I set AM_CPPFLAGS in each Makefile.am in the source
directory, however now that I only have one Makefile.am, I need to set
the preprocessor flags on a per-binary basis. The automake manual says
I can do this by defining programname_CPPFLAGS in the Makefile.am file.
I tried this, and it does not work for some reason.

Here is the excerpt from my Makefile.am:
fountainServer_CPPFLAGS =3D -I../source/common -I../../source/common +
$(AM_CPPFLAGS)
fountainServer_SOURCES =3D ../source/server/server.cpp
..=2E/source/server/FountainServer.cpp ../source/server/ServerMessage.cpp
..=2E/source/common/FountainSocketHandlers.cpp
..=2E/source/common/Hostname.cpp ../source/common/NodeID.cpp +
$(commonSources) + $(infinibandSources)

And here is the first line after executing make in the top level
directory. Note it is not including the correct -I flags. I have
ommitted the 120 or so lines of errors since most of my header files
that reside in source/common/ cannot be found:

g++ -DHAVE_CONFIG_H -I. -I. -I.. -pedantic -ggdb -c -o
..=2E/source/server/server.o `test -f '../source/server/server.cpp' ||
echo './'`../source/server/server.cpp =20

Thank you for your help.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com