manpagez: man pages & more
info make
Home | html | info | man

File: make.info,  Node: Instead of Execution,  Next: Avoiding Compilation,  Prev: Goals,  Up: Running

9.3 Instead of Executing Recipes
================================

The makefile tells 'make' how to tell whether a target is up to date,
and how to update each target.  But updating the targets is not always
what you want.  Certain options specify other activities for 'make'.

'-n'
'--just-print'
'--dry-run'
'--recon'

     "No-op".  Causes 'make' to print the recipes that are needed to
     make the targets up to date, but not actually execute them.  Note
     that some recipes are still executed, even with this flag (*note
     How the 'MAKE' Variable Works: MAKE Variable.).  Also any recipes
     needed to update included makefiles are still executed (*note How
     Makefiles Are Remade: Remaking Makefiles.).

'-t'
'--touch'

     "Touch".  Marks targets as up to date without actually changing
     them.  In other words, 'make' pretends to update the targets but
     does not really change their contents; instead only their modified
     times are updated.

'-q'
'--question'

     "Question".  Silently check whether the targets are up to date, but
     do not execute recipes; the exit code shows whether any updates are
     needed.

'-W FILE'
'--what-if=FILE'
'--assume-new=FILE'
'--new-file=FILE'

     "What if".  Each '-W' flag is followed by a file name.  The given
     files' modification times are recorded by 'make' as being the
     present time, although the actual modification times remain the
     same.  You can use the '-W' flag in conjunction with the '-n' flag
     to see what would happen if you were to modify specific files.

   With the '-n' flag, 'make' prints the recipe that it would normally
execute but usually does not execute it.

   With the '-t' flag, 'make' ignores the recipes in the rules and uses
(in effect) the command 'touch' for each target that needs to be remade.
The 'touch' command is also printed, unless '-s' or '.SILENT' is used.
For speed, 'make' does not actually invoke the program 'touch'.  It does
the work directly.

   With the '-q' flag, 'make' prints nothing and executes no recipes,
but the exit status code it returns is zero if and only if the targets
to be considered are already up to date.  If the exit status is one,
then some updating needs to be done.  If 'make' encounters an error, the
exit status is two, so you can distinguish an error from a target that
is not up to date.

   It is an error to use more than one of these three flags in the same
invocation of 'make'.

   The '-n', '-t', and '-q' options do not affect recipe lines that
begin with '+' characters or contain the strings '$(MAKE)' or '${MAKE}'.
Note that only the line containing the '+' character or the strings
'$(MAKE)' or '${MAKE}' is run regardless of these options.  Other lines
in the same rule are not run unless they too begin with '+' or contain
'$(MAKE)' or '${MAKE}' (*Note How the 'MAKE' Variable Works: MAKE
Variable.)

   The '-t' flag prevents phony targets (*note Phony Targets::) from
being updated, unless there are recipe lines beginning with '+' or
containing '$(MAKE)' or '${MAKE}'.

   The '-W' flag provides two features:

   * If you also use the '-n' or '-q' flag, you can see what 'make'
     would do if you were to modify some files.

   * Without the '-n' or '-q' flag, when 'make' is actually executing
     recipes, the '-W' flag can direct 'make' to act as if some files
     had been modified, without actually running the recipes for those
     files.

   Note that the options '-p' and '-v' allow you to obtain other
information about 'make' or about the makefiles in use (*note Summary of
Options: Options Summary.).

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.