xref: /freebsd/libexec/flua/Makefile (revision 981cf36d64c48ebfa22d44ac83b6d448c2974f23)
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
12FLUA_MODULES+=	libjail
13FLUA_MODULES+=	libucl
14FLUA_MODULES+=	liblyaml
15FLUA_MODULES+=	lposix
16
17.ifdef BOOTSTRAPPING
18FLUA_MODULES+=	libfreebsd/sys/linker
19FLUA_MODULES+=	libfreebsd/kenv
20CFLAGS+=	-I${.CURDIR} -DBOOTSTRAPPING
21
22SHAREDIR=	${WORLDTMP}/legacy/usr/share/flua
23FLUA_PATH=	${SHAREDIR}/?.lua;${SHAREDIR}/?/init.lua
24CFLAGS+=	-DBOOTSTRAP_FLUA_PATH=\"${FLUA_PATH:Q}\"
25
26.for mod in ${FLUA_MODULES}
27.include "${mod}/Makefile.inc"
28.endfor
29
30.else
31
32FLUA_MODULES+=	libfreebsd
33SUBDIR+=	${FLUA_MODULES}
34
35.endif
36
37LUASRC?=	${SRCTOP}/contrib/lua/src
38.PATH: ${LUASRC}
39
40PROG=	flua
41WARNS?=	3
42
43CWARNFLAGS.gcc+=	-Wno-format-nonliteral
44
45LIBADD+=	lua
46
47# Entry point
48SRCS+=	lua.c
49
50# FreeBSD Extensions
51.PATH: ${.CURDIR}/modules
52SRCS+=	linit_flua.c
53
54CFLAGS+=	-I${SRCTOP}/lib/liblua -I${.CURDIR}/modules -I${LUASRC}
55CFLAGS+=	-DLUA_PROGNAME="\"${PROG}\""
56
57# readline bits; these aren't needed if we're building a bootstrap flua, as we
58# don't expect that one to see any REPL usage.
59.if !defined(BOOTSTRAPPING)
60CFLAGS+=	-DLUA_USE_READLINE
61CFLAGS+=	-I${SRCTOP}/lib/libedit -I${SRCTOP}/contrib/libedit
62LIBADD+=	edit
63LDFLAGS+=	-Wl,-E
64.endif
65
66.include <bsd.prog.mk>
67