Hint: There's no file present from which foo.o can be built with implicit 
rules.

Makefile 1:
--snip---
all: foo.o
--EOF---
# make foo.o
make: *** No rule to make target `foo.o'.  Stop.
# echo $?
2

Makefile 2:
--snip---
all: foo.o
foo.o: generated.h
--EOF---
# touch generated.h
# make foo.o
make: Nothing to be done for `foo.o'
# echo $?
0

In Makefile 2 my intention was to state that foo.o depends on some generated 
header which must be generated first (might be in another rule). But I didn't 
want to change the be behaviour if foo.o cannot be built because e.g. there's 
no foo.c.

The example in make's manual, chapter "4.11 Multiple Rules for One Target", 
suffers from the identical problem.



Regarding to the make source code, foo.o ..
- has no cmds.
- is not "phony"
- is a target

remake.c
---snip---
remake_file (struct file *file)
{
  if (file->cmds == 0)
    {
      if (file->phony)                                                          
                                                                    
        /* Phony target.  Pretend it succeeded.  */                             
                                                                    
        file->update_status = us_success;                                       
                                                                    
      else if (file->is_target)                                                 
                                                                    
        /* This is a nonexistent target file we cannot make.                    
                                                                    
           Pretend it was successfully remade.  */                              
                                                                    
--->                                                                            
                                                                    
---> foo.o matches this case                                                    
                                                                    
--->                                                                            
                                                                    
        file->update_status = us_success;                                       
                                                                    
      else                                                                      
                                                                    
        {                                                                       
                                                                    
          /* This is a dependency file we cannot remake.  Fail.  */             
                                                                    
          if (!rebuilding_makefiles || !file->dontcare)                         
                                                                    
            complain (file);
          file->update_status = us_failed;
        }
    }
  else
---snap---

regards
Christian


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to