automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Testing a new compiler with Automake "simple tests"


From: Stefano Lattarini
Subject: Re: Testing a new compiler with Automake "simple tests"
Date: Wed, 18 Aug 2010 13:18:55 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

At Wednesday 18 August 2010, Roberto Bagnara wrote:
> Dear Stefano and Ralf,
> 
> thank you very much for your assistance.  I am a bit
> confused; here is what I have in my Makefile.am
> 
> # This does not work: Automake 1.11 rejects it with
> #   Makefile.am:1148: bad characters in variable name `$(TESTS'
> #$(TESTS:address@hidden@): ../../bin/compiler
> 
> # This does not work: when ../../bin/compiler changes, tests are
> # not recompiled.
> # TESTS_OBJS = $(TESTS:address@hidden@)
Typo here (and in Ralf example): should be $(TESTS:address@hidden@),
with a dot `.' before @OBJEXT@ (this is because @OBJEXT@ do not
contain a leading dot: it's either `o' or `obj').
> # $(TESTS_OBJS): ../../bin/compiler

That said, you should consider Ralf's suggestion to use the 
$(*_OBJECTS) variables instead, for more correctness.  In fact,
as Ralf pointed out in a previous message:

 " ... this doesn't take into account that object file names are
   an internal detail of Automake.  In practice, they might end
   in .obj, as Stefano already noted, which $(OBJEXT) or @OBJEXT@
   can tell you, but also, object files may be renamed due to
   one of several reasons such as per-target flags, (obsolete)
   K&R support, and others. "

So, instead of doing simply e.g.:

  TESTS = t1 t2 t3 t4 t5 t6
  TESTS_OBJS = $(TESTS:address@hidden@)
  $(TESTS_OBJS): ../../bin/compiler

it's better to do:

  TESTS = t1 t2 t3 t4 t5 t6
  TESTS_OBJS = $(t1_OBJECTS) $(t2_OBJECTS) $(t3_OBJECTS) \
               $(t4_OBJECTS) $(t5_OBJECTS) $(t6_OBJECTS)
  $(TESTS_OBJS): ../../bin/compiler

Unfortunately, this is more error-prone, since if you add, say, `t7' 
to TESTS, but forget to add $(t7_OBJECTS) to TESTS_OBJS, you'll have
missing dependencies...  Well, you'll decide what's better for you.

HTH,
  Stefano



reply via email to

[Prev in Thread] Current Thread [Next in Thread]