xref: /linux-6.15/tools/virtio/Makefile (revision d5f5ee2a)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
24e53f78eSMichael S. Tsirkinall: test mod
31515c5ceSRusty Russelltest: virtio_test vringh_test
44e53f78eSMichael S. Tsirkinvirtio_test: virtio_ring.o virtio_test.o
51515c5ceSRusty Russellvringh_test: vringh_test.o vringh.o virtio_ring.o
61515c5ceSRusty Russell
71620ecb8SMichael S. TsirkinCFLAGS += -g -O2 -Werror -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE
81515c5ceSRusty Russellvpath %.c ../../drivers/virtio ../../drivers/vhost
94e53f78eSMichael S. Tsirkinmod:
10fd2e8d43SMichael S. Tsirkin	${MAKE} -C `pwd`/../.. M=`pwd`/vhost_test V=${V}
11*d5f5ee2aSMichael S. Tsirkin
12*d5f5ee2aSMichael S. Tsirkin#oot: build vhost as an out of tree module for a distro kernel
13*d5f5ee2aSMichael S. Tsirkin#no effort is taken to make it actually build or work, but tends to mostly work
14*d5f5ee2aSMichael S. Tsirkin#if the distro kernel is very close to upstream
15*d5f5ee2aSMichael S. Tsirkin#unsupported! this is a development tool only, don't use the
16*d5f5ee2aSMichael S. Tsirkin#resulting modules in production!
17*d5f5ee2aSMichael S. TsirkinOOT_KSRC=/lib/modules/$$(uname -r)/build
18*d5f5ee2aSMichael S. TsirkinOOT_VHOST=`pwd`/../../drivers/vhost
19*d5f5ee2aSMichael S. Tsirkin#Everyone depends on vhost
20*d5f5ee2aSMichael S. Tsirkin#Tweak the below to enable more modules
21*d5f5ee2aSMichael S. TsirkinOOT_CONFIGS=\
22*d5f5ee2aSMichael S. Tsirkin	CONFIG_VHOST=m \
23*d5f5ee2aSMichael S. Tsirkin	CONFIG_VHOST_NET=n \
24*d5f5ee2aSMichael S. Tsirkin	CONFIG_VHOST_SCSI=n \
25*d5f5ee2aSMichael S. Tsirkin	CONFIG_VHOST_VSOCK=n
26*d5f5ee2aSMichael S. TsirkinOOT_BUILD=KCFLAGS="-I "${OOT_VHOST} ${MAKE} -C ${OOT_KSRC} V=${V}
27*d5f5ee2aSMichael S. Tsirkinoot-build:
28*d5f5ee2aSMichael S. Tsirkin	echo "UNSUPPORTED! Don't use the resulting modules in production!"
29*d5f5ee2aSMichael S. Tsirkin	${OOT_BUILD} M=`pwd`/vhost_test
30*d5f5ee2aSMichael S. Tsirkin	${OOT_BUILD} M=${OOT_VHOST} ${OOT_CONFIGS}
31*d5f5ee2aSMichael S. Tsirkin
32*d5f5ee2aSMichael S. Tsirkinoot-clean: oot-build
33*d5f5ee2aSMichael S. Tsirkinoot: oot-build
34*d5f5ee2aSMichael S. Tsirkinoot-clean: OOT_BUILD+=clean
35*d5f5ee2aSMichael S. Tsirkin
36*d5f5ee2aSMichael S. Tsirkin.PHONY: all test mod clean vhost oot oot-clean oot-build
374e53f78eSMichael S. Tsirkinclean:
381515c5ceSRusty Russell	${RM} *.o vringh_test virtio_test vhost_test/*.o vhost_test/.*.cmd \
394e53f78eSMichael S. Tsirkin              vhost_test/Module.symvers vhost_test/modules.order *.d
404e53f78eSMichael S. Tsirkin-include *.d
41