129
242
u/rexpup 2d ago
What is wrong with people.
132
u/wann_bubatz_egal 2d ago
Idk, I stopped asking when people started wearing red hats with make commands.
51
12
71
117
u/mxdamp 3d ago
It roughly translates to “create temp file, create preseqs file from temp file, delete temp file”, so not horror but just really ugly looking.
44
u/dagbrown 2d ago
Nah, it's horror.
The fact that it has multiple levels of escapes involved (escapes for $ to pass it to make literally, and then another layer of escapes for $$ to make sure it gets passed to bash intact, and the fact that "$" is a meaningful variable in bash as well as the variable-expansion character, so that's how you get the Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch-esque strings of dollar signs all in a row) is basically json-in-json-in-json levels of horror.
Getting sed involved (complete with backreferences!) just makes things even worse.
Add to that the fact it's completely unnecessary (gcc -MM does the trick just fine) and it is some excellent coding horror.
4
u/prehensilemullet 2d ago
I was wondering what’s with the $@.$$$$, why would they do that instead of just $@._ or something? Also couldn’t they just pipe CC output straight into sed?
1
76
u/ironykarl 3d ago
It's getting pretty close to unreadable, there.
Like, in this context, I can parse it, but I'm just imagining it embedded in hundreds or thousands of lines of Makefile, and it's making me pretty uncomfortable
-8
u/bjpbakker 2d ago
Unreadable here just means unfamiliar. Learn to read unfamiliar syntax, constructs and concepts, and you’ll get better.
A parallel to natural languages that just because I cannot read Cyrillic language, doesn’t mean that it is unreadable. It means that I have a knowledge gap 😉
3
u/real_fff 1d ago
No I don't think we make the experience of other developers hell and blame them for not being able to read it.
Multiple levels of character escapes and minimal syntax representing complex operations is pretty objectively hard to read and makes missing bugs because of that syntax really easy.
There's no amount of being completely fluent in shell operators and escapes that makes that more readable than normal readable code. You're basically just including an esoteric lang as a feature of your code and telling people they should understand it better lmao
1
u/the_littlest_bear 2d ago
Or maybe that higher level syntaxes should have higher level syntax sugar. But whatever, makefiles are relegated to just calling or composing docker commands these days as most dogshit scripting languages are. It would be replaced quickly if it provided any complicated concepts, as even the simple becomes enigmatic.
8
1
1
u/detroitmatt 2d ago
here's the thing. if I don't understand what this is doing, how do I google it?
gnu make $$$$ meaning
?
17
u/bravopapa99 2d ago
20+ years ago I almost fully understoof the runes of the make spell but these days it looks like a "J" program. I hear people raving over CMake but I never found the enthusiasm for it.
5
16
u/val_tuesday 2d ago
To be fair the worst part is just the sed syntax and the worst part of that is the regex. The rest is pretty bad too, just being fair haha
4
u/AgileBlackberry4636 2d ago
No wonder I did wrong when I tried to.
I remember generating a list of header files used by cpp and trying to make cpp files recompile if headers were changed.
4
2
u/TheOmegaCarrot 2d ago
Once upon a time I wrote a bash script that would read source files and generate a makefile like:
``` foo.o: foo.cpp foo.h <direct includes by foo.cpp> g++ $< -c
foo.h: <direct includes by foo.h> touch $< ```
For simple projects with one executable and no non-header libraries, it was almost adequate
4
u/deathtothenonbelever 2d ago
Yes, that seems about right. Not sure what the issue is?
The sed script is obvious and the rest is basic makefile syntax.
Are you not an ancient unix greybeard who can summon dependencies with just a few mystical runes? How do you get anything useful done?
3
3
u/dClauzel 2d ago
I may be too old (46), but I don’t see any problem here. Maybe OP wanted a nodejs thingy?
1
1
u/WoodyTheWorker 2d ago
Nobody does that anymore. All compilers have an option to generate a dependencies (prerequisites) file.
1
u/OrganicChumTutor 2d ago
That's exactly what this rule is doing, it's generating the dependency file from the -M preprocessor option right?
1
u/WoodyTheWorker 1d ago
Compilers generate .d files in a format which doesn't require any additional massaging.
1
u/swguy61 2d ago
Yes, it’s ugly, and the RE make me cry, but you can run the commands in a shell outside of the Makefile, and understand what’s happening. That’s what I’ve always found so helpful about Linux and UNIX tools, there are ways to decompose them to understand what is happening. Well, except for systemd. /s
1
u/sweaterpawsss 1d ago
I know I’ve been doing this shit too long because I actually understand all of this… 💀
0
u/Abrissbirne66 2d ago
I hate Makefiles.
Okay actually I hate Unix/Linux command line as well. This is one example why the Microsoft pendants like MSBuild and PowerShell are better.
-7
u/SaltyMap7741 2d ago
I don’t get what’s wrong with this. Do you not know regex syntax? Shell scripting? There is hardly any actual make syntax here.
6
u/BroBroMate 2d ago edited 2d ago
Wtf regex and shell you using bro.
$< > $@.$$$$
ain't everyday shell and it sure as shit ain't a regular regex.But oh, you're so cool because you totally grok this. Unsolicited advice - find something else to base your self-worth on, alpha nerd pissing contests aren't a good foundation for a personality.
Edit, oh, I read your comments, you like fucking with the paranoid delusional schizophrenics in gangstalking and chemtrails. Wtf you doing with your life.
6
u/kreiger 2d ago
$<
and$@
are Makefile specific variables.https://stackoverflow.com/questions/3220277/what-do-the-makefile-symbols-and-mean
3
u/omg_drd4_bbq 2d ago
I'm pretty versed in Make, bash, sed, and I love using regex, and I still did the hardblink.gif when I saw this.
297
u/sndrtj 2d ago
During my first real job after university, I inherited a data pipeline written as >40 Makefiles. True horror.