12 GNU make
3.1.1 Splitting Long Lines
Makefiles use a “line-based” syntax in which the newline character is special and marks the
end of a statement. GNU make has no limit on the length of a statement line, up to the
amount of memory in your computer.
However, it is difficult to read lines which are too long to display without wrapping or
scrolling. So, you can format your makefiles for readability by adding newlines into the
middle of a statement: you do this by escaping the internal newlines with a backslash (\)
character. Where we need to make a distinction we will refer to “physical lines” as a single
line ending with a newline (regardless of whether it is escaped) and a “logical line” being a
complete statement including all escaped newlines up to the first non-escaped newline.
The way in which backslash/newline combinations are handled depends on whether the
statement is a recipe line or a non-recipe line. Handling of backslash/newline in a recipe
line is discussed later (see Section 5.1.1 [Splitting Recipe Lines], page 41).
Outside of recipe lines, backslash/newlines are converted into a single space character.
Once that is done, all whitespace around the backslash/newline is condensed into a single
space: this includes all whitespace preceding the backslash, all whitespace at the beginning
of the line after the backslash/newline, and any consecutive backslash/newline combina-
tions.
If the .POSIX special target is defined then backslash/newline handling is modified
slightly to conform to POSIX.2: first, whitespace preceding a backslash is not removed
and second, consecutive backslash/newlines are not condensed.
3.2 What Name to Give Your Makefile
By default, when make looks for the makefile, it tries the following names, in order:
GNUmakefile, makefile and Makefile.
Normally you should call your makefile either makefile or Makefile. (We recommend
Makefile because it appears prominently near the beginning of a directory listing, right
near other important files such as README.) The first name checked, GNUmakefile, is not
recommended for most makefiles. You should use this name if you have a makefile that is
specific to GNU make, and will not be understood by other versions of make. Other make
programs look for makefile and Makefile, but not GNUmakefile.
If make finds none of these names, it does not use any makefile. Then you must specify
a goal with a command argument, and make will attempt to figure out how to remake it
using only its built-in implicit rules. See Chapter 10 [Using Implicit Rules], page 111.
If you want to use a nonstandard name for your makefile, you can specify the makefile
name with the ‘-f’ or ‘--file’ option. The arguments ‘-f name’ or ‘--file=name’ tell
make to read the file name as the makefile. If you use more than one ‘-f’ or ‘--file’
option, you can specify several makefiles. All the makefiles are effectively concatenated in
the order specified. The default makefile names GNUmakefile, makefile and Makefile are
not checked automatically if you specify ‘-f’ or ‘--file’.
Comentários a estes Manuais