Unsermake problem

Stephan Kulow coolo at kde.org
Tue Jun 1 12:58:11 BST 2004

Hash: SHA1

Am Tuesday 01 June 2004 13:24 schrieb Oswald Buddenhagen:
> On Tue, Jun 01, 2004 at 10:55:00AM +0200, Stephan Kulow wrote:
> > BTW: $< is pretty unportable.
> sure? we use it all over the place. and reading the "Features" page in
> the gmake manual i get the impression that this variable is a "standard"
> one.
I wasn't exactly clear. The usage of $< is full of suprises is the real 
problem :)

Note that $< is only predictable for single dependencies, which isn't true
for the rules Anders listed.

Greetings, Stephan

from "info make"

   When using GNU `make', relying on `VPATH' to find the source file
will work in the case where there is a single dependency file, since
the `make' automatic variable `$<' will represent the source file
wherever it is.  (Many versions of `make' set `$<' only in implicit
rules.)  A Makefile target like

     foo.o : bar.c
             $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o

should instead be written as

     foo.o : bar.c
             $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@

in order to allow `VPATH' to work correctly.  When the target has
multiple dependencies, using an explicit `$(srcdir)' is the easiest way
to make the rule work well.  For example, the target above for `foo.1'
is best written as:

     foo.1 : foo.man sedscript
             sed -e $(srcdir)/sedscript $(srcdir)/foo.man > $@
Version: GnuPG v1.2.4 (GNU/Linux)


More information about the kde-core-devel mailing list