List Info

Thread: No rule to make target... problem




No rule to make target... problem
user name
2006-08-22 08:38:37
Hello,

I have a problem with pattern rules. I simplified my
Makefile and got 
the following:

.PHONY: all create

all: create file.out

create:
         touch file.ext

%.out : %.ext
         mv file.ext file.out

After invoking make I get "make: *** No rule to make
target `file.out', 
needed by `all'.  Stop." Then when I invoke make for
the second time 
everything seems to work just fine.
As I understand it the prerequisite "file.out"
should be matched with 
the pattern "%.out" and the stem % should then
be replaced by "file" 
making the "%.ext" prerequisite look:
"file.ext". The file in turn was 
already created by the "create" rule. However,
it does not work.
Please, can someone help solve this problem?

-- 
Daniel


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
No rule to make target... problem
user name
2006-08-23 12:08:23
Daniel Harezlak wrote:
> Hello,
> 
> I have a problem with pattern rules. I simplified my
Makefile and got 
> the following:
> 
> .PHONY: all create
> 
> all: create file.out
> 
> create:
>         touch file.ext
> 
> %.out : %.ext
>         mv file.ext file.out
> 
> After invoking make I get "make: *** No rule to
make target `file.out', 
> needed by `all'.  Stop." Then when I invoke make
for the second time 
> everything seems to work just fine.

file.out rule does not depend on create, so, when remaking
all target make is 
free to execute create and file.out in any order. It depends
on your task how 
you should fix it. One example:

$ ls -l
total 1
-rw-rw-r-- 1 myegorus users 87 Aug 23 13:05 Makefile

$ cat Makefile
.PHONY: all
all: file.out
file.ext : ; touch $
%.out : %.ext; mv $(:.out=.ext) $

$ make -rd
GNU Make 3.81-mako
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying
conditions.
There is NO warranty; not even for MERCHANTABILITY or
FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i686-pc-linux-gnu
Reading makefiles...
Reading makefile `Makefile'...
Updating makefiles....
  Considering target file `Makefile'.
   Looking for an implicit rule for `Makefile'.
   No implicit rule found for `Makefile'.
   Finished prerequisites of target file `Makefile'.
  No need to remake target `Makefile'.
Updating goal targets....
Considering target file `all'.
  File `all' does not exist.
   Considering target file `file.out'.
    File `file.out' does not exist.
    Looking for an implicit rule for `file.out'.
    Trying pattern rule with stem `file'.
    Trying implicit prerequisite `file.ext'.
    Found an implicit rule for `file.out'.
     Considering target file `file.ext'.
      File `file.ext' does not exist.
      Finished prerequisites of target file `file.ext'.
     Must remake target `file.ext'.
touch file.ext
Putting child 0x0915bc30 (file.ext) PID 3041 on the chain.
Live child 0x0915bc30 (file.ext) PID 3041
Reaping winning child 0x0915bc30 PID 3041
Removing child 0x0915bc30 PID 3041 from chain.
     Successfully remade target file `file.ext'.
    Finished prerequisites of target file `file.out'.
   Must remake target `file.out'.
mv file.ext file.out
Putting child 0x0915bc30 (file.out) PID 3042 on the chain.
Live child 0x0915bc30 (file.out) PID 3042
Reaping winning child 0x0915bc30 PID 3042
Removing child 0x0915bc30 PID 3042 from chain.
   Successfully remade target file `file.out'.
  Finished prerequisites of target file `all'.
Must remake target `all'.
Successfully remade target file `all'.

$ ls -l
total 1
-rw-rw-r-- 1 myegorus users  0 Aug 23 13:06 file.out
-rw-rw-r-- 1 myegorus users 87 Aug 23 13:05 Makefile



_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )