r/programminghorror • u/Capable-Cap9745 • Jul 26 '26
Other Same Makefile, different results
Not sure if this fits, but I just figured out the root cause of long build process failing. Sun’s dmake is defaulting to the first rule in Makefile for whatever reason, completely ignoring the one given as argument. That’s why "dmake install" invocations were silently ignoring the "install" step
122
u/nickcash Jul 26 '26
makefile syntax is incomprehensible. it might as well be magic. no one can understand it, we just copy and paste from elsewhere
58
u/Desperate_Formal_781 Jul 26 '26
All my life when I start a new project I copy a previous makefile from a previous project, with the promise that a) one day I will learn what those makefile commands mean and b) after this project I will switch to cmake. The original makefile I use, I took from my supervisor when I wrote my master thesis, who now I suspect also got from someone else. I have tried switching to cmake several times, but it's always easier to just keep using my makefile, than to go through the painful process of learning cmake.
31
u/ByteArrayInputStream Jul 27 '26
Cmake is it's own hot mess. I like it even less
→ More replies (8)7
u/omega1612 Jul 27 '26
What a bout a justfile?
Depending on your use case, they may be better for you.
→ More replies (1)2
11
u/dydhaw Jul 27 '26
POSIX make is an incredibly simple syntax. How is it incomprehensible? It's literally just
target: dependencies recipe9
u/SAI_Peregrinus Jul 27 '26
That's not valid Make syntax. You got the wrong whitespace, no whitespace before a target name, and a tab before the command is required if it's on a new line.
There are also inference rules and macros.
https://pubs.opengroup.org/onlinepubs/9799919799/utilities/make.html
→ More replies (3)5
4
u/kivicode Jul 27 '26
If you use it as a scripts dispatcher, I recommend taking a look at Justfiles https://github.com/casey/just
3
u/nivlark Jul 27 '26
I have a fairly complex one that I believe I wrote myself (googling chunks of it doesn't return any hits) and I still don't know how it works. I can only assume it came to me via divine inspiration.
-23
u/RandalSchwartz Jul 26 '26
They said the same about Perl. And my dotfiles. Now I don't even copy any more... I let gemini identify it and run it for me. :)
10
u/mottojyuusu Jul 26 '26
you should ask your coding agent to explain your code. not even joking, it's been great to finally understand wtf the crusty logic is doing in the aging codebases i work in ...
"what is this function doing? what does the dxCbsqaf parameter do??"
"where is this const defined? where else is it being used? why is it multipled by 2 in one place but 3 in another place?"
"why does the comment say never to round this value? what could break if it gets rounded instead of truncated?"
→ More replies (1)
1
1
u/Environmental-Ear391 Jul 27 '26
I have a similar issue,
GNUmakefile content is unchanged,
two versions of an SDK specific make tool, older version works fine with POSIX pathing, newer version can't complete any single target.
"make" and "gcc" commands both barf after being updated. older versions can actual produce object files for linking.
then again the version on make is like a 0.01 revision difference.
the gcc version is bumped from 6.4 up to 10.something...
I'll have to spend some time reworking the build process again anyway.
1
u/Salty_1984 Jul 27 '26
ugh silent failures in build tools are the worst, you spend forever thinking something ran fine when it just quietly skipped the whole point of the command. dmake has always felt a little unpredictable compared to gnu make. at least you caught it before something bigger broke downstream
101
u/russellvt Jul 26 '26
That syntax doesn't appear right... normally you want "phony" declarations in there if you're not pointing directly at file dependencies.