help-make
[Top][All Lists]
Advanced

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

Re: No rule to make target... problem


From: Maxim Yegorushkin
Subject: Re: No rule to make target... problem
Date: Wed, 23 Aug 2006 13:08:23 +0100
User-agent: Thunderbird 1.5.0.5 (X11/20060808)

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





reply via email to

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