News for hackers. Stuff that matters.
Re:Advice to my younger self: become allergic to the churn by Crinus on Thursday August 08, 2019 @10:05AM (#20644681)
You may hate Make and it is certainly far from ideal (tab-based syntax was a mistake) but the thing is, Make has very simple rules that haven't changed for decades and Makefiles generally keep working (and when they break it isn't the fault of Make itself but of something else that isn't as stable/backwards compatible as Make).
Re:Advice to my younger self: become allergic to the churn by kabdib on Thursday August 08, 2019 @11:20AM (#20645361)
Common make fail #1

The project you landed on has been using some souped-up supermake with a ton of features (which were used with wild abandon) and some subtly different semantics for (say) macro expansion and variable assignment (and these are really difficult to determine the dependency scope of). The build system has grown to a recursively gnarly Turing-complete mess.

So when you go to update the tooling, you find out that this supermake is (a) a commercial project, (b) the company has gone out of business, or adopted a predatory per-seat licensing scheme, or no longer supports your platform, or has changed the product so significantly that you might as well port everything to a different version of make anyway.

Never happened to me.

Common make fail #2

I was regularly dealing with bugs in multi-million-line makefiles. Make, you see, has no debugger; you can't step through things to find out what's going on. To debug an issue you insert print (echo) statements and look at output, and/or gronk through many, many lines of make's internal structures. Why didn't file A compile, and why file B compile twice? It could take a long time to figure out.

Common make fail #3

"Builds are too slow, we need to speed them up."

So you go parallel. Hey, this is easy. Except for those libraries there (they need to be done first). And those headers are generated, so those need to come first, but first first. And everything depends on these libraries getting built, so need to wait for the linker here, here and here. Pretty soon you have a dependency hairball that nobody understands and that people are afraid to change because things always break. Eventually you get to a point where "yeah, building twice usually seems to fix that issue..." and that's when you know the project has grown too damned big for its shell again.

Common make fail #4

You die a little each time that you get screwed by tab-versus-space. And cross-platform . . . umm, what year is it? Then someone smugly mentions some XML-based tool to you, and you snap because that tool is worse in every single measurable dimension and a few more besides but the developer in question doesn't question things because the tool uses Holy XML and Blessed Java (well, some version of Java, anyway, you can probably still download it from somewhere) and who cares if it's just the same set problems with a different color paint slapped on top and the usual Reddit community dedicated to the elimination of all heretical views. Support? Who needs that, just read the source.

Seriously, I haven't seen any build tools in the past 30 years that have done a great job and that were a joy to use. CMake, Ant, Gradle, make-of-the-month-club, whizzy vendor-locked tools, bespoke in-house constructions, they have all been terrible. I see little hope, entropy has won this one.

Re:Advice to my younger self: become allergic to the churn by hedora on Thursday August 08, 2019 @12:48PM (#20646141)
Common make fail #0

Not starting by reading the manual, and then writing an idiomatic make file.

Once you understand how to use auto generated .d files, you’ll never have a multimillion line make file.

Once you understand the built in lex and yacc rules, you can generalize them to whatever code generator you are using.

The remaining thing (not spelled out in the manual) is to avoid recursive sub make, and to use the include directive instead. “Recursive submake considered harmful” is a helpful paper, but it should have had the subtitle “a practical alternative”, because people cite the title without reading the whole paper.

Re:Advice to my younger self: become allergic to the churn by penagwin on Thursday August 08, 2019 @11:31AM (#20645448)
>I was regularly dealing with bugs in multi-million-line makefiles.

I've personally only used make for a few projects, and might not be "in the know" about how to best use make, but isn't a multi million (!?) line makefile a sign you should probably break it into peices, or use a different solution?

Multi-million just seems insane to me

Re:Advice to my younger self: become allergic to the churn by Gibbon1 on Thursday August 08, 2019 @02:22PM (#20647127)
It sounds like something that was auto generated by a brain dead script at one time. And then later hand modified to 'get things to work' which then meant there eventually was no way to regenerate it from scratch.

Personal feeling is you should have a way of regenerating makefiles.

Re:Advice to my younger self: become allergic to the churn by Crinus on Thursday August 08, 2019 @11:58AM (#20645691)
Sorry i do not understand, is this post a joke? I mean it literally because of the "never happened to me", then the multimillion line makefile doesn't sound real but then you do write something that sounds like someone who has issues with makefiles could say (build order, though common that isn't make's fault - at least as much as isn't a programming language's fault that a program has bugs). So i'm not sure how to take this comment.
Re:Advice to my younger self: become allergic to the churn by kabdib on Thursday August 08, 2019 @01:37PM (#20646631)
The multi-million line makefile is real. I wish it hadn't been. That was a terrible time.

I guess my point is that make doesn't scale, and unavoidably gets messy over time as each project solves the same problems over and over in different, buggy ways.

make solves problems you get early in a project ("let's get this handful of files automatically built") and doesn't even try to address issues of modern software development, like build parallelism and dependency management. Its facilities for debugging problems are laughable.

Re:Advice to my younger self: become allergic to the churn by fao_ on Thursday August 08, 2019 @02:15PM (#20647050)
> make solves problems you get early in a project ("let's get this handful of files automatically built") and doesn't even try to address issues of modern software development, like build parallelism and dependency management. Its facilities for debugging problems are laughable.

Go look up plan9's mk. It's a remake of the program written by the designers a few decades later with everything they learned from it. Not only are the variables idiomatic, and the spaces problem fixed, but you can ask for output at each stage and (IIRC) view the graph that it builds.

Re:Advice to my younger self: become allergic to the churn by deng on Thursday August 08, 2019 @02:21PM (#20647110)
> The multi-million line makefile is real

Of course you quickly get to million-line Makefiles in bigger projects. In C++, if you depend on stuff like Boost, a single file can easily depend on thousands of header files, and every single one must be tracked by Make.

But of course, nobody in his right mind would write these dependencies by hand. At my dayjob, the core Makefile is 700 lines. These 700 lines do cross-compilation with gcc/clang for various platforms, unit testing, valgrind, cppcheck, clang-tidy, coverage, and several other things. It is completely non-recursive, runs in parallel without problems, tracks all dependencies, and also works on Windows.

Of course this stuff is complicated. Make is very low-level compared to a build-generator like CMake. But if you want a bespoke build system for your project which lets you control every last detail of your build, it is still a good choice.

Re:Advice to my younger self: become allergic to the churn by nesadi on Friday August 09, 2019 @07:39AM (#20653358)
Do you know any resources on how to use Make in a sensible/sane way?
Re:Advice to my younger self: become allergic to the churn by lioeters on Thursday August 08, 2019 @06:41PM (#20649619)
As far as rants go, this one was a joy to read. Then I wept for the state of affairs in build tools. I'm not even close to familiar with so many as you've listed, but I never experienced one that didn't eventually turn into a Rube Goldberg contraption (if it didn't already start out that way).

> grown to a recursively gnarly Turing-complete mess

> gronk through many, many lines of make

Thank you for my new word of the day. It describes exactly how I feel sometimes, dealing with technical debt accumulated over years, Frankenstein's systems where parts are always churning - often for no good reason at all, new but worse in most aspects - it can be exhausting gronking through the layers of complexity.

Re:Advice to my younger self: become allergic to the churn by mighty_bander on Thursday August 08, 2019 @12:39PM (#20646058)
Once upon a time, .net code would just build. You had a nice list of project dependencies and references, and you could throw it all into a nice MSI installer that anyone off the street could use without being told how. It would plop debug builds in one directory and release builds in another.

Then Microsoft got rid of it because InstallShield gave them money. Now you need the super-extra-professional edition of Visual Studio to have anything but the most basic installer, and you need to hire a guy to write InstallShield scripts while he's taking a break from contemplating just how tough it would be to get by on pogey alone, and God forbid you need to change anything because the guy is on a different floor because he's not a real developer, etc. etc.

Re:Advice to my younger self: become allergic to the churn by User23 on Thursday August 08, 2019 @01:12PM (#20646369)
> Seriously, I haven't seen any build tools in the past 30 years that have done a great job and that were a joy to use. CMake, Ant, Gradle, make-of-the-month-club, whizzy vendor-locked tools, bespoke in-house constructions, they have all been terrible. I see little hope, entropy has won this one.

Have a look at redo[1].

[1]https://redo.readthedocs.io/en/latest/

Re:Advice to my younger self: become allergic to the churn by marcosdumay on Thursday August 08, 2019 @02:09PM (#20646985)
Well, your make failure #1 is not using make?

Also, #3 is what make excels in. I'm still to see another tool that is more fit to that kind of thing.

At the end of the day, I don't like make. It's for reason #5: there's no project introspection, you can't group tasks into high level values, update your graph on the fly, or add anything to your target except at the source level. I see this one didn't make into your list. This is one of the reasons those multi-million makefiles exist.

I'd rather deal with a small shell script, or a larger Python one if it can't be small. Yet, autotools are great for system programming.

Re:Advice to my younger self: become allergic to the churn by dwheeler on Thursday August 08, 2019 @12:37PM (#20646044)
It's true that you can screw up the use of make in multiple ways, but that is true of any programming system. I find make to be a useful tool.

The most common mistake, by far, is trying to use make recursively (where make calls other makes down a directory hierarchy). That's typically where "builds are too slow" come from, because you end up with a hairball of complex workarounds because no one make invocation actually has the correct dependency data.

I just create a single makefile and treat it like any other program: Add carefully, ensure that the text is clear, etc.

Re:Advice to my younger self: become allergic to the churn by snazz on Thursday August 08, 2019 @11:30AM (#20645445)
It feels like most every build system is either super over engineered or just arcane. I like that Go keeps its build system integrated with the language and that its build system is overall pretty simple and easy to grok.
Re:Advice to my younger self: become allergic to the churn by kabdib on Thursday August 08, 2019 @11:57AM (#20645686)
Go's build system is pragmatic and simple and hasn't let me down yet, but I'm still working on projects at fairly small scale, and the Go build system doesn't do much for other languages, so I didn't mention it.

I think that we're going to see more languages with built-in build systems from early-on in the language's development, but that is a doubled-edged sword (works great for your version of WHIZBOL, doesn't work great if you need to interop with other things).

Re:Advice to my younger self: become allergic to the churn by Crinus on Thursday August 08, 2019 @12:00PM (#20645707)
Make is also very easy to grok though, at its core is just a series of "i want this file, it depends on these files, use these shell commands to produce it".
Re:Advice to my younger self: become allergic to the churn by snazz on Thursday August 08, 2019 @12:02PM (#20645726)
I’ve seen a lot more monstrosities created with Make, but if it’s controlled then yes, it’s not too complex.
Re:Advice to my younger self: become allergic to the churn by rosser on Thursday August 08, 2019 @01:47PM (#20646746)
Honestly, more than anything, this reminds me of the time Uber flounced off PostgreSQL because its performance sucked when used incorrectly.

When you (the general "you", please) use a tool wrong, you can look kinda a fool for blaming the tool.

Re:Advice to my younger self: become allergic to the churn by yellowapple on Thursday August 08, 2019 @02:08PM (#20646979)
Make is the worst build system... except for all the others.
Re:Advice to my younger self: become allergic to the churn by MiroF on Thursday August 08, 2019 @12:09PM (#20645790)
> multi-million-line makefiles

Is this a copypasta?

Re:Advice to my younger self: become allergic to the churn by kabdib on Thursday August 08, 2019 @01:37PM (#20646637)
Nope.