xref: /freebsd/libexec/flua/Makefile (revision 9c7db0931d486ce800aa71d9f41abfad9f7f691f)
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
19
20.ifdef BOOTSTRAPPING
21# libfreebsd is generally omitted from the bootstrap flua because its
22# functionality largely assumes a FreeBSD kernel/system headers, so it doesn't
23# really offer functionality that we can use in bootstrap.
24CFLAGS+=	-I${.CURDIR} -DBOOTSTRAPPING
25
26SHAREDIR=	${WORLDTMP}/legacy/usr/share/flua
27FLUA_PATH=	${SHAREDIR}/?.lua;${SHAREDIR}/?/init.lua
28CFLAGS+=	-DBOOTSTRAP_FLUA_PATH=\"${FLUA_PATH:Q}\"
29
30.for mod in ${FLUA_MODULES}
31.include "${mod}/Makefile.inc"
32.endfor
33
34.else
35
36FLUA_MODULES+=	libfreebsd
37SUBDIR+=	${FLUA_MODULES}
38
39.endif
40
41LUASRC?=	${SRCTOP}/contrib/lua/src
42.PATH: ${LUASRC}
43
44PROG=	flua
45WARNS?=	3
46
47CWARNFLAGS.gcc+=	-Wno-format-nonliteral
48
49LIBADD+=	lua
50
51# Entry point
52SRCS+=	lua.c
53
54# FreeBSD Extensions
55.PATH: ${.CURDIR}/modules
56SRCS+=	linit_flua.c
57SRCS+=	lposix.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