Simulate the running of a "make install" -- a "dry run" or simulator utility?

GNU make has an option to do a dry-run:

‘-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 (see How the MAKE Variable Works). Also any recipes needed to update included makefiles are still executed.

So for your situation, just run make -n install to see the commands that make would execute.


Any version of make has a -n option (see POSIX description of make), but the shell has no corresponding option (see for example Show commands without executing them).

To aggravate the situation, if you happen to use automake, it pastes-in large chunks of boilerplate scripting (which its developers refer to as "recursive rules") which defeat the ability of anyone to use "make -n" and see what will happen.

Further reading:

  • 27.11 Debugging Make Rules

    make -n can help show what would be done without actually doing it. Note however, that this will still execute commands prefixed with ‘+’, and, when using GNU make, commands that contain the strings ‘$(MAKE)’ or ‘${MAKE}’ (see Instead of Execution in The GNU Make Manual). Typically, this is helpful to show what recursive rules would do, but it means that, in your own rules, you should not mix such recursion with actions that change any files. Furthermore, note that GNU make will update prerequisites for the Makefile file itself even with -n (see Remaking Makefiles in The GNU Make Manual).

  • Re: More problems with `make -n' in automake-generated rules.
    touches on some of the pitfalls listed in 27.9 Handling Tools that Produce Many Outputs