Command-line options

You can specify a number of options on the make command line. Most take the form of a minus sign (-) followed by a single letter. The case of the letter is significant; for example, -e and -E are different options and have different effects.

If a command line has several such options, they can be bundled together. For example, the following two command lines are equivalent:
make -i -e
make -ie
The following list explains all the command line options of make. Many of these match options in other versions of make.
-c dir
Attempts to change into the specified directory when make starts up. If make can't change the directory, an error message is printed. This is useful for recursive makefiles when building in a different directory.
-E
Suppresses reading of the environment. Normally when make starts up, it reads all strings defined in the environment into the corresponding macros. For example, if you have an environment variable named PATH defined, make creates a macro with the same name and value. If you specify neither \-E nor \-e, make reads the environment before reading the makefile.
-e
Reads the environment after reading the makefile. If you specify neither -e nor -E, make reads the environment before reading the makefile.
-f file
Tells make to use file as the makefile. If you specify a minus sign (-) in place of file, make reads the standard input. (In other words, make expects you to enter the makefile from the terminal or redirect it from a file.)
-i
Tells make to ignore all errors and continue making targets. This is equivalent to the .IGNORE attribute or macro.
-k
Makes all independent targets, even if an error occurs. Ordinarily, make stops after a command returns a nonzero status. Specifying -k tells make to ignore the error and continue to make other targets, as long as they are unrelated to the target that received the error. make does not attempt to update anything that depends on the target that was being made when the error occurred.
-n
Displays the commands that need to be run to update the chosen targets, but does not actually run the commands. This feature works with group recipes, but in this case, make will run the commands. If make finds the string $(MAKE) in a recipe line, that line is run with $(MAKE) replaced by:
make -n $(MAKEFLAGS)
(MAKEFLAGS is described in Special macros). This lets you see what recursive calls to make do. (Makefile input explains group recipes.)
-p
Prints the digested makefile. This display is in a human-readable form useful for debugging, but you cannot use it as input to make.
-q
Checks whether the target is up to date. If it is up to date, make exits with a status of 0; otherwise, it exits with a status of 1 (typically interpreted as an error by other software). No commands are run when -q is specified.
-r
Tells make not to read the startup file. See Finding the makefile
-S
Terminates make if an error occurs during operations to bring a target up to date (opposite of -k). This is the default.
-s
Tells make to do all its work silently. make does not display the commands it is running or any warning messages. This is equivalent to setting the .SILENT attribute, or assigning a nonnull value to the .SILENT macro.
-t
Touches the targets to mark them as up to date, without actually running any commands to change the targets. Use the -t option with caution: careless use may cause make to consider files as recently changed (because they have been touched), even though you have not changed them. This can result in a target that isn't brought up to date when required.
-u
Forces an unconditional update: make behaves as if all the prerequisites of the given target are out of date.
-V
Prints the version number of make. It also prints the built-in rules of this version of make. For more about built-in rules, see Finding the makefile.
-v
Causes make to display a detailed account of its progress. This includes:
  • What files it reads
  • The definition and redefinition of each macro
  • Metarule and suffix rule searches
  • Other information
-x
Exports all macro definitions to the environment. This happens just before making any targets, but after the entire makefile has been read.