Roland Ver. 4.5 Technical Information Seite 60

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 212
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 59
50 GNU make
either directly or indirectly. No further recipes will be executed for these targets, since their
preconditions have not been achieved.
Normally make gives up immediately in this circumstance, returning a nonzero status.
However, if the -k or --keep-going flag is specified, make continues 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. See Section 9.7 [Summary of Options], page 104.
The usual behavior assumes that your purpose is to get the specified targets up to date;
once make learns that this is impossible, it might as well report the failure immediately.
The -k option says that the real purpose is to test as many of the changes made in the
program as possible, perhaps to find several independent problems so that you can correct
them all before the next attempt to compile. This is why Emacs’ compile command passes
the -k flag by default.
Usually when a recipe line fails, if it has changed the target file at all, the file is corrupted
and cannot be used—or at least it is not completely updated. Yet the file’s time stamp says
that it is now up to date, so the next time make runs, it will not try to update that file. The
situation is just the same as when the shell is killed by a signal; see Section 5.6 [Interrupts],
page 50. So generally the right thing to do is to delete the target file if the recipe fails after
beginning to change the file. make will do this if .DELETE_ON_ERROR appears as a target.
This is almost always what you want make to do, but it is not historical practice; so for
compatibility, you must explicitly request it.
5.6 Interrupting or Killing make
If make gets a fatal signal while a shell is executing, it may delete the target file that the
recipe was supposed to update. This is done if the target file’s last-modification time has
changed since make first checked it.
The purpose of deleting the target is to make sure that it is remade from scratch when
make is next run. Why is this? Suppose you type Ctrl-c while a compiler is running, and
it has begun to write an object file foo.o. The Ctrl-c kills the compiler, resulting in an
incomplete file whose last-modification time is newer than the source file foo.c. But make
also receives the Ctrl-c signal and deletes this incomplete file. If make did not do this, the
next invocation of make would think that foo.o did not require updating—resulting in a
strange error message from the linker when it tries to link an object file half of which is
missing.
You can prevent the deletion of a target file in this way by making the special target
.PRECIOUS depend on it. Before remaking a target, make checks to see whether it appears
on the prerequisites of .PRECIOUS, and thereby decides whether the target should be deleted
if a signal happens. Some reasons why you might do this are that the target is updated
in some atomic fashion, or exists only to record a modification-time (its contents do not
matter), or must exist at all times to prevent other sorts of trouble.
5.7 Recursive Use of make
Recursive use of make means using make as a command in a makefile. This technique
is useful when you want separate makefiles for various subsystems that compose a larger
Seitenansicht 59
1 2 ... 55 56 57 58 59 60 61 62 63 64 65 ... 211 212

Kommentare zu diesen Handbüchern

Keine Kommentare