UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: 19.2 Description File LinesChapter 19
The make Utility
Next: 19.4 Special Target Names
 

19.3 Macros

This subsection summarizes internal macros, modifiers, string substitution, and special macros.

19.3.1 Internal Macros

$?

The list of prerequisites that have been changed more recently than the current target. Can be used only in normal description file entries - not suffix rules.

$@

The name of the current target, except in description file entries for making libraries, where it becomes the library name. Can be used both in normal description file entries and in suffix rules.

$$@

The name of the current target. Can be used only to the right of the colon in dependency lines.

$<

The name of the current prerequisite that has been modified more recently than the current target. Can be used only in suffix rules and in the .DEFAULT: entry.

$*

The name - without the suffix - of the current prerequisite that has been modified more recently than the current target. Can be used only in suffix rules.

$%

The name of the corresponding .o file when the current target is a library module. Can be used both in normal description file entries and in suffix rules.

19.3.2 Macro Modifiers

Macro modifiers are not available in all variants of make.

D

The directory portion of any internal macro name except $?. Valid uses are:

$(*D)   $$(@D)
$(<D)   ${%D)
$(@D)

F

The file portion of any internal macro name except $?. Valid uses are:

$(*F)   $$(@F)
$(<F)   ${%F}
$(@F)

19.3.3 Macro String Substitution

String substitution is not available in all variants of make.

${macro:s1=s2}

Evaluates to the current definition of ${macro}, after substituting the string s1 for every occurrence of s2 that occurs either immediately before a blank or tab, or at the end of the macro definition.

19.3.4 Macros with Special Handling

SHELL

Sets the shell that interprets commands. If this macro isn't defined in the description file, the value depends on your system. Some UNIX implementations use the shell from the user's environment (as with other macros). Other implementations (including SVR4) set the default SHELL to /bin/sh.

VPATH

(Not available in all variants of make.) Specifies a list of directories to search for prerequisites when they aren't found in the current directory.


Previous: 19.2 Description File LinesUNIX in a Nutshell: System V EditionNext: 19.4 Special Target Names
19.2 Description File LinesBook Index19.4 Special Target Names

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System