aboutsummaryrefslogtreecommitdiff
path: root/libexec/flua/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'libexec/flua/Makefile')
-rw-r--r--libexec/flua/Makefile48
1 files changed, 41 insertions, 7 deletions
diff --git a/libexec/flua/Makefile b/libexec/flua/Makefile
index 86d27c0653d4..f1c46b270ded 100644
--- a/libexec/flua/Makefile
+++ b/libexec/flua/Makefile
@@ -1,10 +1,44 @@
.include <src.lua.mk>
-SUBDIR+= libfreebsd
-SUBDIR+= libhash
-SUBDIR+= libjail
-SUBDIR+= libucl
-SUBDIR+= liblyaml
+PACKAGE= flua
+
+# New flua modules should be added here rather than to SUBDIR so that we can do
+# the right thing for both bootstrap flua and target flua. The former does not
+# do any shared libs, so we just build them all straight into flua itself rather
+# than mucking about with the infrastructure to make them linkable -- thus, why
+# these are all structured to have a Makefile that describes what we want
+# *installed*, and a Makefile.inc that describes what we need to *build*.
+FLUA_MODULES+= lfbsd
+FLUA_MODULES+= lfs
+FLUA_MODULES+= libhash
+.ifndef BOOTSTRAPPING
+# Bootstrap flua can't usefully do anything with libjail anyways, because it
+# can't assume it's being run on a system that even supports jails.
+FLUA_MODULES+= libjail
+.endif
+FLUA_MODULES+= libucl
+FLUA_MODULES+= liblyaml
+
+.ifdef BOOTSTRAPPING
+# libfreebsd is generally omitted from the bootstrap flua because its
+# functionality largely assumes a FreeBSD kernel/system headers, so it doesn't
+# really offer functionality that we can use in bootstrap.
+CFLAGS+= -I${.CURDIR} -DBOOTSTRAPPING
+
+SHAREDIR= ${WORLDTMP}/legacy/usr/share/flua
+FLUA_PATH= ${SHAREDIR}/?.lua;${SHAREDIR}/?/init.lua
+CFLAGS+= -DBOOTSTRAP_FLUA_PATH=\"${FLUA_PATH:Q}\"
+
+.for mod in ${FLUA_MODULES}
+.include "${mod}/Makefile.inc"
+.endfor
+
+.else
+
+FLUA_MODULES+= libfreebsd
+SUBDIR+= ${FLUA_MODULES}
+
+.endif
LUASRC?= ${SRCTOP}/contrib/lua/src
.PATH: ${LUASRC}
@@ -14,7 +48,7 @@ WARNS?= 3
CWARNFLAGS.gcc+= -Wno-format-nonliteral
-LIBADD= lua
+LIBADD+= lua
# Entry point
SRCS+= lua.c
@@ -22,7 +56,7 @@ SRCS+= lua.c
# FreeBSD Extensions
.PATH: ${.CURDIR}/modules
SRCS+= linit_flua.c
-SRCS+= lfs.c lposix.c lfbsd.c
+SRCS+= lposix.c
CFLAGS+= -I${SRCTOP}/lib/liblua -I${.CURDIR}/modules -I${LUASRC}
CFLAGS+= -DLUA_PROGNAME="\"${PROG}\""