Roland Ver. 4.5 Technical Information Seite 113

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 212
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 112
Chapter 9: How to Run make 103
3. Use the command make -t to mark all the object files as up to date. The next time
you run make, the changes in the header files will not cause any recompilation.
If you have already changed the header file at a time when some files do need recom-
pilation, it is too late to do this. Instead, you can use the -o file flag, which marks a
specified file as “old” (see Section 9.7 [Summary of Options], page 104). This means that
the file itself will not be remade, and nothing else will be remade on its account. Follow
this procedure:
1. Recompile the source files that need compilation for reasons independent of the partic-
ular header file, with make -o headerfile’. If several header files are involved, use a
separate -o option for each header file.
2. Touch all the object files with make -t’.
9.5 Overriding Variables
An argument that contains = specifies the value of a variable: v=x sets the value of the
variable v to x. If you specify a value in this way, all ordinary assignments of the same
variable in the makefile are ignored; we say they have been overridden by the command line
argument.
The most common way to use this facility is to pass extra flags to compilers. For example,
in a properly written makefile, the variable CFLAGS is included in each recipe that runs the
C compiler, so a file foo.c would be compiled something like this:
cc -c $(CFLAGS) foo.c
Thus, whatever value you set for CFLAGS affects each compilation that occurs. The
makefile probably specifies the usual value for CFLAGS, like this:
CFLAGS=-g
Each time you run make, you can override this value if you wish. For example, if you
say make CFLAGS=’-g -O’’, each C compilation will be done with cc -c -g -O’. (This also
illustrates how you can use quoting in the shell to enclose spaces and other special characters
in the value of a variable when you override it.)
The variable CFLAGS is only one of many standard variables that exist just so that you
can change them this way. See Section 10.3 [Variables Used by Implicit Rules], page 115,
for a complete list.
You can also program the makefile to look at additional variables of your own, giving
the user the ability to control other aspects of how the makefile works by changing the
variables.
When you override a variable with a command line argument, you can define either a
recursively-expanded variable or a simply-expanded variable. The examples shown above
make a recursively-expanded variable; to make a simply-expanded variable, write := or
::= instead of =’. But, unless you want to include a variable reference or function call in
the value that you specify, it makes no difference which kind of variable you create.
There is one way that the makefile can change a variable that you have overridden. This
is to use the override directive, which is a line that looks like this: override variable =
value (see Section 6.7 [The override Directive], page 68).
Seitenansicht 112
1 2 ... 108 109 110 111 112 113 114 115 116 117 118 ... 211 212

Kommentare zu diesen Handbüchern

Keine Kommentare