[Top][All Lists]

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

Re: Gnu make-isms

From: Angus Leeming
Subject: Re: Gnu make-isms
Date: Wed, 03 Dec 2003 19:57:36 +0000
User-agent: KNode/0.7.1

Paul D. Smith wrote:
>   al> They are. I'm talking about the LyX project 
>   al> that uses the autotools to its very core ;-)

> The output that automake generates is 100% portable.  If you add
> your own rules then you have to make sure they're portable.

Granted. That's what I'm trying to do.

> If you are building outside of the source tree, then the 
> auto* tools  require a version of make with a working VPATH...
> basically, GNU make.

Let's just say that Dec's make is perfectly happy doing this with the 
built-in rules.

> But you'll never be able to get "full functionality", that is
> building outside of the source tree, using anything but GNU make.
> Other makes just can't do this very well.

Again, Dec's make is quite happy when doing this with the auto* 
build-in rules. I hope and believe that I don't _need_ more 
functionality than is leveraged by these built-ins.

>   al> file.ui --> file.h
>   al> file.ui,file.h --> file.C

> To me this seems equivalent to this:
>   file.ui -> file.h -> file.C

Nice idea actually. However, how do I tell the .C file where to find 
the .ui file? '.h.C' (or even %.C: %.h) is not enough, given that the 
gnerated files, .h and .C both are going to be in a different 
directory from the original .ui file.

>   al> Any further thoughts about doing that in the Makefile itself?
>   al> I guess the trick is simply to generate the name of the .h
>   al> file from '$@'.

> You can use $*.h

Indeed. Thank you again.

SUFFIX = .ui
        HEADER_FILE=$*.h; \
        $(UIC) $(UICFLAGS) $< -o $(HEADER_FILE); \
        $(UIC) $(UICFLAGS) -impl $(HEADER_FILE) $< -o $@

This works perfectly with Dec make, srcdir != builddir, although 
interestingly this does not:

SUFFIX = .ui
        $(UIC) $(UICFLAGS) $< -o $*.h; \
        $(UIC) $(UICFLAGS) -impl $*.h $< -o $@

Failing to handle '-impl $*.h $< -o'.

Once again, many thanks!!!

>   al> Moving on, how about the second and this little
>   al> gem: 
>   al> %_moc.C: $(srcdir)/../%.h
>   al>         $(MOC) -o $@ $<

> Can't do this with suffix rules either.
> If you have to be able to do this type of thing you'll have to write
> all these rules out explicitly.

Qt huh! ;-) I'll dream on it.
Best regards,

reply via email to

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