r/programminghorror • • Jul 26 '26

Other Same Makefile, different results

Post image

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

251 Upvotes

54 comments sorted by

View all comments

Show parent comment

1

u/russellvt Jul 30 '26

What happens with "no" args, though? What happens if "a" or "b" exist? There are multiple scenarios, which some versions of make or gmake may allow... but ultimately, it's a bit ambiguous as far as I see - but I will have to come back in front of a larger screen to give better examples, later (ie. My phone wont cut it right now).

2

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo "You live" Jul 30 '26

Well, the normal behavior would be If the file exists and it has no dependencies, or all the dependencies are up to date, the target is considered up to date and nothing happens. That is of course what .PHONY solves.

Not passing args to Make is extremely common. I did look that one up, it runs the first non-special target.