[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Autoconfisticating a multi-directory, non-recursive, GNU-make specif
From: |
Duncan Gibson |
Subject: |
Re: Autoconfisticating a multi-directory, non-recursive, GNU-make specific project |
Date: |
Thu, 16 Feb 2006 17:15:39 +0100 |
Ralf Wildenhues kindly provided me with 4 out of the 5 critical pieces
of information that I needed:
> --- configure.ac ---
> AM_INIT_AUTOMAKE([1.9 subdir-objects])
1. subdir-objects to build x/y/z.o from x/y/z.c instead of just z.o
see the last paragraph describing 'maude_SOURCES' in the manual at:
http://sources.redhat.com/automake/automake.html#Program-and-Library-Variables
> --- Makefile.am ---
> lib_LIBRARIES =
> bin_PROGRAMS =
> include lib1/Makefile.am
> include lib2/Makefile.am
> include app1/Makefile.am
> include app2/Makefile.am
2. initialise variables in Makefile.am, and then add actual values to
them in the */Makefile.am
3. include */Makefile.am to create one big Makefile, instead of using
AC_CONFIG_FILES([Makefile lib1/Makefile ...]) in autoconf.ac which
generates completely separate Makefiles
> --- app2/Makefile.am ---
> bin_PROGRAMS += app2/app2
> app2_app2_SOURCES = app2/main.cpp
> app2_app2_LDADD = lib2/lib2.a
>
> --- lib2/Makefile.am ---
> lib_LIBRARIES += lib2/lib2.a
> lib2_lib2_a_SOURCES = lib2/file-in-lib2.cpp
4. provide the correct magic {directory, /, _} combinations to match
the correct targets in different directories.
And the last critical point?
5. I had tried every combination I could think of to build lib2/lib2.a
and then link it into app2 but I always got an undefined reference.
But this was down to a major 'thinko' on my part so I wasn't also
linking against lib1/lib1.a.
I've been going in circles trying to solve the wrong problem :-(
Talk about not being able to see the wood for the trees!
Thank you for your help. I do believe I have the foundation I need.
Cheers
Duncan