manpagez: man pages & more
info make
Home | html | info | man

File: make.info,  Node: Testing,  Next: Temporary Files,  Prev: Overriding,  Up: Running

9.6 Testing the Compilation of a Program
========================================

Normally, when an error happens in executing a shell command, 'make'
gives up immediately, returning a nonzero status.  No further recipes
are executed for any target.  The error implies that the goal cannot be
correctly remade, and 'make' reports this as soon as it knows.

   When you are compiling a program that you have just changed, this is
not what you want.  Instead, you would rather that 'make' try compiling
every file that can be tried, to show you as many compilation errors as
possible.

   On these occasions, you should use the '-k' or '--keep-going' flag.
This tells 'make' to continue to consider the other prerequisites of the
pending targets, remaking them if necessary, before it gives up and
returns nonzero status.  For example, after an error in compiling one
object file, 'make -k' will continue compiling other object files even
though it already knows that linking them will be impossible.  In
addition to continuing after failed shell commands, 'make -k' will
continue as much as possible after discovering that it does not know how
to make a target or prerequisite file.  This will always cause an error
message, but without '-k', it is a fatal error (*note Summary of
Options: Options Summary.).

   The usual behavior of 'make' assumes that your purpose is to get the
goals up to date; once 'make' learns that this is impossible, it might
as well report the failure immediately.  The '-k' flag says that the
real purpose is to test as much as possible of the changes made in the
program, perhaps to find several independent problems so that you can
correct them all before the next attempt to compile.  This is why Emacs'
'M-x compile' command passes the '-k' flag by default.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.