Live data from Hacker News

Using Make – writing less Makefile

text.causal.agency

151–160 of 200 posts

Re: Using Make – writing less Makefile

#151

Earlier quoted context omitted.

Why would you want that? In decades of programming in very varied environments I have never compiled any software project otherwise than by using globbing, so that I have never needed to waste time to write the name of any source file in a Makefile. I have never seen any reason to do otherwise. For instance, using special compilation flags for a certain source file, different from the others, is something that I cons…

Globbing means that the directory has to be scanned on every build Once you start getting to multiple directories and recursive scans, the build time begins to grow enormously and usually unexpectedly. Not a problem at all for small or even medium size projects on a fast machine. But once you start building very large projects with multiple sub-projects, it generally slows the machine to a crawl on every build.

I said unwise not inefficient.

Globbing is a security and reliability hole. You don't ever really know what got included or will get included, you just assume you do, and you are right only most of the time and only by luck not by actually ensuring it.

Saying things like "only the files I expect should ever be in this dir" is just wrong swiss cheese thinking. (you never said that, but another commenter essentially did)

Re: Using Make – writing less Makefile

#152

Earlier quoted context omitted.

> I wish they had fixed it to accept both tabs and spaces a long time ago. I have good news for you: this is already the case! In all modern versions of make you can use semicolons instead of tabs. You just write target : dependencies ; rule instead of target : dependencies ^Irule if, for some reason, you hate the beautiful tab characters.

Ha, what if the 'rule' is 5 lines long? Many times, a Makefile snippet in an HTML page or a PDF file has had the tab character auto-magically morphed into spaces. So when it is copied, it will be a syntax error in a Makefile. Even copying Makefile snippets from one terminal window to another will eat those tab characters. Fortunately my vim editor is configured to handle most of those edge cases now, but it took me..…

> control characters which are visually indistinguishable from other characters

This is a text editor configuration issue, not a character choice issue.

Re: Using Make – writing less Makefile

#153

Earlier quoted context omitted.

I'm a seasoned developer for the past 15-ish years and I haven't heard of ninja or gn before. I tried typing them in my command line (macos 12.4) and I would need to install them to use them. I was taught make in CS101 in college and the majority of other people's projects I've looked at use it. So the advantage is ubiquity and familiarity. Which can be useful if your code base is going to have a large number of peop…

> I'm a seasoned developer for the past 15-ish years and I haven't heard of ninja or gn before Then you also stopped learning about developments in your field 15 years ago. > I tried typing them in my command line (macos 12.4) and I would need to install them to use them. Ok? And? We don't pre-installed dev tools on consumer operating systems. You won't find valgrind or vcpkg either. > I was taught make in CS101 in c…

[deleted]

Re: Using Make – writing less Makefile

#154
post #131

Earlier quoted context omitted.

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, car…

http://9p.io/sources/plan9/sys/src/mkfile

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).

Re: Using Make – writing less Makefile

#155
post #144
post #141

Earlier quoted context omitted.

make is very useful. The idea that things depend on each other and are built as a hierarchy is important. But it is the opposite of beauty, or elegance, or organization. Honestly all the millions of man months that have gone into writing makefiles should have gone into making make more usable. for example: all the implicit rules in this article? Nobody¹ uses them, they should just be explicit. You shold explicitly di…

Apparently the reasoning behind a bunch of Make’s warts is that by the time Stuart Feldman realized the problem, it already had half a dozen users, and, well, he wasn’t gonna go and break it for them!

I don't see why there couldn't be (even today!) some statement like "require version XYZ", which Make could notice, which would enable new features and nicer syntax. Something like "editions" in Rust, though the idea is much older.

For some reason, people prefer to add more layers on top of Make rather than improving the core language and tool. Maybe there's some good reason?

Re: Using Make – writing less Makefile

#156
post #144

Earlier quoted context omitted.

Apparently the reasoning behind a bunch of Make’s warts is that by the time Stuart Feldman realized the problem, it already had half a dozen users, and, well, he wasn’t gonna go and break it for them!

I don't see why there couldn't be (even today!) some statement like "require version XYZ", which Make could notice, which would enable new features and nicer syntax. Something like "editions" in Rust, though the idea is much older. For some reason, people prefer to add more layers on top of Make rather than improving the core language and tool. Maybe there's some good reason?

I think people treat make like a dmv trip or taxes.

They want to get in, get it done, and get out.

But who wants to improve the DMV?

Re: Using Make – writing less Makefile

#157

Earlier quoted context omitted.

I'm a seasoned developer for the past 15-ish years and I haven't heard of ninja or gn before. I tried typing them in my command line (macos 12.4) and I would need to install them to use them. I was taught make in CS101 in college and the majority of other people's projects I've looked at use it. So the advantage is ubiquity and familiarity. Which can be useful if your code base is going to have a large number of peop…

> I'm a seasoned developer for the past 15-ish years and I haven't heard of ninja or gn before Then you also stopped learning about developments in your field 15 years ago. > I tried typing them in my command line (macos 12.4) and I would need to install them to use them. Ok? And? We don't pre-installed dev tools on consumer operating systems. You won't find valgrind or vcpkg either. > I was taught make in CS101 in c…

No need for personal attacks here, I'm just answering based on my experience.

Re: Using Make – writing less Makefile

#158
30 year veteran here, funny enough I barely know anything about make. My first job we were building our own build utility because we had to build on windows netware, dos, Linux… soon after that it was all cmake, and I never had to use a make file for much of anything.

Only recently have I come to be kinda fond of its insanely simple syntax but really make hasn’t been a requirement to native development since as long as I’ve been around getting paid.

Re: Using Make – writing less Makefile

#159

Nice to see some love for make. Sure, make syntax sucks. It's arcane and hard to google much of what is going on. (Shower thought... a tool that lets you view a Makefile, giving explanatory tooltips for syntax elements would be great). But make is widespread, ancient and eternal. It isn't going anywhere, despite decades of new tools trying to take its place. It does many jobs relatively well. I'd go so far as to say…

gradle is just a makefile with bells on and you’ll never convince me otherwise

Re: Using Make – writing less Makefile

#160
Back in 2000s I was all in the bash make unix camp. That was for ten years or so. Now I realize that it was just a religion, at least on my part. Python and Node and their libs are thousands of times better than all that nonsense (including arcanes like CMake).

I have a whole folder of personal tools I’ve written in bash, and had a similar set for make. Some of them I don’t want to touch, but when I have to, I just rewrite them in Node with a little io/ipc helper library I created and it feels like a breath of fresh air.

Post reply on HN