Roland Ver. 4.5 Technical Information Seite 109

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 212
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 108
Chapter 9: How to Run make 99
9 How to Run make
A makefile that says how to recompile a program can be used in more than one way. The
simplest use is to recompile every file that is out of date. Usually, makefiles are written so
that if you run make with no arguments, it does just that.
But you might want to update only some of the files; you might want to use a different
compiler or different compiler options; you might want just to find out which files are out
of date without changing them.
By giving arguments when you run make, you can do any of these things and many
others.
The exit status of make is always one of three values:
0 The exit status is zero if make is successful.
2 The exit status is two if make encounters any errors. It will print messages
describing the particular errors.
1 The exit status is one if you use the -q flag and make determines that some
target is not already up to date. See Section 9.3 [Instead of Executing Recipes],
page 101.
9.1 Arguments to Specify the Makefile
The way to specify the name of the makefile is with the -f or --file option (‘--makefile
also works). For example, -f altmake says to use the file altmake as the makefile.
If you use the -f flag several times and follow each -f with an argument, all the
specified files are used jointly as makefiles.
If you do not use the -f or --file flag, the default is to try GNUmakefile, makefile,
and Makefile, in that order, and use the first of these three which exists or can be made
(see Chapter 3 [Writing Makefiles], page 11).
9.2 Arguments to Specify the Goals
The goals are the targets that make should strive ultimately to update. Other targets are
updated as well if they appear as prerequisites of goals, or prerequisites of prerequisites of
goals, etc.
By default, the goal is the first target in the makefile (not counting targets that start with
a period). Therefore, makefiles are usually written so that the first target is for compiling
the entire program or programs they describe. If the first rule in the makefile has several
targets, only the first target in the rule becomes the default goal, not the whole list. You can
manage the selection of the default goal from within your makefile using the .DEFAULT_GOAL
variable (see Section 6.14 [Other Special Variables], page 73).
You can also specify a different goal or goals with command line arguments to make.
Use the name of the goal as an argument. If you specify several goals, make processes each
of them in turn, in the order you name them.
Any target in the makefile may be specified as a goal (unless it starts with ‘-’ or contains
an =’, in which case it will be parsed as a switch or variable definition, respectively). Even
Seitenansicht 108
1 2 ... 104 105 106 107 108 109 110 111 112 113 114 ... 211 212

Kommentare zu diesen Handbüchern

Keine Kommentare