mach

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

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

 1## README
 2
 3A WiP implementation of `make(1)`, aims to be compatible with [P1003.1™-202x/D3][posix draft] at some point.
 4The name refers to the transitive verb for [*machen*][wiktionary machen], the German translation of the word *make*.
 5
 6### Motivation
 7
 8The goal is to write a clean, easily extendible implementation of POSIX make in order to enable experiments with fancy new make features.
 9For example, [bazel][bazel web]-like [sandboxing][bazel sandbox] (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][remake github].
10
11### Status
12
13Presently, the implementation is mainly a proof of concept.
14Many parts of the POSIX standard are not implemented and some parts are implemented in a not fully conforming way.
15However, some software which more simple Makefile configurations can already be compiled using mach, e.g. [pdpmake][pdpmake makefile].
16Refer to the equivalence tests against a known-good make implementation in `tests/golden` for more information on what is known to work right now.
17Further information is also available in the `TODO.md` file.
18
19### Installation
20
21This 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.
22Currently, GHC 9.2 and 9.4 are known to work, newer versions may works as well (if not, patches are more than welcome).
23If a compatible GHC version is available on your system, mach can be installed using [Cabal][cabal web].
24Otherwise, installation using [Guix][guix web] is recommended.
25More details on both installation methods is provided below.
26
27#### Cabal
28
29Assuming the presence of a supported Haskell toolchain version, mach can be installed using Haskell's Cabal package manager.
30In order to do so, clone the repository and running the following command from the repository root:
31
32    $ cabal install
33
34If Cabal is configured correctly, the mach executable show be available in your `$PATH`.
35
36#### Guix
37
38If 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 web].
39Guix is a functional [nix][nix web]-like package manager which can be used alongside your distributions package manger.
40Once Guix is installed on your system, you can build mach by cloning the repository and running the following command:
41
42    $ guix time-machine -C channels.scm -- package -f guix.scm
43
44If Guix is configured correctly, this should add the mach executable to your user's profile.
45
46### Development
47
48Code should be formatted using [ormolu][ormolu github].
49A githook for this purpose is available which can be enabled using:
50
51    $ git config --local core.hooksPath .githooks
52
53### Related Work
54
55* [The original Make paper by Stuart I. Feldman][feldman make]
56* [Plan 9's rewrite of make, called mk][plan9 mk]
57* [A re-implementation of Plan 9 mk in Haskell][hmk github]
58* [A Linux port of NetBSD make][bmake web]
59* [The make implementation provided by the GNU project][gnu make]
60* [remake, an enhanced version of GNU make][remake github]
61* [pdpmake, a implementation of POSIX make written from scratch in C][pdpmake web]
62
63### License
64
65This work is licensed under [CC BY-NC-SA 4.0][cc license].
66
67[posix draft]: https://www.opengroup.org/austin/login.html
68[cc license]: http://creativecommons.org/licenses/by-nc-sa/4.0
69[feldman make]: https://doi.org/10.1002/spe.4380090402
70[plan9 mk]: https://plan9.io/sys/doc/mk.pdf
71[hmk github]: https://github.com/mboes/hmk
72[bmake web]: http://www.crufty.net/help/sjg/bmake.html
73[gnu make]: https://www.gnu.org/software/make
74[remake github]: https://github.com/rocky/remake
75[pdpmake web]: https://frippery.org/make/
76[pdpmake makefile]: https://github.com/rmyorston/pdpmake/blob/master/Makefile
77[guix web]: https://guix.gnu.org
78[nix web]: https://nixos.org/nix/
79[cabal web]: https://haskell.org/cabal
80[bazel web]: https://bazel.build
81[bazel sandbox]: https://bazel.build/docs/sandboxing
82[wiktionary machen]: https://en.wiktionary.org/wiki/machen
83[ormolu github]: https://github.com/tweag/ormolu