++ed by:
2 non-PAUSE users
Author image Daniel Pfeiffer


makepp -- Command line syntax for makepp


?: -?A: -A, --args-file, --arguments-file, --assume-new, --assume-oldB: -b, --build-cache, --build-check, --build-check-methodC: -C, -cD: --defer-include, --directory, --do-build, --dont-build, --dont-read, --do-read, --dry-run, --dump-makefile, --dump-makeppfileE: -e, --environment-overrides, --env-overridesF: -F, -f, --file, --final-rules-only, --force-copy-from-bc, --force-rescanG: --gullibleH: -h, --help, --hybrid, --hybrid-recursion, --hybrid-recursive-makeI: -I, --implicit-load-makeppfile-only, --include, --include-dir, --in-sandbox, --inside-sandboxJ: -j, --jobs, --just-printK: -k, --keep-goingL: --last-chance-rules, --load-makefile, --load-makeppfile, --log, --log-file, --loopM: -m, --makefile, $MAKEFLAGS, $MAKEPP_CASE_SENSITIVE_FILENAMES, --makeppfile, $MAKEPPFLAGS, --md5-bc, --md5-check-bcN: -n, --new-file, --no-builtin-rules, --no-cache-scaninfos, --no-implicit-load, --no-log, --no-path-executable-dependencies, --no-path-exe-dep, --no-populate-bc, --no-print-directory, --no-remake-makefiles, --no-warnO: -o, --old-file, --out-of-sandbox, --override-signature, --override-signature-methodP: --populate-bc-only, --profileQ: --quietR: -R, -r, --recon, --remove-stale, --remove-stale-files, --repository, --rm-stale, --root-dir, --root-directoryS: -s, --sandbox, --sandbox-warn, --sandbox-warning, --signature, --signature-method, --silent, --stop, --stop-after-loading, --stop-before-building, --stop-on-race, --stop-race, --symlink-in-rep-as-file, --symlink-in-repository-as-fileT: --traditional, --traditional-recursion, --traditional-recursive-makeV: -V, -v, --verbose, --version, --virtual-sandboxW: -W, --warn-undef, --warn-undefined-variables, --warn-undef-var, --what-if

makepp [ option ... ] [ VAR=value ] [ target ... ]

mpp [ option ... ] [ VAR=value ] [ target ... ]

Makepp supports most of the command line options and syntax that other makes support. The hyphens between the words are always optional, and can also be replaced by an underscore. You specify a list of targets to build on the command line. If you do not specify any targets, the first explicit target in the makefile is built.

You can assign variables on the command line which will override any assignment or environment variable in every Makefile loaded, e.g.,

    makepp CFLAGS=-O2

Valid options are most of the standard make options, plus a few new ones:

-A filename

Read the file and parse it as possibly quoted whitespace- and/or newline-separated options.

-b directory

Specifies the path to a build cache. See makepp_build_cache for details. The build cache must already exist; see "How to manage a build cache" in makepp_build_cache for how to make it in the first place. Build caches defined on the command line may be overridden by a build_cache statement in a makefile or a :build_cache rule modifier . If you work with several different builds, it may be useful to set the environment variable MAKEPPFLAGS to contain --build-cache=/path/to/build/cache so that all of your builds will take advantage of the build cache by default.


The name of a build check method to use to decide whether files need to be rebuilt. Possible values are target_newer, exact_match, See makepp_build_check for information on build check methods.

-C directory

Cd to the given directory before loading the makefile and trying to build the targets. This is similar to specifying a directory with -F, except that subsequent -C, -f, -F, -I and -R options are interpreted relative to the new directory, rather than the old one.


Cd up to the directory containing a RootMakeppfile.


Workaround for include statement before the rule that builds the include file. This happens by pretending the include statements come last in the makefile. That way the include statement is performable, but variable overrides or modifications may still fail, in which case you should set the problematic ones on the command line (whereas gmake ignores any variable setting from the include file that might influence how that file itself gets built).


Do not build the specified file, or, if it is a directory, everything thereunder, even though makepp thinks it should -- or do build, overriding the opposite specification from a higher directory. This is useful if you built a specific file by hand using different compilation options. Without this option, if you compile a module by hand and then run makepp to compile the rest of the program, makepp will also recompile the module you compiled by hand, because makepp cannot guarantee that the build is correct if any of the files were not built under its control. With this option, you tell makepp that you really know what you are doing in the case of this particular file and you promise that it's ok not to rebuild it.

