4 ms·
Do you have a good guide for writing portable makefiles? I’m always using GNU make so I don’t notice it with mine but I always feel a little bad.
by swiley 7y ago
Do you have a good guide for writing portable makefiles? I’m always using GNU make so I don’t notice it with mine but I always feel a little bad.
- sirn 7y agoI don't think there's a guide, the only resource I'm aware of is The Open Group Base Specifications[1] which can be reference when in doubt. Almost other times I just install bmake alongside with gmake and try to get it work with both (it's still not perfectly conform to POSIX, since GNU supports some of BSD's make feature, and vice versa). [1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/m...
- gumby 7y agoI'm a big fan of "be strictly conformant" (e.g. use no C++ extensions) for maximum portability but I always install Bash and GNU Make. The extra power is worth it.
- nipav 7y agoThe best way is reading the spec: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/m... But to get you started Chris Wellons does have a pretty nice blog post about writing POSIX Makefiles: https://nullprogram.com/blog/2017/08/20/ https://nullprogram.com/blog/2017/08/20/
- asveikau 7y agoI use the *BSDs a lot and it's pretty common to install gmake from ports. I wouldn't feel bad.
- kazinator 7y agoThe POSIX standard? https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/m... If you don't use anything that is not there, or in a manner not covered by a requirement, you will likely have a highly portable result.
- pmarin 7y agoThere is a very good tutorial by Chris Wellons https://nullprogram.com/blog/2017/08/20/ https://nullprogram.com/blog/2017/08/20/