News for hackers. Stuff that matters.
Re:Using Make – writing less Makefile by wokwokwok on Tuesday December 26, 2023 @07:10PM (#38777510)
You see, this is why I personally hate make: automake.

As you say, a small elegant makefile is lovey.

That is not the sort of makefile you get from the autoconf/automake family, and (ha!), good luck if something goes wrong.

The reality is that a small simple makefile is not sufficient to build real software.

The problem is fundamentally that make doesn’t compose well.

Most real build systems such as cmake, scons, cargo, etc. provide primitives for dealing with complex messy situations like “oh today I’m using visual studio not clang” or “does this platform have stdbool.h?” or “is the flag for disabling a warning different on this compiler?”

…and a way of composing that tasks into smaller ones (eg. add_subdirectory() and find_package()).

Make does not.

Make is a simple tool for simple tasks.

The reason people don’t like it, in my experience, is they have had to work with a make based project that has grown beyond the trivial size and it’s become a nightmare.

It makes easy things easier, and hard things much harder.

If worked on SPAs where they used make instead of webpack; but it’s a stupid solution. It doesn’t do live reloading, or any of the other pipeline stuff… but by gosh they tried!

You know what I like about clojure? It’s a simple tool that scales well for both simple and complex tasks.

Make simply doesnt.

…and that is reflected in the reality, which is that increasingly build tools are moving away from it and towards others, even for the low level tasks that people used to “generate makefiles” for eg. to ninja

I really am not a cmake fan; but there absolutely no denying it works very well in many real world situations, where trivial “-lsqlite” flags in a naive makefile don’t and cant work.

Re:Using Make – writing less Makefile by bufio on Tuesday December 26, 2023 @07:34PM (#38777659)
Re:Using Make – writing less Makefile by bxparks on Tuesday December 26, 2023 @08:11PM (#38777936)
Woah, what is that @{ construct in that mkfile? I cannot find it in the GNU Make Manual (https://www.gnu.org/software/make/manual/make.html). I use backslash-before-newline for multi-line loops like that.
Re:Using Make – writing less Makefile by wokwokwok on Tuesday December 26, 2023 @10:00PM (#38778617)
You can find an exception to any rule, but you'll find, in general, that its both self-evident and unsurprising that make is on the decline, and being replaced by other tools.

plan9 exists in an enviable position of only needing to build in a few controlled environments.

For example, http://9p.io/sources/plan9/sys/src/libmach/mkfile reads:

    CFLAGS=$CFLAGS -I/sys/src/cmd
Cute. Non-portable. A perfect example of how make is useful in trivial or contrived circumstances only.

/shrug

Try reading the llama.cpp makefile, which is an example of an excellent cross platform makefile that works very well: https://github.com/ggerganov/llama.cpp/blob/master/Makefile

^ this is what many real Makefiles look like, and this one is excellent and well maintained.

Many are worse.

Make is good when you only have easy problems to solve (like, specifically, only having to build one specific constrained environment for one specific compiler).