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.,
Options include most of the standard make options, plus a few new ones.
-F, except that subsequent
-Roptions are interpreted relative to the new directory, rather than the old one.
% 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.
--dont-buildfor the specified file or directory.
To resolve conflicts between
--do-build, the one
with the most specific path takes precendece regardless of order.
If the same path is specified with both
then the rightmost one wins.
-foption or the
-Foption, makepp looks first for a file in the current directory (or the directory specified by the rightmost
-Coption, if any) called
-Foptions 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
-R options are specified, you can make
targets relative to the current directory like this:
makepp -F /foo/bar -C . mytarget
makeppdoes 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.
load_makefilestatement, makepp aborts with an error. You can also turn off makefile loading on a directory-by-directory basis by using the
no_implicit_loadstatement in one of your makefiles.
Makeppfile, and not
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.
:signaturemodifier in makefiles which do not have a
signaturestatement. Possible values are
c_compilation_md5. This option has no effect on the signature method for C/C++ compilation; you must use the
signaturestatement or the
:signaturerule modifier to affect that. For more details, see the makepp_signatures manpage.
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
noecho are printed after the
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
http://cproto.sourceforge.net 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
-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; \ fi
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
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.
.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.
rc_substitution=0in your makefile.
$(patsubst )function) matches only the filename, not a directory. In other words,
%.cmatches only *.c. If you want
%.cto match **/*.c, specify this option. You can also enable this in your makefile by the assignment
makepp_no_builtinis not defined in the makefile, then a set of rules for compiling C, C++, and Fortran code is loaded for each directory.
If you just specify a directory after
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,
--traditional-recursive-makeoption 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.
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.