Hello,

Some behaviour of make (version 3.79) seems very strange to me. Some files
that are generated during a make command are deleted after the command
completes if these generated files did not exist before.

A small example project is in the tar file. The strange behaviour can be
produced like this (after unpacking into an empty directory):

        rm -rf .deps/ *prep* *o

no output.

        make

output:
 > echo "/* cpp */" > test.prep.cpp 
 > echo "/* h   */" > test.prep.h 
 > [ -d .deps ] || mkdir .deps
 > echo -n ".deps/test.d " > .deps/test.d 
 > g++ -M -I. test.cpp >> .deps/test.d
 > mv -f .deps/test.d .deps/test.D
 > echo timestamp > .deps/test.d
 > g++ -I. -c test.cpp -o test.o
 > rm test.prep.cpp .deps/test.d

The last line is the problem!

        make
output:
 > echo "/* cpp */" > test.prep.cpp 
 > echo "/* h   */" > test.prep.h 
 > [ -d .deps ] || mkdir .deps
 > echo -n ".deps/test.d " > .deps/test.d 
 > g++ -M -I. test.cpp >> .deps/test.d
 > mv -f .deps/test.d .deps/test.D
 > echo timestamp > .deps/test.d
 > g++ -I. -c test.cpp -o test.o

I can see the no reason why the two files `test.prep.cpp' and
`.deps/test.d' should be removed. I do neither find an implicit rule for
this nor does my Makefile even contain `rm'. I think that it would be a
bad thing if make starts removing files without being asked to do that.

I would very much appreciate if somebody could explain this, if it is no
bug.

Thanks,

Alexander Bürger

example project

Reply via email to