On Mon, 17 Jan 2005 12:23:58 +1100
Ian Su <[EMAIL PROTECTED]> wrote:

> I have an automake question. Any help is appreciated.
> 
> Suppose I have a C source tree like this:
> 
>  src/game.c
>  src/utils/util.c
>  src/gfx/gfx.c
> 
> and I need to compile "game", which simply contains all the .c files as 
> objects.
> 
> I could simply put
> 
>  bin_PROGRAMS = game
>  game_SOURCES = game.c utils/util.c gfx/gfx.c
> 
> in my src/Makefile.am, but what I really want is to be able to have
> a Makefile in each subdirectory (that compiles the .o file in their
> respective subdir), and a recursive Makefile in src/ that takes the
> all objects, and compiles game.

Search the web for a paper by local guy (Cental Coast) Peter Miller
named "Recursive Make Considered Harmful."

> Is there any way to do this (elegantly)?

At the top of your Makefile.am put:

    SUBDIRS = utils gfx

and then add a Makefile.am in each of those directories.

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  [EMAIL PROTECTED] (Yes it's valid)
+-----------------------------------------------------------+
Being really good at C++ is like being really good at using rocks to 
sharpen sticks." -- Thant Tessman
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to