Here is a Makefile for Lua 5.3 that detects the platform using name .
Place it in src/ and do "make clean guess" to try it.
I've tested it in Linux and macOS but I don't have access to other
platforms. Perhaps some of you do. In particular, I don't know whether
FreeBSD, NetBSD, OpenBSD are all the same.
All contributions welcome. Thanks.