xref: /src/libexec/flua/Makefile (revision b41b6fdb3a1635de4c2a9280aab12b83e3aeffc5)
1506f3640SKyle Evans.include <src.lua.mk>
2506f3640SKyle Evans
3957715f8SLexi WinterPACKAGE=	flua
4957715f8SLexi Winter
5151bd351SKyle Evans# New flua modules should be added here rather than to SUBDIR so that we can do
6151bd351SKyle Evans# the right thing for both bootstrap flua and target flua.  The former does not
7151bd351SKyle Evans# do any shared libs, so we just build them all straight into flua itself rather
8151bd351SKyle Evans# than mucking about with the infrastructure to make them linkable -- thus, why
9151bd351SKyle Evans# these are all structured to have a Makefile that describes what we want
10151bd351SKyle Evans# *installed*, and a Makefile.inc that describes what we need to *build*.
11b11a5709SKyle EvansFLUA_MODULES+=	lfbsd
12b11a5709SKyle EvansFLUA_MODULES+=	lfs
13151bd351SKyle EvansFLUA_MODULES+=	libhash
14151bd351SKyle Evans.ifndef BOOTSTRAPPING
15151bd351SKyle Evans# Bootstrap flua can't usefully do anything with libjail anyways, because it
16151bd351SKyle Evans# can't assume it's being run on a system that even supports jails.
17151bd351SKyle EvansFLUA_MODULES+=	libjail
18151bd351SKyle Evans.endif
19151bd351SKyle EvansFLUA_MODULES+=	libucl
20151bd351SKyle EvansFLUA_MODULES+=	liblyaml
21151bd351SKyle Evans
22151bd351SKyle Evans.ifdef BOOTSTRAPPING
23151bd351SKyle Evans# libfreebsd is generally omitted from the bootstrap flua because its
24151bd351SKyle Evans# functionality largely assumes a FreeBSD kernel/system headers, so it doesn't
25151bd351SKyle Evans# really offer functionality that we can use in bootstrap.
26151bd351SKyle EvansCFLAGS+=	-I${.CURDIR} -DBOOTSTRAPPING
27151bd351SKyle Evans
28151bd351SKyle EvansSHAREDIR=	${WORLDTMP}/legacy/usr/share/flua
29151bd351SKyle EvansFLUA_PATH=	${SHAREDIR}/?.lua;${SHAREDIR}/?/init.lua
30151bd351SKyle EvansCFLAGS+=	-DBOOTSTRAP_FLUA_PATH=\"${FLUA_PATH:Q}\"
31151bd351SKyle Evans
32151bd351SKyle Evans.for mod in ${FLUA_MODULES}
33151bd351SKyle Evans.include "${mod}/Makefile.inc"
34151bd351SKyle Evans.endfor
35151bd351SKyle Evans
36151bd351SKyle Evans.else
37151bd351SKyle Evans
38151bd351SKyle EvansFLUA_MODULES+=	libfreebsd
39151bd351SKyle EvansSUBDIR+=	${FLUA_MODULES}
40151bd351SKyle Evans
41151bd351SKyle Evans.endif
427899f917SBaptiste Daroussin
43506f3640SKyle EvansLUASRC?=	${SRCTOP}/contrib/lua/src
44506f3640SKyle Evans.PATH: ${LUASRC}
45506f3640SKyle Evans
46506f3640SKyle EvansPROG=	flua
47506f3640SKyle Evans
48061f7e2fSKyle EvansCWARNFLAGS.gcc+=	-Wno-format-nonliteral
49061f7e2fSKyle Evans
50151bd351SKyle EvansLIBADD+=	lua
51506f3640SKyle Evans
52506f3640SKyle Evans# Entry point
53506f3640SKyle EvansSRCS+=	lua.c
54506f3640SKyle Evans
55506f3640SKyle Evans# FreeBSD Extensions
56506f3640SKyle Evans.PATH: ${.CURDIR}/modules
57506f3640SKyle EvansSRCS+=	linit_flua.c
589c7db093SKyle EvansSRCS+=	lposix.c
59506f3640SKyle Evans
60564b9ff2SBrooks DavisCFLAGS+=	-I${SRCTOP}/lib/liblua -I${.CURDIR}/modules -I${LUASRC}
61506f3640SKyle EvansCFLAGS+=	-DLUA_PROGNAME="\"${PROG}\""
62506f3640SKyle Evans
6328d832f9SKyle Evans# readline bits; these aren't needed if we're building a bootstrap flua, as we
6428d832f9SKyle Evans# don't expect that one to see any REPL usage.
6528d832f9SKyle Evans.if !defined(BOOTSTRAPPING)
66b4a19ee2SKyle EvansCFLAGS+=	-DLUA_USE_READLINE
67b4a19ee2SKyle EvansCFLAGS+=	-I${SRCTOP}/lib/libedit -I${SRCTOP}/contrib/libedit
68b4a19ee2SKyle EvansLIBADD+=	edit
69c2a2b4f3SKyle EvansLDFLAGS+=	-Wl,-E
7028d832f9SKyle Evans.endif
71b4a19ee2SKyle Evans
72506f3640SKyle Evans.include <bsd.prog.mk>
73