A mostly GNU-compatible python implementation of `make`
Original Author: Benjamin Smedberg
(Now maintained by the Mozilla community.)
make.py (and the pymake modules that support it) are an implementation of the make tool
which are mostly compatible with makefiles written for GNU make.
For more information about building Mozilla using pymake, see
the Mozilla Developer Center docs.
The Mozilla project inspired this tool with several goals:
- Improve build speeds, especially on Windows. This can be done by reducing the total number
of processes that are launched, especially MSYS shell processes which are expensive.
- Allow writing some complicated build logic directly in Python instead of in shell.
- Allow computing dependencies for special targets, such as members within ZIP files.
- Enable experiments with build system. By writing a makefile parser, we can experiment
with converting in-tree makefiles to another build system, such as SCons, waf, ant, ...insert
your favorite build tool here. Or we could experiment along the lines of makepp, keeping
our existing makefiles, but change the engine to build a global dependency graph.
- Order-only prerequisites are not supported.
- Target-specific variables behave differently than in GNU make: in pymake, the target-specific
variable only applies to the specific target that is mentioned, and does not apply recursively
to all dependencies which are remade. This is an intentional change: the behavior of GNU make
is neither deterministic nor intuitive.
- On Windows, Mozilla builds correctly, but many other MSYS-based projects will not. This is because pymake is not a native MSYS program, and does not recognize MSYS-style paths.
- There is a subtle difference in execution order that can cause unexpected changes in the
In this case, pymake resets the vpath resolution of foo.c, while GNU make does not. This shouldn't
happen in the real world, since a target found on the VPATH without commands is silly. But
mozilla/js/src happens to have a rule, which I'm patching.
- A file foo.c exists on the
- A rule for foo.c exists with a dependency on sometool and no commands
- sometool is remade for some other reason earlier in the file
- pymake does not implement any of the builtin implicit rules or the related variables. Mozilla
only cares because pymake doesn't implicitly define
$(RM), which I'm also fixing in the Mozilla
- Parsing is currently very slow compared to GNU make, to the point where the overhead is
noticeable. I would love help implementing a parsing system using mxTextTools
instead of Python regular expressions, which would be much more efficient.
Note that on Windows pymake is still a net improvement for building Mozilla,
because of the insane overhead of launching processes on Windows.
Initial code was written by Benjamin Smedberg. The code is now maintained by the Mozilla community, primarily Ted Mielczarek and Kyle Huey.
MIT license. See the LICENSE file.