On Fri, Jan 26, 2007 at 11:04:36PM -0800, David Byron wrote:
> I'm trying to conditionally add a program-specific linker flag but I'm
> having trouble.
> 
> Part of my Makefile.am looks like this:
> 
> noinst_PROGRAMS = zombie immOutTester testrunner
> 
> # Use these flags for all the programs built here
> LDADD = $(top_builddir)/util/util.a $(BOOST_LIBS) ${PTHREAD_LIBS}
> 
> # testrunner needs testmain and some other things
> testrunner_LDADD = $(top_builddir)/testmain/libtestmain.a $(BOOST_LIBS)
> $(CPPUNIT_LIBS) $(GETOPT_LIBS) $(LDADD)

Well, I could be wrong about this, since I'm not an expert. But I do,
  testrunner_LDADD = -ltestmain $(BOOST_LIBS)
  $(CPPUNIT_LIBS) $(GETOPT_LIBS) $(LDADD)
  testrunner_LDFLAGS = -L$(top_builddir)/testmain
don't know if that makes a big difference.

> if PLATFORM_WINDOWS
>     testrunner_LDADD += $(top_builddir)/minidumper/libminidumper.a
>     testrunner_LDFLAGS = /ENTRY:testrunnerCRTStartup
>     LIBS += version.lib
> endif

Again, I would consider doing this very different. In autoconf, figure
out if you are on windows with the AC_CANONICAL_TARGET, ..

Then, in autoconf do an AC_SUBST of the LDFLAGS you are intested in for
this platform. Then in you Makefile.am you can have

  testrunner_LDFLAGS = @TESTRUNNER_LDFLAGS@

Please take my advice with a grain of salt, not sure what your
experience level is.

Bob Rossi


Reply via email to