| Author |
Automake: Relative library path?
|
|
|
|
Is there a way to specify relative library paths from configure.ac such
that they automatically are made to point correctly when building in
sub driectories?
For instance, adding an
LDFLAGS=-L../mylibrary
in configure.ac wont help much when building something in a subdir. I
would want configure to be smart enough to add a "../" after the -L
when generating Makefile.in in subdirectories.
(I want to avoid specifying those paths and libraries in every
Makefile.am)
-- Jonas Minnberg
| |
| Aaron Isotton 2006-07-02, 1:44 pm |
| sasq wrote:
> Is there a way to specify relative library paths from configure.ac such
> that they automatically are made to point correctly when building in
> sub driectories?
>
> For instance, adding an
>
> LDFLAGS=-L../mylibrary
>
> in configure.ac wont help much when building something in a subdir. I
> would want configure to be smart enough to add a "../" after the -L
> when generating Makefile.in in subdirectories.
>
> (I want to avoid specifying those paths and libraries in every
> Makefile.am)
Something like
AC_SUBST(MYLIB_DIR, `pwd`/mylibrary)
in your configure.ac
and
prog_LDFLAGS=-l$(MYLIB_DIR)/libmylib.la
in your Makefile.am will do the trick.
Greetings,
Aaron
| |
| Måns Rullgård 2006-07-02, 1:44 pm |
| "sasq" <sasq64@gmail.com> writes:
> Is there a way to specify relative library paths from configure.ac such
> that they automatically are made to point correctly when building in
> sub driectories?
>
> For instance, adding an
>
> LDFLAGS=-L../mylibrary
>
> in configure.ac wont help much when building something in a subdir. I
> would want configure to be smart enough to add a "../" after the -L
> when generating Makefile.in in subdirectories.
Use $(top_builddir). It's set by automake to the top of the build
tree.
--
Måns Rullgård
mru@inprovide.com
| |
|
|
M=E5ns Rullg=E5rd wrote:
> "sasq" <sasq64@gmail.com> writes:
>
>
> Use $(top_builddir). It's set by automake to the top of the build
> tree.
But wont this be evaluated too early if I use it in configure.ac ?
I guess I could store the relative path in question in a separate
variable, say MYLIBDIR and from each automake file I reference
$(top_builddir)/$(MYLIBDIR) - but thats a hack...
What I really want to do is check for a specific library that is either
in the global library path or in a set of relative directories
(=2E./mylib, ../mylib/build, ../../mylib etc) - and set a variable to the
correct location of both the library and the includes once and for all
in configure.ac.
| |
|
|
This also leads to the general problem on how to get the canonicalized
absolute pathname from a given path (what realpath() does) ?
This is necessary especially if the path is given on the commandline or
from an environment variable and if the path is to be used in subdirs.
| |
| Roger Leigh 2006-07-02, 7:24 pm |
| | |
| Måns Rullgård 2006-07-03, 1:27 am |
| "sasq" <sasq64@gmail.com> writes:
> Is there a way to specify relative library paths from configure.ac such
> that they automatically are made to point correctly when building in
> sub driectories?
>
> For instance, adding an
>
> LDFLAGS=-L../mylibrary
>
> in configure.ac wont help much when building something in a subdir. I
> would want configure to be smart enough to add a "../" after the -L
> when generating Makefile.in in subdirectories.
Oh, I almost forgot something. You shouldn't be using recursive make
in the first place:
http://www.pcug.org.au/~millerp/rmc...-cons-harm.html
Non-recursive make avoids this and all sorts of other nasty problems,
and it's faster too.
--
Måns Rullgård
mru@inprovide.com
| |
|
|
Roger Leigh wrote:
> "sasq" <sasq64@gmail.com> writes:
>
>
>
> Set them all in a global Makefile (I typically use global.mk) and then
> include this makefile fragment in your Makefile.ams. This will give
> you uniform behaviour in all your makefiles, and it gets processed by
> automake as though it was set in each makefile by hand.
See topic; I'm talking about Automake. And it still doesn't solve the
problem with paths that are specified relative the topdir and that
needs to be used in subdirs.
(And I'm not sure Automake uses recursive make... anyone?)
| |
| Måns Rullgård 2006-07-03, 7:28 am |
| "sasq" <sasq64@gmail.com> writes:
> Roger Leigh wrote:
>
> See topic; I'm talking about Automake. And it still doesn't solve the
> problem with paths that are specified relative the topdir and that
> needs to be used in subdirs.
>
> (And I'm not sure Automake uses recursive make... anyone?)
Automake is as recursive or non-recursive as you choose to write your
Makefile.am. Hint: if you have SUBDIRS= lines, it's recursive.
--
Måns Rullgård
mru@inprovide.com
| |
| Roger Leigh 2006-07-03, 7:28 am |
| | |
| jonas.minnberg@gmail.com 2006-07-03, 1:26 pm |
|
We're getting a bit off-topic here. Short of switching to another
build-system I think I have to live with recursive make then (since I'm
not going to put all sourcecode in the same place).
Currently I use $(top_builddir) / $(top_srcdir) whenever I know the
exact location, and any path specified from variables or commandline
are just assumed to be absolute... and this is what I'd like to fix.
Roger Leigh wrote:
> "sasq" <sasq64@gmail.com> writes:
>
uch[vbcol=seagreen]
>
> It certainly does. Here's an example:
>
> ## Global rules and macros to be included in all Makefiles.
> # Variables
> export STP_MODULE_PATH =3D $(top_builddir)/src/main/.libs:$(top_builddir)=
/src/main
> export STP_DATA_PATH =3D $(top_srcdir)/src/main
> AM_CPPFLAGS =3D -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL=
_CPPFLAGS) $(GNUCFLAGS)
>
> # Libraries
> GUTENPRINT_LIBS =3D $(top_builddir)/src/main/libgutenprint.la
> GUTENPRINTUI_LIBS =3D $(top_builddir)/src/gutenprintui/libgutenprintui.la
> GUTENPRINTUI2_LIBS =3D $(top_builddir)/src/gutenprintui2/libgutenprintui2=
..la
>
> # Rules
> $(top_builddir)/src/main/libgutenprint.la:
> cd $(top_builddir)/src/main; \
> $(MAKE)
> $(top_builddir)/src/gutenprintui/libgutenprintui.la:
> cd $(top_builddir)/src/gutenprintui; \
> $(MAKE)
> $(top_builddir)/src/gutenprintui2/libgutenprintui2.la:
> cd $(top_builddir)/src/gutenprintui2; \
> $(MAKE)
>
>
> As M=E5ns said, it does if you set SUBDIRS.
>
>
> Regards,
> Roger
>
> --
> Roger Leigh
> Printing on GNU/Linux? http://gutenprint.sourceforge.net/
> Debian GNU/Linux http://www.debian.org/
> GPG Public Key: 0x25BFB848. Please sign and encrypt your=
mail.
>
> --=3D-=3D-Content-Type: application/pgp-signature
> X-Google-AttachSize: 189
| |
|
|
Grr I posted from my primary gmail by mistake - there goes that
spamfree account...
| |
| Logan Shaw 2006-07-03, 7:22 pm |
| sasq wrote:
> Grr I posted from my primary gmail by mistake - there goes that
> spamfree account...
You could try sending a cancel message. It might at least reduce
the number of spammers who pick up your e-mail address.
- Logan
|
|
|
|