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:=...@objext@): ../../bin/compiler > > # This does not work: when ../../bin/compiler changes, tests are > # not recompiled. > # TESTS_OBJS = $(TESTS:=...@objext@) Typo here (and in Ralf example): should be $(TESTS:=...@objext@), 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:=...@objext@) $(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