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