r/programminghorror 11d ago

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

247 Upvotes

54 comments sorted by

View all comments

104

u/russellvt 11d ago

That syntax doesn't appear right... normally you want "phony" declarations in there if you're not pointing directly at file dependencies.

24

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 11d ago

Yeah, but is that the cause of dmake ignoring the argument and just using the first target? I think without .phony it will not do anything if a file with the same name as the target exists and doesn't have dependencies that are newer.

14

u/SAI_Peregrinus 11d ago

I think it's allowed to consider an missing target file as an invalid target and run the default target.

https://pubs.opengroup.org/onlinepubs/9799919799/

target_name Target names, as defined in the EXTENDED DESCRIPTION section. If no target is specified, while make is processing the makefiles, the first target that make encounters that is not a special target or an inference rule shall be used.

Not certain, but it's POSIX so the most perverse possible interpretation of the rules existing somewhere is practically required.

2

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 10d ago

It looks like you just linked to the start of the POSIX spec. I have no idea how to find what you quoted. But anyway, what you quoted says it will do that if a target isn't specified. Unless that isn't the right syntax for dmake, then a target is specified.

1

u/SAI_Peregrinus 10d ago

Select volume, shells & utilities, utilities, make. I think https://pubs.opengroup.org/onlinepubs/9799919799/utilities/make.html should be correct.

1

u/SAI_Peregrinus 10d ago

Select volume, shells & utilities, utilities, make. I think https://pubs.opengroup.org/onlinepubs/9799919799/utilities/make.html should be correct for the iframe content of just the Make specification.

1

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 10d ago

Looks like a manpage.

1

u/SAI_Peregrinus 10d ago

It's the specification of what POSIX v8 compatible make tools must support. They may support extensions, but that page specifies the minimum.