This is the documentation of version 1.40.1. You may want the documentation of the stable version (2.0) or of the well tested 2.1 development snapshot or our homepage.

Makepp Command Options

Command line syntax for makepp

makepp [-options] [VAR=value] target1 target2 ...

-C, -f, -F, -j, -m, -o, -r, -R, -W, --assume-new, --assume-old, --directory, --dont-build, --do-build, --file, --jobs, --log, --makefile, --makeppfile, --load-makefile, --noremake-makefiles, --repository, --signature-method

Makepp supports most of the command line options and syntax that other makes support. 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

Options include most of the standard make options, plus a few new ones.

-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.

-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.)

Treat filenames like on Unix. Useful on Cygwin, when using commands ported from Unix. These may be confused when passed a lowercase filename even though the actual filename is mixed- or uppercase.

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.

-C dirname
Cd to the given directory before loading the makefile and trying to build the targets. This is more or less equivalent 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.

Do not build the specified file, even if it is listed in a dependency list. This is useful if you built a specific file by hand using some extra debugging 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 recompile the module you compiled by hand because it recognizes that the file has changed since it was last built. This is 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 the makepp_variables manpage for an easy way of doing this.

If the specified file is a directory that already exists, then files below the directory inherit the dont-build property.

Override --dont-build for the specified file or directory.

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

-f Makefile
Uses the specified makefile. 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 Makeppfile, then makefile, then Makefile.

-F Makefile
Loads the specified makefile in lieu of the makefile in the current directory, and any target specified to the right of this option is interpreted relative to the directory containing the Makefile. If you specify a directory instead of a Makefile, searches for Makeppfile, makefile, and Makefile. Multiple -F options may be specified.

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

--load-makefile Makefile
Loads the specified makefile before any other makefiles, 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.

Print out a brief summary of the options.

-j n
Interprets the next word 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.

Build as many files as possible, even if some of them 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.

Symbolic links made from a repository into a directory are usually removed at the end of the build process. This option leaves the links in the build directory. This is mostly useful if you need to run the debugger on a project built with repositories: if you do not specify this argument, you will have to tell the debugger manually where your source files are, because the debugger doesn't know they came from the repository.

Changes the name of the log file to the indicated name. By default, the log file is called .makepp_log.

Don't automatically load makefiles from directories referenced (see Implicit loading in the makepp_build_algorithm manpage). 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 varaibles 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.

If implicit loading of makefiles is enabled, then automatically load only a file called Makeppfile, 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.

-m method
--signature-method 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. Possible values are target_newer, exact_match, md5, and c_compilation_md5. This option has no effect on the signature method for C/C++ compilation; you must use the signature statement or the :signature rule modifier to affect that. For more details, see the makepp_signatures manpage.

Print out commands without actually executing them. 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.

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 for how the cproto application works).

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.

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 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.

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. 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.

Disables rc-style substitution of make variables (see rc-style substitution in the makepp_variables manpage for details). Ordinarily rc-style substitution is either harmless or beneficial, but occasionally you may find a case where it breaks an existing makefile. Also, disabling rc-style expansion is necessary to prevent stripping of leading and trailing whitespace from variables. See the makepp_incompatibilities manpage for when this is important. You can also disable rc-style substitution on a per-makefile basis by setting the variable rc_substitution=0 in your makefile.

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. 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.

By default, % in a pattern rule (not in the $(patsubst ) function) matches only the filename, not a directory. In other words, %.c matches only *.c. If you want %.c to match **/*.c, specify this option. You can also enable this in your makefile by the assignment percent_subdirs=1.

Don't print informational messages like ``Scanning xyz.h'' or ``Loading makefile /users/src/bob/funproject/Makefile''.

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.

-R dir
Specify the given directory as a repository (see the makepp_repositories manpage 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 and temporarily 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.

This option is present to allow makepp to work with old makefiles that use recursive make extensively. 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, or if you use different command line options on different invocations of recursive make. The --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.

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 .makepp_log.

Print out the version number.

Last modified: 2004-04-13