help-gnu-utils
[Top][All Lists]
Advanced

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

Re: Why does this pattern rule fail?


From: Boris Kolpackov
Subject: Re: Why does this pattern rule fail?
Date: 24 Jan 2005 19:19:47 GMT
User-agent: nn/6.6.5+RFC1522

YYTVQIKTXINE@spammotel.com writes:

> all: subdir1/file.o
>
> subdir1/file.o: subdir2/file.c
>
> subdir2/file.c: | subdir1 subdir2 ; touch $@
>
> subdir1 subdir2: ; mkdir $@
>
> %.o: %.c ; echo "Made from $<" >@
> clean: ; rm -fr subdir[12]

When GNU makes searches for an implicit rule to build subdir1/file.o
it tries the following "instantiation" (subdir1/file is the stem):

subdir1/file.o: subdir1/file.c
        echo "Made from $<" >@

Since subdir1/file.c does not exist this implicit rule cannot be
used.

You can fix this by rewriting your rule as follows:

subdir1/%.o: subdir2/%.c
        echo "Made from $<" >@

-boris

reply via email to

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