automake
[Top][All Lists]
Advanced

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

Re: Plan for single Makefile


From: Alexandre Duret-Lutz
Subject: Re: Plan for single Makefile
Date: 28 Jul 2001 20:19:47 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>> "Tom" == Tom Tromey <address@hidden> writes:

[...]

 Tom> Next we would add a new `import' statement.  This would work like
 Tom> `include', but would perform some automatic rewriting.

I've played with `include' to combine subdirectories Makefiles
with a toplevel Makefile.  The lack of %subdir% substitution is
the main problem (you have to hardcode the subdir path in the
subdir Makefile), but there is at least two other thoughts I'd
like to mention.  (I'm sorry that's just some minor points of
detail compared to the other answers.)

The first point might be a bug in Automake-current: I've never
understood why "include foo/Makefile.inc" doesn't add
foo/Makefile.inc to EXTRA_DIST automatically.  I need to add all
included files manually.  I could not find a case when one does
not want an included file to be distributed (since it's needed
by Automake).  The same question apply to import.
  
Another thing is that Automake contains some special machinery
to prevent the user from assigning twice to the same variable in
a Makefile.am.  This is quite annoying when you include
Makefiles from subdirectories, because you have to be careful to
*append* to variables instead of assigning to them.  See the
assignements to EXTRA_DIST and bin_PROGRAMS in the following:

-- Makefile.am
...
EXTRA_DIST= sub1/Makefile.inc sub2/Makefile.inc
bin_PROGRAMS=
...
include sub1/Makefile.inc
include sub2/Makefile.inc
...
-- sub1/Makefile.inc
...
EXTRA_DIST+= sub1/file1
bin_PROGRAMS+= sub1/foo
sub1_foo_SOURCES= sub1/foo.c sub1/foo.h
...
-- sub2/Makefile.inc
...
EXTRA_DIST+= sub2/file2 sub2/file3
bin_PROGRAMS+= sub2/bar
sub2_bar_SOURCES= sub2/bar.c sub2/bar.h
...

As I understand, the plan with import is to rewrite this as
follow:

-- Makefile.am
...
import sub1/Makefile.inc
import sub2/Makefile.inc
...
-- sub1/Makefile.inc
...
EXTRA_DIST= file1
bin_PROGRAMS= foo
foo_SOURCES= foo.c foo.h
...
-- sub2/Makefile.inc
...
EXTRA_DIST= file2 file3
bin_PROGRAMS= bar
bar_SOURCES= bar.c bar.h
...

So in some way, Automake will have to accept multiple
assignments to the same variable.

[...]
-- 
Alexandre Duret-Lutz



reply via email to

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