This is the mail archive of the
automake@gnu.org
mailing list for the automake project.
Re: _SOURCES to _OBJECTS transform
- To: Mark Frost <mfrost@horizsys.com>
- Subject: Re: _SOURCES to _OBJECTS transform
- From: Tom Tromey <tromey@cygnus.com>
- Date: 13 May 1999 20:46:49 -0600
- Cc: automake@gnu.org
- References: <19990513104344.A2780@aspen.horizsys.com>
- Reply-To: tromey@cygnus.com
>>>>> "Mark" == Mark Frost <mfrost@horizsys.com> writes:
Mark> Hello. I'm new to this list and pretty new to
Mark> automake/autoconf/libtool. I'm trying to resolve issues with
Mark> building the gxsnmp package on Solaris (SPARC) 2.6.
Mark> From the resulting Makefile, I can see that a
Mark> libgxsnmp_la_OBJECTS gets constructed that seems to elimate the
Mark> header files and converts the *.c files into *.lo files.
Mark> My problem is that I cannot seem to find a way to conditionally
Mark> insert the getopt?.c *and* the getopt*.lo files/references into
Mark> the Makefile.am -> Makefile.in process.
There are two ways to do this.
The "old" way (meaning still workable but somewhat confusing) is to
put something like this in Makefile.am:
libgxsnmp_la_LIBADD = @magic@
libgxsnmp_la_DEPENDENCIES = @magic@
EXTRA_libgxsnmp_la_SOURCES = getopt.c getopt1.c
and then in configure.in:
magic=
AC_SUBST(magic)
if test whatever; then
magic="getopt.lo getopt1.lo"
fi
The "new" (meaning somewhat less confusing) way to do this is to use a
conditional. In configure.in:
AM_CONDITIONAL(WANT_GETOPT, test whatever)
In Makefile.am:
if WANT_GETOPT
g_sources = getopt.c getopt1.c
else
g_sources =
endif
libgxsnmp_la_SOURCES = $(g_sources) ...
Mark> libgxsnmp_la_SOURCES =
Mark> g_access.h \
Mark> ... \
Mark> @GETOPT_SRC@
This can't work because the source list must be known statically --
there is no (good) way to do the `.c->.lo' transformation at
make-time.
Automake ought to give an error if you try to do this. Unfortunately
it (currently) doesn't.
Mark> I've tried fiddling with EXTRA_libgxsnmp_la_SOURCES, also no
Mark> luck. If I add the getopt*lo references using the "_LIBADD"
Mark> functionality, I find that it wants to link the getopt*lo
Mark> objects, but it never builds them.
You are close! You just need to set the _DEPENDENCIES variable. (If
you want the "old" way. I personally much prefer using conditionals.)
Tom