xref: /freebsd/share/mk/src.lua.mk (revision af23369a6deaaeb612ab266eb88b8bb8d560c322)
1# $FreeBSD$
2#
3# Lua helper file for FreeBSD /usr/src builds.
4#
5# This file provides any necessary assistance for consumers of Lua in the base
6# system.
7
8.if !target(__<src.lua.mk>__)
9__<src.lua.mk>__:
10
11.include <bsd.own.mk>
12
13#
14# LUA_INSTALL_PATH and LUA_CMD describe where the internal lua has been
15# installed to, along with the name of the internal command.  The default
16# name is flua.
17#
18# LUA_CMD can be overwritten to point to a Lua that isn't flua.  This is fine,
19# but parts of the src build that use it may have certain expectations that
20# may only be fulfilled by the in-tree Lua.  The user overwriting it is expected
21# to understand these and provide the expectations.
22#
23# flua is currently equivalent to Lua 5.3, with the following modules:
24# - luafilesystem
25# - lua-posix
26#
27LUA_INSTALL_PATH?=	${LIBEXECDIR}
28LUA_CMD?=		flua
29
30#
31# Some standalone usage may want a variable that tries to find the lua command,
32# and cannot necessarily embed the logic for trying to find it amongst bootstrap
33# tools.  For these, we provide the LUA variable.
34#
35# The LUA variable should point to LUA_CMD on the system, if it exists.
36# Otherwise, consumers will have to settle for a PATH search and PATH being
37# appropriately set.
38#
39.if !defined(LUA) && exists(${LUA_INSTALL_PATH}/${LUA_CMD})
40LUA=	${LUA_INSTALL_PATH}/${LUA_CMD}
41.else
42LUA?=	${LUA_CMD}
43.endif
44
45.endif #  !target(__<src.lua.mk>__)
46