make: Instead of Execution
1
1 9.3 Instead of Executing Recipes
1 ================================
1
1 The makefile tells 'make' how to tell whether a target is up to date,
1 and how to update each target. But updating the targets is not always
1 what you want. Certain options specify other activities for 'make'.
1
1 '-n'
1 '--just-print'
1 '--dry-run'
1 '--recon'
1
1 "No-op". Causes 'make' to print the recipes that are needed to
1 make the targets up to date, but not actually execute them. Note
11 that some recipes are still executed, even with this flag (⇒
How the 'MAKE' Variable Works MAKE Variable.). Also any recipes
11 needed to update included makefiles are still executed (⇒How
Makefiles Are Remade Remaking Makefiles.).
1
1 '-t'
1 '--touch'
1
1 "Touch". Marks targets as up to date without actually changing
1 them. In other words, 'make' pretends to update the targets but
1 does not really change their contents; instead only their modified
1 times are updated.
1
1 '-q'
1 '--question'
1
1 "Question". Silently check whether the targets are up to date, but
1 do not execute recipes; the exit code shows whether any updates are
1 needed.
1
1 '-W FILE'
1 '--what-if=FILE'
1 '--assume-new=FILE'
1 '--new-file=FILE'
1
1 "What if". Each '-W' flag is followed by a file name. The given
1 files' modification times are recorded by 'make' as being the
1 present time, although the actual modification times remain the
1 same. You can use the '-W' flag in conjunction with the '-n' flag
1 to see what would happen if you were to modify specific files.
1
1 With the '-n' flag, 'make' prints the recipe that it would normally
1 execute but usually does not execute it.
1
1 With the '-t' flag, 'make' ignores the recipes in the rules and uses
1 (in effect) the command 'touch' for each target that needs to be remade.
1 The 'touch' command is also printed, unless '-s' or '.SILENT' is used.
1 For speed, 'make' does not actually invoke the program 'touch'. It does
1 the work directly.
1
1 With the '-q' flag, 'make' prints nothing and executes no recipes,
1 but the exit status code it returns is zero if and only if the targets
1 to be considered are already up to date. If the exit status is one,
1 then some updating needs to be done. If 'make' encounters an error, the
1 exit status is two, so you can distinguish an error from a target that
1 is not up to date.
1
1 It is an error to use more than one of these three flags in the same
1 invocation of 'make'.
1
1 The '-n', '-t', and '-q' options do not affect recipe lines that
1 begin with '+' characters or contain the strings '$(MAKE)' or '${MAKE}'.
1 Note that only the line containing the '+' character or the strings
1 '$(MAKE)' or '${MAKE}' is run regardless of these options. Other lines
1 in the same rule are not run unless they too begin with '+' or contain
11 '$(MAKE)' or '${MAKE}' (⇒How the 'MAKE' Variable Works MAKE
Variable.)
1
1 The '-t' flag prevents phony targets (⇒Phony Targets) from
1 being updated, unless there are recipe lines beginning with '+' or
1 containing '$(MAKE)' or '${MAKE}'.
1
1 The '-W' flag provides two features:
1
1 * If you also use the '-n' or '-q' flag, you can see what 'make'
1 would do if you were to modify some files.
1
1 * Without the '-n' or '-q' flag, when 'make' is actually executing
1 recipes, the '-W' flag can direct 'make' to act as if some files
1 had been modified, without actually running the recipes for those
1 files.
1
1 Note that the options '-p' and '-v' allow you to obtain other
11 information about 'make' or about the makefiles in use (⇒Summary of
Options Options Summary.).
1