This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: _SOURCES to _OBJECTS transform


On Thu, May 13, 1999 at 08:46:49PM -0600, Tom Tromey wrote:
> >>>>> "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
> 


Aha!  About an hour ago, I figured out this first method on my own.

> 
> 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@


Nice.  This other method is definitely more clear.  I'll give it a shot.

> 
> 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

I sure could go for more examples of this kidn of thing in the automake
manual...

Thanks very much for your help.

-- 

-mark frost
 horizon systems inc


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]