Include files outside srcdir?

View: New views
6 Messages — Rating Filter:   Alert me  

Include files outside srcdir?

by Joseph Garvin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a number of autotooled libraries. Currently their Makefile.am's
are largely redundant, so I thought I would use the 'include' keyword
and have them pull their common parts from some file. But as far as I
can tell, the include isn't being observed by automake -- instead it's
ignored and passed on to make, where it defines targets that make
doesn't care about (install-exec-hook, etc.). The documentation says
automake only pays attention to includes that start with $(srcdir) or
$(top_srcdir), but that's not possible in this instance, because each
library is its own project (recursive make isn't being used). Is there
anyway to do this? The only thing I can think of is having the include
define the regular make targets and bypass the help automake would
usually provide.



Re: Include files outside srcdir?

by Peter Johansson-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Joseph Garvin wrote:

> I have a number of autotooled libraries. Currently their Makefile.am's
> are largely redundant, so I thought I would use the 'include' keyword
> and have them pull their common parts from some file. But as far as I
> can tell, the include isn't being observed by automake -- instead it's
> ignored and passed on to make, where it defines targets that make
> doesn't care about (install-exec-hook, etc.). The documentation says
> automake only pays attention to includes that start with $(srcdir) or
> $(top_srcdir), but that's not possible in this instance, because each
> library is its own project (recursive make isn't being used). Is there
> anyway to do this? The only thing I can think of is having the include
> define the regular make targets and bypass the help automake would
> usually provide.
>
>
>  
I'm not sure exactly what you wanna achieve here. But there is an
autoconf macro
http://www.nongnu.org/autoconf-archive/ax_add_am_macro_static.html
which allows you to have autoconf to generate automake input. So one way
you could do is to use this macro to create your code snippet and then
install the macro where aclocal can find it. In this way you can reuse
the code in several projects.

Peter

--
Peter Johansson

svndigest maintainer, http://dev.thep.lu.se/svndigest
yat maintainer,       http://dev.thep.lu.se/yat




Re: Include files outside srcdir?

by Ralf Wildenhues :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* Peter Johansson wrote on Tue, Nov 03, 2009 at 07:31:56PM CET:
> Joseph Garvin wrote:
> >I have a number of autotooled libraries. Currently their Makefile.am's
> >are largely redundant, so I thought I would use the 'include' keyword
> >and have them pull their common parts from some file. But as far as I
> >can tell, the include isn't being observed by automake -- instead it's
> >ignored and passed on to make, where it defines targets that make
> >doesn't care about (install-exec-hook, etc.).

Can you show a small example that doesn't work?  Thanks.

> > The documentation says
> >automake only pays attention to includes that start with $(srcdir) or
> >$(top_srcdir), but that's not possible in this instance, because each
> >library is its own project (recursive make isn't being used).

But these two features don't exclude each other.  You can use
  $(top_srcdir)/../foo/fragment.am

> I'm not sure exactly what you wanna achieve here. But there is an
> autoconf macro
> http://www.nongnu.org/autoconf-archive/ax_add_am_macro_static.html
> which allows you to have autoconf to generate automake input.

Hmm, the idea of having such a is not bad, but I don't think it should
need to go via esyscmd.  Maybe Automake should provide something
similar.

Cheers,
Ralf



Re: Include files outside srcdir?

by Peter Johansson-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ralf,

Ralf Wildenhues wrote:

> * Peter Johansson wrote on Tue, Nov 03, 2009 at 07:31:56PM CET:
>  
>> I'm not sure exactly what you wanna achieve here. But there is an
>> autoconf macro
>> http://www.nongnu.org/autoconf-archive/ax_add_am_macro_static.html
>> which allows you to have autoconf to generate automake input.
>>    
>
> Hmm, the idea of having such a is not bad, but I don't think it should
> need to go via esyscmd.
I'm curious about your idea on how to implement it without esyscmd.
Could you please elaborate a bit? I suppose Allan wouldn't mind
improving the macro if you have any suggestions.

Thanks,
Peter




Re: Include files outside srcdir?

by Joseph Garvin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I could use .., but that's not robust if I change where the libraries are
stored relative to the .am I want to include. I was planning to do:

include $(SPECIAL_ENVIRONMENT_VAR)/automake/install_targets.am

etc. for the different repeated parts. The environment variable could point
anywhere on the filesystem. For now I've setup each projects bootstrap to
make a symlink'd install_targets.am to that one, but that feels extremely
hackish.

On Nov 3, 2009 3:44 PM, "Ralf Wildenhues" <Ralf.Wildenhues@...> wrote:

* Peter Johansson wrote on Tue, Nov 03, 2009 at 07:31:56PM CET:

> Joseph Garvin wrote: > >I have a number of autotooled libraries. Currently
their Makefile.am's > >...
Can you show a small example that doesn't work?  Thanks.

> > The documentation says > >automake only pays attention to includes that
start with $(srcdir) or...
But these two features don't exclude each other.  You can use
 $(top_srcdir)/../foo/fragment.am

> I'm not sure exactly what you wanna achieve here. But there is an >
autoconf macro > http://www.n...
Hmm, the idea of having such a is not bad, but I don't think it should
need to go via esyscmd.  Maybe Automake should provide something
similar.

Cheers,
Ralf

Re: Include files outside srcdir?

by Ralf Wildenhues :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* Peter Johansson wrote on Wed, Nov 04, 2009 at 01:55:21PM CET:
> Ralf Wildenhues wrote:
> >* Peter Johansson wrote on Tue, Nov 03, 2009 at 07:31:56PM CET:
> >>http://www.nongnu.org/autoconf-archive/ax_add_am_macro_static.html

> >Hmm, the idea of having such a is not bad, but I don't think it should
> >need to go via esyscmd.

> I'm curious about your idea on how to implement it without esyscmd.
> Could you please elaborate a bit? I suppose Allan wouldn't mind
> improving the macro if you have any suggestions.

Well, I don't know off-hand of a method without esyscmd; that in itself
is a good reason to have something built into Autoconf/Automake which
provides the functionality.  That's why I wrote

> >Maybe Automake should provide something similar.

but of course I forgot to provide the rationale for this ...

Cheers,
Ralf