xref: /freebsd/libexec/flua/Makefile (revision 957715f877b57a17545ead94d27ea8fd3ff4932a)
1.include <src.lua.mk>
2
3PACKAGE=	flua
4
5# New flua modules should be added here rather than to SUBDIR so that we can do
6# the right thing for both bootstrap flua and target flua.  The former does not
7# do any shared libs, so we just build them all straight into flua itself rather
8# than mucking about with the infrastructure to make them linkable -- thus, why
9# these are all structured to have a Makefile that describes what we want
10# *installed*, and a Makefile.inc that describes what we need to *build*.
11FLUA_MODULES+=	lfbsd
12FLUA_MODULES+=	lfs
13FLUA_MODULES+=	libhash
14.ifndef BOOTSTRAPPING
15# Bootstrap flua can't usefully do anything with libjail anyways, because it
16# can't assume it's being run on a system that even supports jails.
17FLUA_MODULES+=	libjail
18.endif
19FLUA_MODULES+=	libucl
20FLUA_MODULES+=	liblyaml
21
22.ifdef BOOTSTRAPPING
23# libfreebsd is generally omitted from the bootstrap flua because its
24# functionality largely assumes a FreeBSD kernel/system headers, so it doesn't
25# really offer functionality that we can use in bootstrap.
26CFLAGS+=	-I${.CURDIR} -DBOOTSTRAPPING
27
28SHAREDIR=	${WORLDTMP}/legacy/usr/share/flua
29FLUA_PATH=	${SHAREDIR}/?.lua;${SHAREDIR}/?/init.lua
30CFLAGS+=	-DBOOTSTRAP_FLUA_PATH=\"${FLUA_PATH:Q}\"
31
32.for mod in ${FLUA_MODULES}
33.include "${mod}/Makefile.inc"
34.endfor
35
36.else
37
38FLUA_MODULES+=	libfreebsd
39SUBDIR+=	${FLUA_MODULES}
40
41.endif
42
43LUASRC?=	${SRCTOP}/contrib/lua/src
44.PATH: ${LUASRC}
45
46PROG=	flua
47WARNS?=	3
48
49CWARNFLAGS.gcc+=	-Wno-format-nonliteral
50
51LIBADD+=	lua
52
53# Entry point
54SRCS+=	lua.c
55
56# FreeBSD Extensions
57.PATH: ${.CURDIR}/modules
58SRCS+=	linit_flua.c
59SRCS+=	lposix.c
60
61CFLAGS+=	-I${SRCTOP}/lib/liblua -I${.CURDIR}/modules -I${LUASRC}
62CFLAGS+=	-DLUA_PROGNAME="\"${PROG}\""
63
64# readline bits; these aren't needed if we're building a bootstrap flua, as we
65# don't expect that one to see any REPL usage.
66.if !defined(BOOTSTRAPPING)
67CFLAGS+=	-DLUA_USE_READLINE
68CFLAGS+=	-I${SRCTOP}/lib/libedit -I${SRCTOP}/contrib/libedit
69LIBADD+=	edit
70LDFLAGS+=	-Wl,-E
71.endif
72
73.include <bsd.prog.mk>
74