From c36e692a8e136ab91ba064535120b31bf7bb5fc7 Mon Sep 17 00:00:00 2001 From: logwang Date: Wed, 25 Oct 2017 15:19:26 +0800 Subject: [PATCH] Use `KMOD_SRCS` to pass extra kernel module sourcs. For example, if you have an extra FreeBSD kernel module, and want to compile it into F-Stack, you can do it like this: ``` cd f-stack/lib export "KMOD_SRCS=/your/kmod/path/a.c /your/kmod/path/b.c" export "CONF_CFLAGS=-I/your/kmod/path" make ``` --- lib/Makefile | 3 +++ mk/kern.pre.mk | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Makefile b/lib/Makefile index 432c67db0..507230727 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -421,6 +421,9 @@ SRCS+= ${NETIPSEC_SRCS} ${OPENCRYPTO_SRCS} ${VM_SRCS} # If witness is enabled. # SRCS+= ${KERN_WITNESS_SRCS} +# Extra FreeBSD kernel module srcs. +SRCS+= ${KMOD_SRCS} + HOST_SRCS = ${FF_HOST_SRCS} ASM_OBJS+= $(patsubst %.S,%.o,${ASM_SRCS}) diff --git a/mk/kern.pre.mk b/mk/kern.pre.mk index 2e6af6211..a946590ad 100644 --- a/mk/kern.pre.mk +++ b/mk/kern.pre.mk @@ -79,7 +79,7 @@ CFLAGS+= ${CONF_CFLAGS} # Optional linting. This can be overridden in /etc/make.conf. LINTFLAGS= ${LINTOBJKERNFLAGS} -NORMAL_C= ${CC} -c ${CFLAGS} ${KERNEL_CFLAGS} ${INCLUDES} ${WERROR} ${PROF} $< +NORMAL_C= ${CC} -c ${CFLAGS} ${KERNEL_CFLAGS} ${INCLUDES} ${WERROR} ${PROF} $< -o $@ NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${INCLUDES} ${WERROR} $< PROFILE_C= ${CC} -c ${CFLAGS} ${KERNEL_CFLAGS} ${INCLUDES} ${WERROR} $< NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${KERNEL_CFLAGS} ${INCLUDES} ${PROF} $<