For example,

    % cc -g -DSPECIAL_DEBUG -c x.c -o x.o  # Special compilation by hand
    % makepp
    cc -g -O2 -c x.c -o x.o   # Makepp just overrode your compilation here!
    cc x.o y.o -o my_program  # Relinks.
    % cc -g -DSPECIAL_DEBUG -c x.c -o x.o  # Do it again.
    % makepp --dont-build x.o # Tell makepp not to rebuild x.o even if it wants to.
    cc x.o y.o -o my_program  # Now it relinks without recompiling.

If you want special compilation options for just one module, it's often easier to edit the makefile than to compile by hand as in this example; see "Target-specific assignments" in makepp_variables for an easy way of doing this.

If you put a RootMakeppfile(.mk) at the root of your build system, that directory and everything under it defaults to --do-build, while the overall root of your file system defaults to --dont-build. That way, everything inside your build system is built (if necessary) but nothing outside is attempted. If, in this scenario, you want external parts to always be built as needed, you must explicitly pick them up with load_makefile statements in one of the makefiles within your tree.

You may have one RootMakeppfile(.mk) each, in separate build trees, and they will be loaded if one tree has dependencies in another one. But you are not allowed to have RootMakeppfile(.mk) in nested directories, avoiding funny effects that tend to arise when you accidentally call makepp --repository again in a subdirectory. These effects include duplicate rules through duplicate sources, or eternal build cache reimports because cached files have the right signatures but the wrong relative pathes.

Override --dont-build for the specified file or directory. If you have a RootMakeppfile(.mk) at the root of your build system, but you want makepp to build something outside of your build system just this once, you must explicitly mark it as --do-build. If you specify --do-build for a file or directory under a RootMakeppfile(.mk), without --dont-build for a higher directory, then the root (and all else under it) of your build system defaults to --dont-build.

To resolve conflicts between --dont-build and --do-build, the one with the most specific path takes precedence regardless of order. If the same path is specified with both --dont-build and --do-build, then the rightmost one wins.

The options --dont-build and --do-build can be dangerous if you give the wrong hints to makepp, since you are asking makepp not to do checks it needs, to guarantee a correct build. But since they allow greatly reducing the number of checks, they can speed up your builds dramatically, as explained in potentially unsafe speedup methods.


Do not read the specified file, or, if it is a directory, everything thereunder -- or do read, overriding the opposite specification from a higher directory. Generate an error rather than read files marked for --dont-read. See --sandbox. The filesystem root always defaults to readable.


Dump the raw contents of the makefile(s) for the current directory (as determined by the position of this option relative to any -C options) to filename. Include files are interpolated, comments are stripped out and ifdef's are resolved. # line "file" markers are inserted as necessary. The final value of any non-reference scalars in the makefile's package are printed following the makefile.

This is useful for debugging, but (currently) you won't necessarily be able use the dump file as an equivalent makefile, for example because it contains both the include statement and the interpolated file.


Causes variables from the environment to override definitions in the makefile. By default, assignments within the makefile override variable values which are imported from the environment.

-F Makeppfile

Loads the specified Makefile or, if you specify a directory, the Makefile therein, instead of the one in the current directory -- any target specified to the right of this option is interpreted relative to the directory containing the Makefile. For the details of the directory case and RootMakeppfile see the explanation at the next option.

This option can be useful if you execute makepp from unpredictable directories. For example, if you compile from within emacs and you have sources scattered all over your directory tree, the current working directory for the compilation command will be the directory the last source file you edited was in, which may or may not be the top level directory for your compilation. However, you can specify your compilation command as

    makepp -F /your/source/dir/top

and this will work no matter what your current directory is.

Because this option doesn't affect the directory relative to which subsequent -C, -f, -F, -I and -R options are specified, you can make targets relative to the current directory like this:

    makepp -F /foo/bar -C . mytarget
-f Makefile

