mach

A work-in-progress implementation of make(1)

git clone https://git.8pit.net/mach.git

commits

2024-01-07 Allow macros on left side of assignments Sören Tempel
2024-01-07 Parser: Add custom tokens utility method Sören Tempel
2023-12-29 Allow passing - to -f in order to read from stdin Sören Tempel
2023-12-29 Add support for -r Sören Tempel
2023-12-21 Add support for -S Sören Tempel

Clone the repository to access all 164 commits.

README

A WiP implementation of make(1), aims to be compatible with P1003.1™-202x/D3 at some point. The name refers to the transitive verb for machen, the German translation of the word make.

Motivation

The goal is to write a clean, easily extendible implementation of POSIX make in order to enable experiments with fancy new make features. For example, bazel-like sandboxing (executing each target in a Linux namespace) to find impure dependencies in existing Makefiles, or debugging features such as the ones provided by the remake project.

Status

Presently, the implementation is mainly a proof of concept. Many parts of the POSIX standard are not implemented and some parts are implemented in a not fully conforming way. However, some software which more simple Makefile configurations can already be compiled using mach, e.g. pdpmake. Refer to the equivalence tests against a known-good make implementation in tests/golden for more information on what is known to work right now. Further information is also available in the TODO.md file.

Installation

This software is intended to work with recent version of GHC without requiring additional external dependencies, i.e. only relying on the libraries bundled with GHC. Currently, GHC 9.2 and 9.4 are known to work, newer versions may works as well (if not, patches are more than welcome). If a compatible GHC version is available on your system, mach can be installed using Cabal. Otherwise, installation using Guix is recommended. More details on both installation methods is provided below.

Cabal

Assuming the presence of a supported Haskell toolchain version, mach can be installed using Haskell’s Cabal package manager. In order to do so, clone the repository and running the following command from the repository root:

$ cabal install

If Cabal is configured correctly, the mach executable show be available in your $PATH.

Guix

If a supported GHC version is not available on your system (e.g. because the GHC packaged by your distribution is too old) then you can also install mach using Guix. Guix is a functional nix-like package manager which can be used alongside your distributions package manger. Once Guix is installed on your system, you can build mach by cloning the repository and running the following command:

$ guix time-machine -C channels.scm -- package -f guix.scm

If Guix is configured correctly, this should add the mach executable to your user’s profile.

Development

Code should be formatted using ormolu. A githook for this purpose is available which can be enabled using:

$ git config --local core.hooksPath .githooks

Related Work

License

This work is licensed under CC BY-NC-SA 4.0.