::: "PDS" == Paul D Smith <[EMAIL PROTECTED]> writes:

 > %% Raymond Nijssen <[EMAIL PROTECTED]> writes:
 rn> As a result, my .a files are not deleted if a .o file fails to
 rn> compile, and then my executable will link happily in a recursive
 rn> make environment.  This is undesired.

 > That means your recursive make environment isn't set up correctly.

I don't get it.

The submake does not delete the .a file, even though one of its .o
dependencies fails.  The .o file is deleted, but that is almost irrelevant.


 > You should have prerequisites set up so that failures in a directory
 > ensure that no other directories that depend on the products of the
 > failing directory would be built.

At this point there has not yet been a recursive invokation of make.

I just want make to delete a target if it failed building it.


Actually it looks like .DELETE_ON_ERROR is working at all:

----------------------------------------------------------------------
CC=g++

.DELETE_ON_ERROR:

all:: libfoo.a

libfoo.a: foo.o

foo.o: foo.cxx
        $(CC) -c $<

bogus:
        touch libfoo.a foo.o
        echo "asdf" > foo.cxx
----------------------------------------------------------------------


----------------------------------------------------------------------
42[manet:]~/src/test/makebug>make bogus
touch libfoo.a foo.o
echo "asdf" > foo.cxx
43[manet:]~/src/test/makebug>make -d -r
GNU Make version 3.77, by Richard Stallman and Roland McGrath.
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98
        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.

Report bugs to <[EMAIL PROTECTED]>.

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 dependencies of target file `Makefile'.
 No need to remake target `Makefile'.
Updating goal targets....
Considering target file `all'.
 File `all' does not exist.
 Looking for an implicit rule for `all'.
 No implicit rule found for `all'.
  Considering target file `libfoo.a'.
   Looking for an implicit rule for `libfoo.a'.
   No implicit rule found for `libfoo.a'.
    Considering target file `foo.o'.
      Considering target file `foo.cxx'.
       Looking for an implicit rule for `foo.cxx'.
       No implicit rule found for `foo.cxx'.
       Finished dependencies of target file `foo.cxx'.
      No need to remake target `foo.cxx'.
     Finished dependencies of target file `foo.o'.
     Dependency `foo.cxx' is newer than dependent `foo.o'.
    Must remake target `foo.o'.
g++ -c foo.cxx
Child access: user 114 (real 114), group 101 (real 101)
Putting child 0x00049428 PID 11857 on the chain.
Live child 0x00049428 PID 11857
foo.cxx:2: parse error at end of input
Got a SIGCHLD; 1 unreaped children.
Live child 0x00049428 PID 11857
Reaping losing child 0x00049428 PID 11857
make: *** [foo.o] Error 1
Removing child 0x00049428 PID 11857 from chain.
44[manet:]~/src/test/makebug>ls -altr
total 7
drwxr-xr-x  17 raymond  develop      3584 Jul  5 16:36 ../
drwxrwxr-x   2 raymond  develop       512 Jul  5 16:54 ./
-rw-rw-r--   1 raymond  develop       141 Jul  5 16:55 Makefile
-rw-rw-r--   1 raymond  develop         0 Jul  5 16:55 libfoo.a
-rw-rw-r--   1 raymond  develop         0 Jul  5 16:55 foo.o
-rw-rw-r--   1 raymond  develop         5 Jul  5 16:55 foo.cxx
45[manet:]~/src/test/makebug>
----------------------------------------------------------------------

Shouldn't at least foo.o have been deleted?



 > I cannot think of any way to get the behavior you're looking for (if a
 > target fails to build, then make deletes that target, plus the target it
 > was a prerequisite of, plus whatever _that_ was a prerequisite of, etc.)

If so, wouldn't that be a cool feature?  It could simply work its way up
following all the parents and delete the targets instead of bailing out.

-Raymond

Reply via email to