Loads the specified Makefile or, if you specify a directory, the Makefile therein, instead of the one in the current directory. If you do not specify the -f option or the -F option, makepp looks first for a file in the current directory (or the directory specified by the rightmost -C option, if any) called, then RootMakeppfile.mk, Makeppfile, then Makeppfile.mk, then makefile, then Makefile. Multiple -F and -f options may be specified.

The first two (RootMakeppfile) are special (whether given explicitly or found implicitly). There must be at most one of those two in any given build tree on which makepp is to operate. But there may be several if you build several disjoint trees in one go. Those two are looked for not only in the aforementioned directory, but also upwards from there. If one is found, it is loaded before any other.


Ignore the dependencies and implicit targets of the rule unless the target is phony.


When using build caches, always copy files in and out of the cache, even if the source and target are on the same filesystem. This is mainly useful for testing (emulating) the case in which they are not.


Don't use cached scanner results from previous runs.


Believe that the rules create what they declare, rather than checking. This is faster, but doesn't catch bugs in rules.


Print out a brief summary of the options.


This option is present to allow makepp to work with old makefiles that use recursive make extensively, especially multiply into the same dir. By default, recursive make is implemented by a subprocess that communicates with the parent process; the build is actually done by the parent process. This allows some of makepp's nice features like repositories to work with recursive make invocations. However, this technique will not work if you load more than one makefile from the same directory. In that case this option says to fall back to starting another independent instance of makepp. If this fails, try --traditional-recursive-make.

If you do use this option, you will get log files in the each directory the fall back occurred in. To get rid of only them use makeppclean --logs --recurse or mppc -lr.

-I directory

Search the given directory for included makefiles.


