|
1 | 1 | --- |
2 | 2 | title: "Makefile Preprocessing Directives" |
3 | | -ms.date: "06/14/2018" |
| 3 | +ms.date: "08/11/2019" |
4 | 4 | f1_keywords: ["!UNDEF", "!INCLUDE", "!IFNDEF", "!MESSAGE"] |
5 | 5 | helpviewer_keywords: ["ERROR directive", "!MESSAGE directive", "IF directive", "!UNDEF directive", "IFDEF directive", "!ELSEIF directive", "!IFDEF directive", "!IF directive", "UNDEF directive", "!CMDSWITCHES directive", "ENDIF directive", "directives, makefile preprocessing", "INCLUDE directive", "IFNDEF directive", "preprocessing directives, makefiles", "!IFNDEF directive", "ELSEIFNDEF directive", "NMAKE program, expressions", "ELSEIF directive", "!ERROR directive", "!ENDIF directive", "MESSAGE directive", "!INCLUDE directive", "!ELSEIFNDEF directive", "CMDSWITCHES directive", "!ELSEIFDEF directive", "!ELSE directive", "NMAKE program, preprocessor directives", "makefiles, preprocessing directives", "ELSE directive", "ELSEIFDEF directive"] |
6 | 6 | ms.assetid: bcedeccb-d981-469d-b9e8-ab5d097fd8c2 |
7 | 7 | --- |
8 | 8 | # Makefile Preprocessing Directives |
9 | 9 |
|
10 | | -Preprocessing directives are not case sensitive. The initial exclamation point (!) must appear at the beginning of the line. Zero or more spaces or tabs can appear after the exclamation point, for indentation. |
| 10 | +Preprocessing directives aren't case-sensitive. The initial exclamation point (!) must appear at the beginning of the line. Zero or more spaces or tabs can appear after the exclamation point, for indentation. |
11 | 11 |
|
12 | | -- **!CMDSWITCHES** {**+** | **-**}*option* ... |
| 12 | +- `!CMDSWITCHES` {`+` | `-`}*option* ... |
13 | 13 |
|
14 | | - Turns each *option* listed on or off. Spaces or tabs must appear before the + or - operator; none can appear between the operator and the [option letters](nmake-options.md). Letters are not case sensitive and are specified without a slash ( / ). To turn some options on and others off, use separate specifications of **!CMDSWITCHES**. |
| 14 | + Turns each *option* listed on or off. Spaces or tabs must appear before the `+` or `-` operator; none can appear between the operator and the [option letters](running-nmake.md#nmake-options). Letters aren't case-sensitive and are specified without a slash (`/`). To turn on some options and turn off others, use separate specifications of `!CMDSWITCHES`. |
15 | 15 |
|
16 | | - Only /D, /I, /N, and /S can be used in a makefile. In Tools.ini, all options are allowed except /F, /HELP, /NOLOGO, /X, and /?. Changes specified in a description block do not take effect until the next description block. This directive updates **MAKEFLAGS**; changes are inherited during recursion if **MAKEFLAGS** is specified. |
| 16 | + Only /D, /I, /N, and /S can be used in a makefile. In Tools.ini, all options are allowed except /F, /HELP, /NOLOGO, /X, and /?. Changes specified in a description block don't take effect until the next description block. This directive updates **MAKEFLAGS**; changes are inherited during recursion if **MAKEFLAGS** is specified. |
17 | 17 |
|
18 | | -- **!ERROR** *text* |
| 18 | +- `!ERROR` *text* |
19 | 19 |
|
20 | | - Displays *text* in error U1050, then halts NMAKE, even if /K, /I, **.IGNORE**, **!CMDSWITCHES**, or the dash (-) command modifier is used. Spaces or tabs before *text* are ignored. |
| 20 | + Displays *text* in error U1050, then halts NMAKE, even if /K, /I, `.IGNORE`, `!CMDSWITCHES`, or the dash (`-`) command modifier is used. Spaces or tabs before *text* are ignored. |
21 | 21 |
|
22 | | -- **!MESSAGE** *text* |
| 22 | +- `!MESSAGE` *text* |
23 | 23 |
|
24 | 24 | Displays *text* to standard output. Spaces or tabs before *text* are ignored. |
25 | 25 |
|
26 | | -- **!INCLUDE** [ **\<** ] *filename* [ **>** ] |
| 26 | +- `!INCLUDE` [ `<` ] *filename* [ `>` ] |
27 | 27 |
|
28 | | - Reads *filename* as a makefile, then continues with the current makefile. NMAKE searches for *filename* first in the specified or current directory, then recursively through directories of any parent makefiles, then, if *filename* is enclosed by angle brackets (\< >), in directories specified by the **INCLUDE** macro, which is initially set to the INCLUDE environment variable. Useful to pass **.SUFFIXES** settings, **.PRECIOUS**, and inference rules to recursive makefiles. |
| 28 | + Reads *filename* as a makefile, then continues with the current makefile. NMAKE searches for *filename* first in the specified or current directory, then recursively through directories of any parent makefiles, then, if *filename* is enclosed by angle brackets (`< >`), in directories specified by the **INCLUDE** macro, which is initially set to the INCLUDE environment variable. Useful to pass `.SUFFIXES` settings, `.PRECIOUS`, and inference rules to recursive makefiles. |
29 | 29 |
|
30 | | -- **!IF** *constant_expression* |
| 30 | +- `!IF` *constant_expression* |
31 | 31 |
|
32 | | - Processes statements between **!IF** and the next **!ELSE** or **!ENDIF** if *constant_expression* evaluates to a nonzero value. |
| 32 | + Processes statements between `!IF` and the next `!ELSE` or `!ENDIF` if *constant_expression* evaluates to a nonzero value. |
33 | 33 |
|
34 | | -- **!IFDEF** *macroname* |
| 34 | +- `!IFDEF` *macroname* |
35 | 35 |
|
36 | | - Processes statements between **!IFDEF** and the next **!ELSE** or **!ENDIF** if *macroname* is defined. A null macro is considered to be defined. |
| 36 | + Processes statements between `!IFDEF` and the next `!ELSE` or `!ENDIF` if *macroname* is defined. A null macro is considered to be defined. |
37 | 37 |
|
38 | | -- **!IFNDEF** *macroname* |
| 38 | +- `!IFNDEF` *macroname* |
39 | 39 |
|
40 | | - Processes statements between **!IFNDEF** and the next **!ELSE** or **!ENDIF** if *macroname* is not defined. |
| 40 | + Processes statements between `!IFNDEF` and the next `!ELSE` or `!ENDIF` if *macroname* isn't defined. |
41 | 41 |
|
42 | | -- **!ELSE** [**IF** *constant_expression* | **IFDEF** *macroname* | **IFNDEF** *macroname*] |
| 42 | +- `!ELSE` [`IF` *constant_expression* | `IFDEF` *macroname* | `IFNDEF` *macroname*] |
43 | 43 |
|
44 | | - Processes statements between **!ELSE** and the next **!ENDIF** if the prior **!IF**, **!IFDEF**, or **!IFNDEF** statement evaluated to zero. The optional keywords give further control of preprocessing. |
| 44 | + Processes statements between `!ELSE` and the next `!ENDIF` if the prior `!IF`, `!IFDEF`, or `!IFNDEF` statement evaluated to zero. The optional keywords give further control of preprocessing. |
45 | 45 |
|
46 | | -- **!ELSEIF** |
| 46 | +- `!ELSEIF` |
47 | 47 |
|
48 | | - Synonym for **!ELSE IF**. |
| 48 | + Synonym for `!ELSE IF`. |
49 | 49 |
|
50 | | -- **!ELSEIFDEF** |
| 50 | +- `!ELSEIFDEF` |
51 | 51 |
|
52 | | - Synonym for **!ELSE IFDEF**. |
| 52 | + Synonym for `!ELSE IFDEF`. |
53 | 53 |
|
54 | | -- **!ELSEIFNDEF** |
| 54 | +- `!ELSEIFNDEF` |
55 | 55 |
|
56 | | - Synonym for **!ELSE IFNDEF**. |
| 56 | + Synonym for `!ELSE IFNDEF`. |
57 | 57 |
|
58 | | -- **!ENDIF** |
| 58 | +- `!ENDIF` |
59 | 59 |
|
60 | | - Marks the end of an **!IF**, **!IFDEF**, or **!IFNDEF** block. Any text after **!ENDIF** on the same line is ignored. |
| 60 | + Marks the end of an `!IF`, `!IFDEF`, or `!IFNDEF` block. Any text after `!ENDIF` on the same line is ignored. |
61 | 61 |
|
62 | | -- **!UNDEF** *macroname* |
| 62 | +- `!UNDEF` *macroname* |
63 | 63 |
|
64 | 64 | Undefines *macroname*. |
65 | 65 |
|
|
0 commit comments