1*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0 2*4882a593Smuzhiyunall: test mod 3*4882a593Smuzhiyuntest: virtio_test vringh_test 4*4882a593Smuzhiyunvirtio_test: virtio_ring.o virtio_test.o 5*4882a593Smuzhiyunvringh_test: vringh_test.o vringh.o virtio_ring.o 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunCFLAGS += -g -O2 -Werror -Wno-maybe-uninitialized -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE -include ../../include/linux/kconfig.h 8*4882a593SmuzhiyunCFLAGS += -pthread 9*4882a593SmuzhiyunLDFLAGS += -pthread 10*4882a593Smuzhiyunvpath %.c ../../drivers/virtio ../../drivers/vhost 11*4882a593Smuzhiyunmod: 12*4882a593Smuzhiyun ${MAKE} -C `pwd`/../.. M=`pwd`/vhost_test V=${V} 13*4882a593Smuzhiyun 14*4882a593Smuzhiyun#oot: build vhost as an out of tree module for a distro kernel 15*4882a593Smuzhiyun#no effort is taken to make it actually build or work, but tends to mostly work 16*4882a593Smuzhiyun#if the distro kernel is very close to upstream 17*4882a593Smuzhiyun#unsupported! this is a development tool only, don't use the 18*4882a593Smuzhiyun#resulting modules in production! 19*4882a593SmuzhiyunOOT_KSRC=/lib/modules/$$(uname -r)/build 20*4882a593SmuzhiyunOOT_VHOST=`pwd`/../../drivers/vhost 21*4882a593Smuzhiyun#Everyone depends on vhost 22*4882a593Smuzhiyun#Tweak the below to enable more modules 23*4882a593SmuzhiyunOOT_CONFIGS=\ 24*4882a593Smuzhiyun CONFIG_VHOST=m \ 25*4882a593Smuzhiyun CONFIG_VHOST_NET=n \ 26*4882a593Smuzhiyun CONFIG_VHOST_SCSI=n \ 27*4882a593Smuzhiyun CONFIG_VHOST_VSOCK=n \ 28*4882a593Smuzhiyun CONFIG_VHOST_RING=n 29*4882a593SmuzhiyunOOT_BUILD=KCFLAGS="-I "${OOT_VHOST} ${MAKE} -C ${OOT_KSRC} V=${V} 30*4882a593Smuzhiyunoot-build: 31*4882a593Smuzhiyun echo "UNSUPPORTED! Don't use the resulting modules in production!" 32*4882a593Smuzhiyun ${OOT_BUILD} M=`pwd`/vhost_test 33*4882a593Smuzhiyun ${OOT_BUILD} M=${OOT_VHOST} ${OOT_CONFIGS} 34*4882a593Smuzhiyun 35*4882a593Smuzhiyunoot-clean: oot-build 36*4882a593Smuzhiyunoot: oot-build 37*4882a593Smuzhiyunoot-clean: OOT_BUILD+=clean 38*4882a593Smuzhiyun 39*4882a593Smuzhiyun.PHONY: all test mod clean vhost oot oot-clean oot-build 40*4882a593Smuzhiyunclean: 41*4882a593Smuzhiyun ${RM} *.o vringh_test virtio_test vhost_test/*.o vhost_test/.*.cmd \ 42*4882a593Smuzhiyun vhost_test/Module.symvers vhost_test/modules.order *.d 43*4882a593Smuzhiyun-include *.d 44