News for hackers. Stuff that matters.
Re:I Like Makefiles by a5c11 on Saturday September 21, 2024 @01:36AM (#41607750)
Or just with a simple command which is guaranteed to be on most Linux systems already - make.

Maybe his Makefiles aren't complex, nor they seem to follow all the best practices invented by code gurus in sandals, but it works and, what's important, it works for him.

Re:I Like Makefiles by weinzierl on Saturday September 21, 2024 @01:59AM (#41607831)
There was a time when people would have said the same about make. The shell is the simple command that is guaranteed to be on all Unix systems from the get go. Make is the new kid on the block.

If you just want to run commands in the order written down, don't need the topological sorting feature of make and value ubiquity then a shell script is the answer.

If you are not stuck in the past and you truly live by the UNIX philosophy of doing one thing and doing it well, a command runner is the answer.

The command runner avoids the ton of foot guns both shell scripts (no matter which flavor) and make files have. just also brings a couple of features out of the box that would be very tedious and error prone that replicate in make and shell scripts.

Re:I Like Makefiles by darby_nine on Saturday September 21, 2024 @02:09AM (#41607870)
Right but writing dependency management (of targets, not package management) in shell seems like a nightmare compared to just leveraging make. Why complicate things? It's dead simple to debug, the interface is dead simple, what's the downside?
Re:I Like Makefiles by boomlinde on Saturday September 21, 2024 @03:48AM (#41608308)
Right, but the original point which started the thread is that "The author is not even using the mtime-based dependency tracking", in which case a plain shell script is very much a viable alternative to make.

I don't particularly mind this use of make, but as an article on make it fails to exemplify what I think is its main purpose.

Re:I Like Makefiles by darby_nine on Saturday September 21, 2024 @11:40AM (#41610664)
I don't think that really matters. Sometimes even basic shell scripts are better modeled with a makefile.
Re:I Like Makefiles by tcfhgj on Saturday September 21, 2024 @03:10AM (#41608117)
In my PS script solution, I just added a clean option+command.

I rewrote my makefile in PS and don't miss anything from make and have no regrets, as it is simpler now.

Re:I Like Makefiles by kristiandupont on Saturday September 21, 2024 @03:44AM (#41608284)
>Make is the new kid on the block.

Make is from 1976. I don't think you can legitimately refer to it as that.

Re:I Like Makefiles by cassianoleal on Saturday September 21, 2024 @04:16AM (#41608432)
The first UNIX was announced outside of Bell Labs in 1973. In 1976, pretty much every tool was “the new kid on the block”.
Re:I Like Makefiles by oblio on Saturday September 21, 2024 @04:39AM (#41608523)
Phew, I was so worried. So for 48 years out of Unix' 53 years of existence (90% of that time), make hasn't been the new kid on the block. Oh, let alone the fact that we're talking about stuff from 48 years ago, when their "screen" was a paper printout of the output.
Re:I Like Makefiles by cassianoleal on Saturday September 21, 2024 @09:11PM (#41613861)
I have no idea what that comment is supposed to mean.
Re:I Like Makefiles by oblio on Monday September 23, 2024 @08:28AM (#41625349)
That your comment was hyper-pedantic.
Re:I Like Makefiles by Ygg2 on Saturday September 21, 2024 @03:53AM (#41608337)
You could around 1976. Who's ever going to need make.
Re:I Like Makefiles by movedx on Saturday September 21, 2024 @03:05AM (#41608093)
I believe you to be correct. I think it's important that one uses the right tool for the job, regardless of whether or not it's widely adopted or supported.
Re:I Like Makefiles by oblio on Saturday September 21, 2024 @04:46AM (#41608555)
Who develops just? Will it be around in 5 years? Will it be ad supported? Will the developer sell my data? Etc.

I don't have any of those concerns with GNU Make.

Re:I Like Makefiles by kaba0 on Saturday September 21, 2024 @03:58PM (#41612293)
Software with small scopes can be finished. It doesn’t sound too complicated to just push a new bug fix each year, by anyone. If anything, make is probably a significantly more complex codebase due to all the hacks it accumulated over the years, as a result of a dumb model it started with.
Re:I Like Makefiles by oblio on Monday September 23, 2024 @10:19AM (#41626423)
https://just.systems/man/en/introduction.html

Just has quite a few features and it's at version 1.35.

Re:I Like Makefiles by jjav on Saturday September 21, 2024 @05:20AM (#41608691)
> There was a time when people would have said the same about make. The shell is the simple command that is guaranteed to be on all Unix systems from the get go.

That would've been a pretty short window of time since make first came out (according to wikipedia) in 1976.

Re:I Like Makefiles by bregma on Saturday September 21, 2024 @06:56AM (#41609138)
> There was a time when people would have said the same about make. The shell is the simple command that is guaranteed to be on all Unix systems from the get go. Make is the new kid on the block.

I seem to recall it being praised very highly at the time as a great tool that saved many billable expensive CPU minutes and made a developer's job so much easier.

Re:I Like Makefiles by hulitu on Saturday September 21, 2024 @01:57AM (#41607822)
> but it works

That it what a lot of SW developers forget: your code might be the best in the world, but , if someone is not able to build it, it is useless.

Re:I Like Makefiles by wruza on Saturday September 21, 2024 @05:10AM (#41608654)
I remember countless times me and forum fellas debugging makefiles written under developers’ assumptions about systems. That is also what lots of developers forget or simply aren’t aware of.

Make isn’t a silver bullet for builds. It isn’t even a bullet. Most software gets built from scratch and make’s deps graph makes little to zero sense in this mode. Make is a quirky poor dev tool footgun, jack of all trades master of none.

Re:I Like Makefiles by kaba0 on Saturday September 21, 2024 @04:03PM (#41612333)
Make leaves the actual hard problem behind — setting up the environment correctly. A README file is much more useful.
Re:I Like Makefiles by ReleaseCandidat on Saturday September 21, 2024 @02:09AM (#41607866)
> it works and, what's important, it works for him.

Until it doesn't. And then you really have to learn about PHONY targets, why and when there must be a tab and not spaces - good luck with an editor that doesn't treat Makefiles special and is configured to convert tabs to spaces.

Re:I Like Makefiles by dented42 on Saturday September 21, 2024 @02:20AM (#41607903)
But those are things that he’ll learn about as he keeps using make. And why does it matter that some editors don’t know about makefiles? The one he is using handles them just fine so what’s the problem?
Re:I Like Makefiles by ReleaseCandidat on Saturday September 21, 2024 @02:41AM (#41607980)
> And why does it matter that some editors don’t know about makefiles?

Because it isn't fun checking if the whitespace at the beginning of the line is a tab or spaces. And as said, you must know when to use tabs and/or spaces in rules.

For doing such a simple thing as calling some commands, Make has way too many subtle footguns which _will_ bite somebody, someday. The problem (that's not a problém at all, that's a reason to celebrate!) is that most JS devs and users aren't used to Make, compared to e.g. C programmers. To rephrase: as someone writing C, you have to use something like a Makefile, as anything else (like scripts) gets unreadable and -usable quite fast. But if you can get away with a less complex solution, you should really use that instead of Make.

Re:I Like Makefiles by instig007 on Saturday September 21, 2024 @03:24AM (#41608188)
> Because it isn't fun checking if the whitespace at the beginning of the line is a tab or spaces. And as said, you must know when to use tabs and/or spaces in rules.

that's why https://editorconfig.org/ exists, so that neither you nor your teammates have to think about these things

Re:I Like Makefiles by ReleaseCandidat on Saturday September 21, 2024 @04:33AM (#41608498)
> neither you nor your teammates have to think about these things

You're better off using a Makefile linter. But you must know about the problem before being able to solve it. And error messages like

   Makefile:2: *** missing separator.  Stop.
aren't the most helpful.
Re:I Like Makefiles by oblio on Saturday September 21, 2024 @04:44AM (#41608549)
You'll find the issue within 2 minutes of googling the error message.
Re:I Like Makefiles by wruza on Saturday September 21, 2024 @05:21AM (#41608698)
And as said, you must know when to use tabs and/or spaces in rules

Is that Stockholm syndrome? Or an appeal to history/authority in action? What makes people believe that this is even remotely reasonable.

inb kids these days, I started in the '90s and wrote my share of makefiles. Tolerating make only made sense until 2010-ish, then both hw and sw advances rendered it useless.

Edit: just realized my reply to a wrong person, but let it stay here

Re:I Like Makefiles by dented42 on Saturday September 21, 2024 @03:06PM (#41611949)
I genuinely don’t understand why that matters. The fact that there exists bad editors that don’t support my workflow shouldn’t prevent me from using the tools that I like and am comfortable with. I use editors that don’t screw up makefiles so what’s the problem? If I take your argument to the absolutely absurd logical extreme, I shouldn’t use lower case letters because some character encodings don’t support them.
Re:I Like Makefiles by scrame on Saturday September 21, 2024 @05:14AM (#41608667)
Because forcing devs to use tools for one specific format makes a bunch of unhappy devs. Especially if its just forcing them to use make.
Re:I Like Makefiles by unscaled on Saturday September 21, 2024 @05:41AM (#41608786)
Or just use a simple command which ALL Unix system have: sh.

If you're using make a glorified task runner, why don't you just create a scripts/ directory with shell scripts to do whatever you want. This is simpler, cleaner and works everywhere.

Make doesn't really add anything. I get the feeling that using make this way is an aesthetic preference that has somehow developed with time into a "this is the one true Unix way" cargo cult.

Re:I Like Makefiles by deepsun on Saturday September 21, 2024 @10:02AM (#41610042)
bin/ directory.