[Top][All Lists]

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

Re: Problems with conditional sources

From: David Sveningsson
Subject: Re: Problems with conditional sources
Date: Mon, 25 Aug 2008 22:24:31 +0200
User-agent: Thunderbird (X11/20080727)

John Calcote skrev:
David Sveningsson wrote:
Hi, I am having some problems with conditional sources. This is what I
have in

libfoo_la_SOURCES = foo.cpp
    libfoo_la_SOURCES += a.cpp
    libfoo_la_SOURCES += b.cpp

AM_CPPFLAGS = -I${top_srcdir}/include
libfoo_la_LDFLAGS = -version-info 0:0:0

I have been reading both autoconf and automake manuals and as far as I
can see the above should work. However the files (a.cpp or b.cpp) is
always added at the bottom of the generated Makefile and are therefore
not used in the compilation. No matter what I try I cannot get even the
above code to generate a correct makefile but obviously I am doing
something wrong.


Make is a two-pass utility. The first pass completely assimilates all
macro data specified in the Makefile. THEN, the second pass generates
the rule dependency tree. AFTER the second pass, the tree is evaluated
to see what needs to be rebuilt.

Thus, it doesn't matter where macros are assigned, as value assignments
to macros are managed in the first stage, before any macros are ever
expanded when the dependency tree is evaluated.

Yes, as you've noticed conditional (and non-conditional)
macro assignments are added to the bottom of the generated
(and consequently to the bottom of the Makefile itself), but the point
is that it doesn't matter where they're added. The value of an expanded
macro always takes into account the final assignment in the Makefile.

Thanks for your reply.

While that would make sense but my problem originates from the fact that the conditional files isn't compiled.

After some hacking into the generated Makefile I noticed that the files wouldn't be compiled even if I inserted them into libfoo_la_SOURCES manually. However, I found that I had to inserting them into am_libfoo_la_OBJECTS with the lo extension to make it work. Shouldn't automake manage this?

I am just learning autotools so it might be a very simple mistake.

//*David Sveningsson [eXt]*

Freelance coder | Game Development Student

Thou shalt make thy program's purpose and structure clear to thy fellow
man by using the One True Brace Style, even if thou likest it not, for
thy creativity is better used in solving problems than in creating
beautiful new impediments to understanding.

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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