* Stefano Lattarini wrote on Wed, Aug 18, 2010 at 03:42:01PM CEST:
> On Wednesday 18 August 2010, Roberto Bagnara wrote:
> > On 08/18/10 13:18, Stefano Lattarini wrote:
> > > At Wednesday 18 August 2010, Roberto Bagnara wrote:
> > >> #$(TESTS:=...@objext@): ../../bin/compiler
> >
> > The above is rejected even with the dot.
> This seems like an automake limitation... no big deal though, as there
> is the simple workaround:
>
> TESTS_OBJS = $(TESTS:=...@objext@)
> $(TESTS_OBJS): ../../bin/compiler
>
> which is also clearer to read IMO.
Yeah, that's just an automake parsing buglet.
> > > 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.
> >
> > Hmm, it is error-prone indeed. Moreover, we have more than one
> > thousands tests and we could soon have two thousands of them.
I suppose automake could be enhanced to also define $(OBJECTS) as the
set of all objects.
But there are other ways you could hack around this. Iff your compiler
is generated from a different Makefile.am (this is important!), then in
the tests/Makefile.am you could:
BUILT_SOURCES = stamp-objects
stamp-objects: ../../bin/compiler
-rm -f *.$(OBJEXT)
-rm -f sub/*.$(OBJEXT)
...
echo timestamp >$@
It is rather hacky, but it should work. Untested.
Cheers,
Ralf