[dev] Special target ".POSIX" in Makefiles
Hi, I'm wondering why the Makefiles of some suckless programs (and libs) have the special target `.POSIX` in them and some don't. For example, dwm doesn't have it in it's Makefile but there isn't a single non-POSIX feature used. I think it would be better to include the `.POSIX` target simply to follow the standard and guarantee portability. If there is a good reason why it isn't included, please let me know. -- craekz
Re: [dev] Special target ".POSIX" in Makefiles
>I agree that it shall be added to all Makefile, because >otherwise the behavior of make is unspecified. >(Quote from the POSIX specifications) I'm sure you meant it like that, but just to clarify it: It is only unspecified if it doesn't appear as the first non-comment line, has prerequisites or commands. >.POSIX can be used as long a the makefile does not >use any feature that conflicts with POSIX. But I think >it would mislead people into thinking the non-POSIX >features are POSIX feature, so it would be best skip >it in that case. I agree with that. As far as I can see, we could add `.POSIX` to the following programs: dwm, dmenu, dwmstatus, sent and tabbed I've just looked over the Makefiles very briefly, so I may have overseen something. Note: I just picked out the "biggest" programs. >I do however think some Makefile here that use the @ >macro in the prerequisite. This is not a POSIX feature, >is seldom needed, and should be removed assuming it >is redundant given the inferred prerequisite of >inference rules. sbase does it but I haven't looked closer. -- craekz
Re: [dev] Special target ".POSIX" in Makefiles
> Yeah you make a strong argument. I too think a linting tool would be > useful. I imagine it would function like shellcheck does for shells. If > nothing else it would really help people identify GNU extensions vs > portable behavior. Something like shellcheck would be awesome! Given that the POSIX Makefile syntax isn't very large or complicated, the implementation of such a tool could be pretty simple (in the manner of suckless). Although I wouldn't mind a strict POSIX compliant make(1) without any extensions. There a far too few programs that could be used to verify compliance with standards (and buying a test suite isn't a great solution). -- craekz