On Tue, 2015-02-10 at 10:12 +0000, David Aldrich wrote: > define make-depend > @echo $(CXX) -c $4 $1 -o $2; \ > $(CXX) -c -MMD -MP -MF $3.$$$$ $4 $1 -o $2; \ > sed 's,\($*\)\.o[ :]*,$(notdir $2) $3 : ,g' < $3.$$$$ > $3; \ > rm -f $3.$$$$ > endef
This is exactly what I and others have mentioned. Here, you run the compile command as the second command in this script. That exits with an error code. But, you ignore that error (don't do anything about it) then you run sed, then you run rm. So, the exit code of your script is the exit code of the last command you ran, which is "rm". So the only way this command will ever fail is if the final "rm" fails, which pretty much never happens. This is bad. The simplest way to fix it is to replace the ";" with "&&", so that subsequent parts of the script don't run if an earlier part fails: define make-depend @echo $(CXX) -c $4 $1 -o $2; \ $(CXX) -c -MMD -MP -MF $3.$$$$ $4 $1 -o $2 \ && sed 's,\($*\)\.o[ :]*,$(notdir $2) $3 : ,g' < $3.$$$$ > $3 \ && rm -f $3.$$$$ endef There are other options, like saving the exit code of the compiler and then using it explicitly in "exit" at the end after "rm". _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make