Live data from Hacker News

Polyglot Makefiles

agdr.org

41–44 of 44 posts

Re: Polyglot Makefiles

#41
post #37

I wish someone would write a modern alternative to GNU Make. I've looked and there don't seem to be any. The closest is Ninja but it doesn't seem to be intended to be hand written.

https://build2.org/build2/doc/build2-build-system-manual.xht...

> We believe, paraphrasing a famous quote, that those who do not understand make are condemned to reinvent it, poorly.

Alas, I think the developers have in fact done just that. Make is not a build system. Make is a batch shell.

Build2 didn't produce a better make, they produced yet another C++ build system.

Re: Polyglot Makefiles

#42
post #39

Earlier quoted context omitted.

I can see two areas in which it might break. I might put #!/usr/bin/env make -f in case it's somewhere in else in PATH. Also some systems (BSD, old commercial Unix) have non-gnu-compatible make and sometimes call their gnu make port "gmake" or "gnumake".

AFAIR on Linux shebangs only support single argument so it would fail in this case. One can overcome this treating the file as a shell script: #!/bin/sh # make ignores next line \ set -e # make ignores next line \ exec make -f "$0" "$@" Make treats slash-escaped new lines as a continuation even for comments, shell does not.

Wow. Impressive.

Re: Polyglot Makefiles

#43
post #37

Earlier quoted context omitted.

https://build2.org/build2/doc/build2-build-system-manual.xht...

> We believe, paraphrasing a famous quote, that those who do not understand make are condemned to reinvent it, poorly. Alas, I think the developers have in fact done just that. Make is not a build system. Make is a batch shell. Build2 didn't produce a better make, they produced yet another C++ build system.

We did start with C++ thinking (correctly, IMO) that if we can build C++, we can build pretty much anything. But build2 is a general-purpose build system, for example:

https://build2.org/build2/doc/build2-build-system-manual.xht...

https://github.com/build2/libbuild2-rust

Re: Polyglot Makefiles

#44
post #43

Earlier quoted context omitted.

> We believe, paraphrasing a famous quote, that those who do not understand make are condemned to reinvent it, poorly. Alas, I think the developers have in fact done just that. Make is not a build system. Make is a batch shell. Build2 didn't produce a better make, they produced yet another C++ build system.

We did start with C++ thinking (correctly, IMO) that if we can build C++, we can build pretty much anything. But build2 is a general-purpose build system, for example: https://build2.org/build2/doc/build2-build-system-manual.xht... https://github.com/build2/libbuild2-rust

I think these examples support my position, they do not refute it.

If you have to write plugins to describe the rules that walk the edges of the DAG, then you haven't captured the essence of Make. It isn't just the DAG, its also the ability to walk graph edges with a generic shell alone. Here's some examples of things that we're using it for:

- Compile C, C++, and FORTAN on a common DAG for 5 unique ABIs.

- Parallelizing and sequencing atmospheric analysis with orbital mechanics programs.

- Post-processing our regression test suite.

- Executing and verifying SystemVerilog tests.

- Generating documentation with Doxygen and LaTeX.

- Generating linear flash images and a compressed initial filesystem.

- Transforming said initial filesystem into a linkable object.

Make does all of things without any prior knowledge of any of them, because it just uses the shell to express how the edges are walked. In some cases, we build the program that traverses an edge and express that as just another dependency in the chain.

If you have to write and compile plugins into build2 to do things like that, then you haven't re-implemented Make. You've just created another purpose-dedicated build tool. That's fine if its what you set out to do. But that also means statements like "We believe, paraphrasing a famous quote, that those who do not understand make are condemned to reinvent it, poorly." do not belong in your documentation. Because I don't think you understand Make.

Post reply on HN