If implicit loading of makefiles is enabled, then automatically load only a file called RootMakeppfile, RootMakeppfile.mk, Makeppfile, or Makeppfile.mk, and not makefile or Makefile. This is useful if makepp has dependencies that are generated by some other flavor of make, and makepp can't read that flavor's makefiles in general. (You want to avoid this situation if possible, but it tends to arise while you're in the process of porting a legacy build system to makepp.) This has no effect if implicit loading is disabled.

-j n

Interprets the argument n as the number of shell commands that can be executed in parallel. By default, makepp does not execute commands in parallel.

Unlike some other versions of make, when jobs are executed in parallel, makepp directs their output to a file and only displays the output when the commands have finished. This prevents output from several different commands from being mixed together on the display, but it does mean that you might have to wait a little longer to see the output, and stderr messages will usually appear before stdout stuff, differing from terminal output.

Native Windows Perls (i.e. Strawberry and ActiveState), because they do not support the Unix fork/exec paradigm, do not allow this option (Cygwin works fine!). As a partial replacement, you can use the --sandbox option there, though this is far less comfortable.


Build as many files as safely possible, even if some commands have errors. By default, makepp stops when it encounters the first error, even if there are other files that need to be built that don't depend on the erroneous file.


Activate limited special handling for pattern rules with '%' only on the target side. This is needed because normally, unlike traditional makes, makepp instantiates all rules with all available files from the bottom up, allowing it to find all creatable dependencies.


Loads the specified makefile before any other makefiles, except for RootMakeppfile, or RootMakeppfile.mk above it, but do not consider this option for the purposes of determining the default target. If no other makefile is specified, then one is sought using the usual rules. If the specified makefile is the same makefile that is found using the usual rules, then this option has no effect.


Changes the name of the log file to the indicated name. By default, the log file is called .makepp/log. This file is readable with makepplog, mppl.


Makepp will repeatedly stop itself (go to sleep), before it analyzes and builds anything, for you to wake it up when you are ready. It will tell you some commands to choose from for waking it up again. If you do it in a Shell, you get the prompt and can then fore- or background it. If you do it within an IDE, it'll just sleep, and you can awaken it from another Shell. Depending on where you start it, closing that window may or may not terminate makepp, so check how to cope with this in your environment.

The intention is that you can start makepp this way before you're finished editing some files. Depending on your project structure and size, this can allow makepp to get a headstart of many seconds worth of work by the time you're done. Then every time you can edit more and awaken it again, unless you change something in your Makefile, which will go unnoticed until you start a new instance of makepp. The same applies to repositories, which must never change while makepp is running.

If you use prebuild or $(make), on the first round it will stop when it gets to that point.

-m method

Specifies the default signature method to use for rules which do not have the :signature modifier in makefiles which do not have a signature statement. Does not override the choice made by command parsers, e.g. C/C++ compilers. Possible values are md5, C or c_compilation_md5, xml and xml-space. For more details, see makepp_signatures.


When importing from a build cache, reject cached targets unless the MD5_SUM is present and matches the imported target. When populating a build cache, calculate and store the MD5_SUM in the build info if it isn't there already. This is slower and leads to more rebuilds, but it guarantees that imported targets and build info files correspond exactly.


Print out commands without actually executing them -- unreliably where commands depend on previous results. This allows you to see what makepp will do, without actually changing any files.

More precisely, makepp executes all recursive make commands as normal (but hopefully you're not using recursive make anywhere!). Other commands are simply printed without being executed. Even commands which are prefixed with @ or noecho are printed after the @ or noecho is stripped off. However commands prefixed with + should be executed, but currently are not.

Warning: The commands that makepp executes with -n are not necessarily the same thing it will do without -n. File signatures do not change at all with -n, which means that makepp cannot perform exactly the same build tests that it does when the signatures are changing. This will occasionally make a difference if you are using MD5 signatures (which is the default for compilation commands) or if you have shell commands that might or might not change the date.

For example, suppose that you generate a .h file via some sort of preprocessor. This can happen in a lot of different ways. For concreteness, suppose you automatically generate a list of prototypes for functions defined in each C module (see http://cproto.sourceforge.net/ for how the cproto application works or http://www.lemoda.net/c/cfunctions/ for the similar cfunctions).

    prototypes.h : *.c
        cproto $(CPPFLAGS) $(inputs) > $(output)

Then each .c file will include prototypes.h. The purpose of this is to maintain the forward declarations for all functions automatically, so if you change a function's signature or add a new function, you don't ever have to put in forward or extern declarations anywhere. You don't even have to declare the dependency of your .o files on this one -- makepp will see the include statement and automatically see if it needs to (re)run cproto.

Now suppose you change just one .c file. What happens when you run makepp with -n in this case is that it realizes that prototypes.h needs to be remade. In all probability, remaking prototypes.h won't affect its signature--the file contents will probably be identical because no function arguments have been changed--so most of the time, nothing that depends on prototypes.h actually has to be recompiled. But makepp doesn't know that unless it's actually allowed to execute the commands. So it assumes that anything that depends on prototypes.h will also have to be recompiled. Thus in this example, changing one .c file will cause makepp -n to think that every single .c file needs to be recompiled, even though most likely the regular makepp command will actually not run all those commands.

This situation isn't all that common, and can only occur if (a) you use a signature method that depends on file contents rather than date, as the default compilation signature method does, or (b) if you have shell commands that don't always change the date. E.g., with a traditional implementation of make that only looks at dates instead of file signatures, sometimes people will write commands like this:

    prototypes.h : $(wildcard *.c)  # Hacked technique not necessary for makepp
        cproto $(CPPFLAGS) $(inputs) > junk.h
        if cmp -s junk.h prototypes.h; then \
           rm junk.h; \
        else \
           mv junk.h prototypes.h; \

Thus if rerunning cproto on all the files produces exactly the same file contents, the file date is not updated. This will have exactly the same problem as the above example with makepp -n: it is not known whether the date on prototypes.h changes unless the command is actually run, so makepp -n cannot possibly be 100% accurate. (Note that using the traditional make -n will also have exactly the same problem on this example.)

makepp -n should always print out more commands than a regular invocation of makepp, not fewer. If it prints out fewer commands, it means that makepp does not know about some dependency; some file is changing that it is not expecting to change on the basis of what it knows about what files each rule affects. This means that your makefile has a bug.


Do not record the results of scanning, forcing it to be reperformed next time makepp runs.


Don't automatically load makefiles from directories referenced (see "Implicit loading" in makepp_build_algorithm). By default, makepp automatically loads a makefile from any directory that contains a dependency of some target it needs to build, and from any directory that is scanned by a wildcard. Sometimes, however, this causes a problem, since makefiles need to be loaded with different command line variables or options, and if they are implicitly loaded before they are explicitly loaded by a recursive make invocation or the load_makefile statement, makepp aborts with an error. You can also turn off makefile loading on a directory-by-directory basis by using the no_implicit_load statement in one of your makefiles.


Don't bother writing a detailed description of what was done to the log file. By default, makepp writes out an explanation of every file that it tried to build, and why it built it or did not build it, to a file called .makepp/log, readable with makepplog, mppl. This can be extremely valuable for debugging a makefile--makepp tells you what it thought all of the dependencies were, and which one(s) it thought changed. However, it does take some extra CPU time, and you might not want to bother.


Do not add implicit dependencies on executables picked up from the command search path. If this option is specified, then makepp assumes that any executable whose behavior might change with a new version will be specified with a name containing a slash.

This is useful for programs such as grep and diff, which always do basically the same thing even if their implementation changes, though you're better off using the builtin commands for grep. You may also need this for repositories on NFS clusters, where the same commands might not have the same timestamp everywhere, causing unnecessary rebuilds depending what machine somebody works on.


Don't populate the build cache, but still import from it when possible. This is useful when the environment might cause targets to be generated differently, but makepp doesn't know about such dependencies. It's also useful to avoid thrashing the build cache with a huge number of concurrent writers that might interfere with one another.


Turn off the entering or leaving directory messages.


Ordinarily, makepp loads each makefile in, then looks to see whether there is a rule that specifies how to update the makefile. If there is, and the makefile needs to be rebuilt, the command is executed, and the makefile is reread. This often causes problems with makefiles produced for the standard Unix make utility, because (in my experience) often the make rules for updating makefiles are inaccurate--they frequently omit targets which are modified. This can cause makepp to remake a lot of files unnecessarily. You can often solve this problem by simply preventing makepp from updating the makefile automatically (but you have to remember to update it by hand).


Don't print any warning messages to stderr, only to log file. Most warning messages are about constructs that you might see in legacy makefiles that makepp considers dangerous, but a few of them concern possible errors in your makefile.

-o filename

Pretends that the specified file has not changed, even if it has. Any targets that depend on this file will not be rebuilt because of this file, though they might be rebuilt if some other dependency has also changed. The file itself might or might not be rebuilt, depending on whether it is out of date with respect to its dependencies. (To prevent that, use --dont-build.)


Same as --signature-method, but even overrides the choice made by command parsers.


Generate an error rather than write files outside the "sandbox". Like --dont-build, more specific paths override less specific paths. The filesystem root defaults to out-of-sandbox if there are any --sandbox options.

The purpose of the sandbox is to enable multiple concurrent makepp processes to safely operate on disjoint parts of the filesystem. In order for this to work reliably, concurrent sandboxes must not overlap, and each process must mark the sandbox of every other concurrent makepp process for --dont-read. See partitioning into sandboxes.


Don't import from the build cache. This is useful when you want to donate targets to the cache, but you don't want to rely on the contents of the cache (e.g. for mission-critical builds).


Output raw timestamps before and after each action.

-R directory

Specify the given directory as a repository (see makepp_repositories for details). Repositories are added in the order specified on the command line, so the first one you specify has precedence. All files in the directory (and all its subdirectories) are automatically linked to the current directory (and subdirectories) if they are needed.

If you just specify a directory after -R, its contents are linked into the current directory. You can link its contents into any arbitrary place in the file system by specifying the location before an equals sign, e.g, -R subdir1/subdir2=/users/joe/joes_nifty_library.


Don't load the default rule sets. If this option is not specified, and the variable makepp_no_builtin is not defined in the makefile, then a set of rules for compiling C, C++, and Fortran code is loaded for each directory.


Ignore stale files rather then treating them as new source files, removing them if necessary in order to prevent them from being read by a build command. This is not the default because it deletes things, but it is often required in order for incremental building to work properly.

For example, assume that there is an x.c file that looks like this:

    #include "x.h"
    int main() { return X; }

Consider this makefile:

    $(phony default): x
        &echo "#define X 1" -o $@

At some point, you change the makefile to look like this:

    CFLAGS := -Idir
    $(phony default): x
        &mkdir -p $(dir $@)
        &echo "#define X 2" -o $@

Now if you build from clean, x exits with status 2, but if you build while the old ./x.h file still exists and you don't specify --rm-stale, then x exits with status 1, because the include directive picks up the stale generated header file.

If you build with --rm-stale, then ./x.h is removed, and the result is the same as that of a clean build, which is almost always a good thing.

Note that if you build in a repository, you have to give this option there first, because the importing makepp doesn't know what might be stale in the repository.

Legacy makefiles sometimes put the rule to generate an include file after the include statement. Mpp works around that like gmake, by reloading at the end of the makefile if needed. But this means on a rebuild it looks stale at the point where it is needed, and will be deleted. Therefore this option turns off this kind of reloading.


Don't echo commands and don't print informational messages like "Scanning" or "Loading makefile".


Restrain this instance of makepp to a subtree of a normally bigger build tree. See partitioning into sandboxes.


Downgrade violations of "in-sandbox" and "dont-read" to warnings instead of errors. See partitioning into sandboxes.


Exit in error rather than only warning about a build cache access collision that could be fixed.

If a repository contains a symbolic link, then by default that symbolic link is imported as a link, which is to say that the target of the imported link need not be identical to the target of the symbolic link in the repository. If the --symlink-in-repository-as-file option is specified, then the symbolic link is imported as its target file, which is to say that the imported link points to the same target file as the symbolic link in the repository. This is useful if the symbolic link in the repository was intended to have the build-time semantics of a copy.


This option is present to allow makepp to work with old makefiles that use recursive make extensively, especially with varying options. By default, recursive make is implemented by a subprocess that communicates with the parent process; the build is actually done by the parent process. This allows some of makepp's nice features like repositories to work with recursive make invocations. However, this technique will not work if you use different command line options on different invocations of recursive make. Before you use this, try --hybrid-recursive-make.

--traditional-recursive-make option makes makepp do recursive makes the same way as the traditional make, allowing more makefiles to work, but then repositories and parallel builds do not work properly. This option is rarely needed any more, and makepp will tell you if it runs into a construct that requires it.

If you do use this option, you will get log files piling up in the various directories this changes to. To get rid of only them use makeppclean --logs --recurse or mppc -lr.


Verbose mode. Explains what it is trying to build, and why each file is being built. This can be useful if you think a file is being rebuilt too often.

This option actually takes what would be written to the log file and displays it on the screen. It's usually easier to run makepp and then look at the output of makepplog, which allows various selections and some rewriting.


Print out the version number.


Don't rewrite build infos of files that were not created by this makepp process. See partitioning into sandboxes.

-W filename

Pretends the specified file has changed, so that any targets that depend on that file will be rebuilt. The file itself is not necessarily changed (it might or might not be rebuilt, depending on whether it is up to date with respect to its dependencies), but everything that depends on it thinks that it has changed. This can be useful for debugging a makefile.


Emit a warning anytime a variable a value is used that has not been initialized, at least to the empty string.


Makepp searches upwards for a file called .makepprc when starting and again after every -C or -c option. Each time it finds such a file, but only once per file, it will read the file and parse it as possibly quoted options on one or several lines. Unlike the option -A, the options will be parsed relative to the directory where the file resides.

Makepp looks at the following environment variables:


Any flags in this environment variable are interpreted as command line options before any explicit options. All command line arguments are put into this variable

Note that the traditional make also uses this variable, so if you have to use both make and makepp, you might want to consider using MAKEPPFLAGS.


Same as MAKEFLAGS as far as makepp is concerned. If this variable is not blank, then MAKEFLAGS is ignored. Sometimes this is useful instead of MAKEFLAGS if you have to use both make and makepp, and you need to keep the options separate.


Makepp will attempt to determine whether its default directory is case sensitive by creating a file and then accessing it with a different case. Usually this works fine, as long as all the files you're accessing are on the same file system as your default directory, so you should rarely need to use this option.

If this variable is present in the environment, its value (0 or empty string for false, anything else for true) will override makepp's choice. This variable is mostly useful on Windows, if you want to override makepp's default setting. If you don't treat filenames as case sensitive, then makepp converts all filenames to lowercase, which causes occasional difficulties. (E.g., emacs may will open several buffers to the same file.)

Makepp does not currently support a build across several file systems well, if one is case sensitive and the other case insensitive.