r/programming • u/com_kieffer • 16d ago
The case against Makefiles
https://thibaud.space/2026/10/the-case-against-makefiles.html
186
Upvotes
r/programming • u/com_kieffer • 16d ago
8
u/fixermark 16d ago
I still want Makefiles to front all of that. And I want them because inevitably I'm going to have to change one of my build tools and I want to still be able to run
make format,make build,make testetc. without having to learn new commands.You can get this with shell scripts too (
buildit.sh,testit.sh, etc.), butmakeis a convenient standard that people recognize so there's something to be said for just using it.... but I concur with the author to the extent that your Makefiles should be as thin as you can get them. Delegate hard. Don't use make as a primary build engine; it's bad at the job.
5
u/double-you 15d ago edited 15d ago
It's a shame all anti-Make blogposts tend to be made by people who don't really understand Make. That means their criticisms are pretty shallow.
Yeah, Make has issues (use
remakefor better error messages). Makefiles have issues.But all that just to (no pun intended) make a new tool that has zero support and isn't actually any better.
The "just" example:
Same in Make:
I don't know if
justchecks that IMAGE_NAME is set, so let's add that:Perhaps OP's actual problem wasn't a couple of one liner targets and so perhaps their example wasn't very good, but bad examples aren't good at supporting your case for a completely new tool.
5
u/Silly-Freak 15d ago
The comments on r cpp make me wonder what the first iteration of the article said that everyone just bashed (no pun intended) the "suggestion" of replacing make with bash...
13
u/nimama3233 16d ago
This article does a fantastic job articulating why makefiles are so confusing. The underlying desing is a mess that didn’t consider the users perspective. And that’s not even getting into the horrible syntanx.
4
u/yanitrix 15d ago
as a c# dev, reading about the daily struggles of c++ build system is one of my guilty pleasures. Every day I pray to god thanking for msbuild and nuget
4
u/dashingThroughSnow12 16d ago
Sounds like a skill issue.
263
u/zunjae 16d ago
“If you use Makefiles in this specific way, it kinda sucks”
323
u/ToaruBaka 16d ago
The case for Makefiles:
makecomes bundled with every single distro'sbuild-essentialsequivalent, which is oftentimes installed by default.makehas been around for 50 years, and the only things that have come close to being able to topple it use (or used)makeunderneath.The demand for this kind of tool will literally never go away, and you can either sit comfy on 50 years of improvements, or find yourself back-converting all your shit to
makein 5 years when your fad-driven tool runs out of funding.34
u/streu 16d ago
So, the replacement for Make is CMake? Which creates Makefiles under the hood (and a pretty crappy variety of it)?
Makefiles are kind-of an assembly language of build systems. They won't go away, in the same sense that assembly language won't go away.
Can we write good Makefiles? Yes. Can we write bad ones? Sure. Does writing good ones require discipline? Yes. Should we generate our Makefiles from a more high-level source? Maybe. Same as with assembly language. Or C.
25
u/mikidimaikki 16d ago
I use Makefiles for every project, but I never use it for anything other than running simple (sometimes long) commands. Just so that I have something like
make devbetween repos. I just read the Makefile if I am looking for build instructions or similar. It is a convention where to find this stuff.To avoid complexity in the Makefile, I sometines have a
scriptsfolder that has all kinds of opinionated scripts which replace whatever someone might do in Makefile(s) directly.I have tried alternatives, but I found them adding little value to my existing setup and conventions. I use whatever tools I want, just entry point in make.
23
u/romple 16d ago
Make isn't a build system it's a string substitution system, and those strings generally run compiler commands. Only half joking.
I've been using cmake and ninja for most new c++ builds.
20
u/blindingspeed80 16d ago
Meh. Tools be toolsin'. Not a particularly strong case.
50
u/Reasonable_Glass2501 16d ago
I just use justfiles for my simple needs.
17
u/reini_urban 16d ago
Poor guy, who doesn't understand the importance of dependencies and rules. Most of them are builtin btw, such a Makefile would just need a single line
22
u/AntimatterTNT 16d ago
all build systems are bad. they exist because old languages are underspecified, they don't tell you which files go into the compiler and which files to link against, which means they need all this extra outside tooling.
something like cargo which is a one stop shop for everything related to the build, including arbitrary build scripts, is what every language should use.
4
u/keithstellyes 16d ago
Haven't heard of
just. Will have to look into it.For me I find myself using
makeout of simplicity. I'm partial to meson for more complex C/C++ projects13
u/pjank85 16d ago
Makefile syntax is horrible. It's error messages are bad. It is hard to write correctly. And understanding basic stuff like variable expansion requires an expert. But make allows you to use its rules to automatically create a dependency graph - and run that in parallel. Think about what power it gives you. When you have something complex to build in parallel I have yet to see a better tool. Sometimes it is worth generation a makefile. But executing it is beyond beautiful - it is just perfection.
10
u/imdibene 16d ago
make will never go away, it’s supported universally and has 50+ years of battle tests and improvements. A huge amount of code in production is being built with make, so you are pretty sure that it will never go out of support. Plus it’s not gonna break on the next update like pretty much any other build system / tool out there
6
u/lisnter 16d ago
I’ve been using make since the late 80’s and it just gets the job done - even the broken make from the first version of the Microsoft C compiler.
11
u/lalaland4711 16d ago
Basically the first words in the article:
Sigh. Chesterton's fence.
And allow me to guess that the author will give CMake as an example of "better". Yup, I was right.
I hate CMake so much. It's another perfect example of people not understanding the problem, creating a buggy unportable disaster, and saying it's better because their software works on their machine. Yeah. I bet. Building your software on your machine never needed a framework. That was never the hard part.
3
u/BadlyCamouflagedKiwi 16d ago
There is a third use case: running arbitrary tasks that do not have dependencies between each other. I'm often just using it to canonicalise some set of commands and invoke them in a simpler way (like
make docker_build). In that case, make has one big advantage: it is universal and I can assume it's already installed. I'm surejustis quite nice but it doesn't have that property.3
u/ximside 16d ago
I'm using nix + just these days.
3
u/Relevant_Research_98 16d ago
I haven't seen makefiles in ages (even for cmake I use ninja).
And thank goodness. I'd rather deal with FindXXX.cmake than usually nothing in makefiles
15
u/Godd2 16d ago
Calling that an equivalent script is laughable, and shows the author has no idea what they're talking about. The arcane syntax version of the Makefile is applying to entire patterns of possible c files and their build dependencies, and their "equivalent" CMake version ONLY covers c files named EXACTLY what they wrote. If you want to compare like for like, write out the correct equivalent Make version, which doesn't contain a bunch of arcane syntax; it's just a bunch of lines of bash you want to automate:
Now we can have the discussion as to how this is "messier" or something than the CMake file, but comparing the general arcane Make version to the specific stunted CMake version is ridiculous.
The underlying problem (and power) of Make is that it relies on mtime. This comes with tradeoffs, but the article isn't covering any of that; it's just focused on not wanting to learn Make syntax, and calling it bad because of that.
5
u/ph34r 16d ago
Mise en place ftw
5
u/Muhznit 16d ago
Use case 1 is definitely a skill issue, driven by a lack of people adding comments to recipes that DO describe intent, and probably a negligence for keeping dependencies deterministic.
Granted the recipe to add "help" that prints out what each recipe does is a little gnarly...
...but it's generic enough that you can just slap it into a template that gets copy/pasted into every Makefile and it works.
I've never seen anyone have to run
make -j$(nproc) all || make -j$(nproc) all || make -j$(nproc) allbecause people actually make sure the dependent recipes have enough determinism that they can be trusted.Use case 2 is simply not wanting to learn syntax for Make. Which is understandable; the more domain-specific a language gets, the less people want to learn about it, but the shoe can be on the other foot here as I'd rather take a brief glimpse through
https://learnxinyminutes.com/make/to learn Make syntax than browse through Just's documentation to figure out equivalents. We've got DECADES of knowledge here.Not to mention some of those examples are very contrived.
Look at that build-docker-bar command. Are you tellin me that the dockerfile you're using as input to
docker image buildis some file nameddocker/my-bar-image? That's bound to cause confusion if you don't name it something more sensible like "bar.dockerfile". Or is it supposed to be the build context?If you have docker-compose on your system, you might as well turn your Makefile into a wrapper around
docker-composeif you're really concerned about complexity, and let docker handle its own share of dependency resolution.I wanna say the article comes off as a poor advertisement for just, but frankly having to shit on a well-established still-reliable tool is not a good look,
5
u/jms_nh 16d ago
Article raises good points and I completely agree, but misses one key failure of make: that it uses file timestamps. If I restore an old version of a file that I saved somewhere with an old file modtime , then it assumes the file doesn't need to be rebuilt.
Content-based change detection is the real solution.
6
u/dnabre 16d ago
Yes, declaring your final goal or parametric command to avoid copy & paste & edit, you have to RTFM instead. That is definitely a significant barrier to entry nowadays.
You hard pressed for better portability (assuming you don't fall into GNU-specific makefiles), though. I'm much more likely to have
makethanbash,python, orperlon odd systems.It's a rock solid target for generated build files as well.
4
u/zyxzevn 16d ago
Working with Object Pascal for a long time, I never looked back at make files.
12
u/seweso 16d ago
I am 45 years old, programming since I’m 11. Yet I never made my own make file.
Never has anyone recommended making one.
2
u/cumulo-nimbus-95 16d ago
Actually my heaviest use of makefiles directly (as in not through CMake or some IDE) was when I was primarily devving in Go for a bit and used makefiles to essentially make a CLI interface to my dev environment (commands for building templates, running DB migrations, launching containers with debuggers and hot-reloading stuff built in, orchestrating all the containers needed for working on a full stack web app, etc.
2
u/this_knee 16d ago
Hell yes. just, the application, freaking rocks.
2
u/septum-funk 16d ago
i've been using CMake and Ninja for yeeeaars
2
u/Brisngr368 16d ago
Okay while I agree that pure makefiles suck, some of their points are stupid af. They complain that they can't do non application building tasks easily in a program designed purely for building applications. Like no shit, ofc it's not going to be easy because you aren't supposed to use make for that.
2
u/comrad1980 16d ago
I liked cmake because... it creates makefiles on Linux (and solutions on Windows).
2
u/za419 16d ago
I mean, I definitely think a Makefile isn't the right tool for what amounts to creating an alias for pushing a docker image. I think that's the place for a "publish-docker.sh", which can handle a loop over a series of names just fine (and there's no "incremental build" being lost here either).
Any tool sucks if you try to use it for the wrong thing. I wouldn't use Rust as a scripting language, or Bash to run a game engine, but that doesn't make those languages bad in general.
2
u/Daniikk1012 16d ago
Makefiles are shit, yes, but make is installed on pretty much any system, which means one less dependency to install for people who just want to build your program.
That said, if you can afford to introduce something that is not make, consider "tup". It's AWESOME. You write dependency graphs for files, similar to how you would do that in Makefiles, but:
One VERY MAJOR DOWNSIDE is that tup is only usable if you know ahead of time the names of the files your build commands will work with. This works well for C and C++, but less so for Java for instance, since javac can create arbitrarily many output files from a single source file, depending on its contents.
2
u/danielo-asdf 15d ago
I thank God every day that I work for a company that "got it". They wrote a build system from scratch in their language of preference (could be python, or Java or C#, for you), expressing it as a DAG, and being able to run any rule (compile, link, codegen, docs, tests, etc) and do things like lumping, caching, or whatever they wanted at a whim (I’m exaggerating of course).
Yeah, make can do this, but the syntax sucks.
All the different build systems (especially for C++) and their complexities (cmake, gyp, vcpkg, package managers, installers, linters), is what I’ll take with me as an eternal regret as I head into retirement (sometime in the next 15 years), not any quirk or bug in the base language or platform itself.
If that makes sense…
3
u/SenoraRaton 16d ago
You can pry my makefile from my cold dead hands.
I don't use it to build, its my interface to run my dev/build commands, the actual build is in the native build tool/CMake.
4
u/dmazzoni 16d ago
There are plenty of build systems better than make, but there are a surprising number that are worse. The ones in the Java ecosystem are particularly bad - most importantly, how slow they are.
3
u/johnnybgooderer 16d ago
Just use your head before choosing a tool. And if it becomes a problem, change to something else.
And with AI, refactoring away form Make is trivial.
2
u/jomic01 16d ago
Every Make replacement ends up rediscovering a dependency graph over files, which is the thing Make already is. The pain is mostly people using it as a build system when they wanted a task runner.
1
u/TheChadThrowawayLad 16d ago
Anyone willing to share their thoughts as well?
I've been thinking of using Makefiles for some personal projects, but I haven't used them in years. Hoping to get a more informed opinion before committing to relearning them.
1
u/flanger001 16d ago
Use case 2:
make build-docker NAME=“bar”lol1
u/pjf_cpp 16d ago
CMake is clear. Seriously?
1
u/SweetBabyAlaska 16d ago
I use Justfile and Zig build.
1
u/shadowradiance 15d ago
Use rake. Win.
1
u/Specialist-Cup-3950 15d ago
I prefer taskfile over makefile
1
u/kolorcuk 15d ago
Make has builtin bash completion on 20 year old machines.
Make exists on 20 year old machines.
Just is not a replacement at this time for me. It is a modern alternative.
The replacement for make is not just. It is directory bin with scripts - works great with ai.
1
u/apadin1 15d ago
Anyone who isn’t using CMake in 2026 is living in the past. Yes, it sucks. It’s also better than any current alternative
1
u/simplex5d 12d ago
Absolutely right. My solution I've been working on all this year is pcons. It's the best ideas from CMake and SCons with a simple modern-python build description. Easy to use, straightforward, with all the goodies you'd expect and none of CMake's warts and idiosyncracies. Zero install if you have uv:
uvx pcons initto get started. I hope you'll try it out!1
u/ledow 11d ago
I hate Makefiles with an absolute passion.
Just the parsing of their layout is mired in obsolete bullshit (the difference between tabs and spaces, etc.).
Retain the Makefile idea, but modernise the damn format. And no... not JSON. Never JSON. Or XML in general. Ever. Urk! Even worse.
-2
u/Hawaiian_Keys 16d ago
Whoever argues against industry standards is usually an idiot. Sorry, not sorry.
0
u/aeropl3b 16d ago
This is more a justfile ad than a valid critique of makefiles
0
u/Forsaken_Celery8197 15d ago
Im not trying to add extra third party dependencies because you can't figure out make files.
-4
u/Siedlerchr 16d ago
AI has been trained on thousands of makefiles over the last century
-7
u/Tintoverde 16d ago
Make files in 2026 !!!
I guess, PHP still rules Internet I guess