1#
2#
3
4.include <src.opts.mk>
5
6PROG=	bhyve
7PACKAGE=	bhyve
8
9MAN=	bhyve.8 bhyve_config.5
10
11BHYVE_SYSDIR?=${SRCTOP}
12
13.PATH:	${.CURDIR}/${MACHINE_CPUARCH}	\
14	${SRCTOP}/sys/libkern		\
15	${SRCTOP}/sys/cam/ctl
16
17SRCS=	\
18	acpi.c			\
19	acpi_device.c		\
20	audio.c			\
21	basl.c			\
22	bhyvegc.c		\
23	bhyverun.c		\
24	bhyverun_machdep.c	\
25	block_if.c		\
26	bootrom.c		\
27	config.c		\
28	console.c		\
29	crc16.c			\
30	ctl_nvme_all.c		\
31	ctl_scsi_all.c		\
32	ctl_util.c		\
33	hda_codec.c		\
34	iov.c			\
35	mem.c			\
36	mevent.c		\
37	net_backend_netmap.c	\
38	net_backend_slirp.c	\
39	net_backends.c		\
40	net_utils.c		\
41	pci_ahci.c		\
42	pci_e82545.c		\
43	pci_emul.c		\
44	pci_hda.c		\
45	pci_hostbridge.c	\
46	pci_irq.c		\
47	pci_nvme.c		\
48	pci_uart.c		\
49	pci_virtio_9p.c		\
50	pci_virtio_block.c	\
51	pci_virtio_console.c	\
52	pci_virtio_input.c	\
53	pci_virtio_net.c	\
54	pci_virtio_rnd.c	\
55	pci_virtio_scsi.c	\
56	pci_xhci.c		\
57	qemu_fwcfg.c		\
58	qemu_loader.c		\
59	smbiostbl.c		\
60	sockstream.c		\
61	tpm_device.c		\
62	tpm_emul_passthru.c	\
63	tpm_intf_crb.c		\
64	tpm_ppi_qemu.c		\
65	uart_backend.c		\
66	uart_emul.c		\
67	usb_emul.c		\
68	usb_mouse.c		\
69	virtio.c		\
70	vmexit.c		\
71	vmgenc.c
72
73.if ${MK_BHYVE_SNAPSHOT} != "no"
74SRCS+=	snapshot.c
75.endif
76
77.include "${MACHINE_CPUARCH}/Makefile.inc"
78
79.if defined(BHYVE_FDT_SUPPORT)
80LIBADD+= fdt
81CFLAGS+= -I${SRCTOP}/sys/contrib/libfdt
82.endif
83
84.if defined(BHYVE_GDB_SUPPORT)
85SRCS+=	gdb.c
86CFLAGS+= -DBHYVE_GDB
87.ifdef GDB_LOG
88CFLAGS+=-DGDB_LOG
89.endif
90SUBDIR+= gdb
91.endif
92
93CFLAGS+=-I${.CURDIR}		\
94	-I${.CURDIR}/../../contrib/lib9p \
95	-I${SRCTOP}/sys
96
97LIBADD+= vmmapi md nv pthread z util sbuf cam 9p
98
99.if ${MK_BHYVE_SNAPSHOT} != "no"
100LIBADD+= ucl xo
101.endif
102
103.if ${MK_INET_SUPPORT} != "no"
104CFLAGS+=-DINET
105.endif
106.if ${MK_INET6_SUPPORT} != "no"
107CFLAGS+=-DINET6
108.endif
109.if ${MK_NETGRAPH_SUPPORT} != "no"
110SRCS+=	net_backend_netgraph.c
111LIBADD+=	netgraph
112.endif
113.if ${MK_OPENSSL} == "no"
114CFLAGS+=-DNO_OPENSSL
115.else
116LIBADD+=	crypto
117CFLAGS+=-DOPENSSL_API_COMPAT=0x10100000L
118.endif
119
120CFLAGS+= -I${BHYVE_SYSDIR}/sys/dev/e1000
121CFLAGS+= -I${BHYVE_SYSDIR}/sys/dev/mii
122CFLAGS+= -I${BHYVE_SYSDIR}/sys/dev/usb/controller
123.if ${MK_BHYVE_SNAPSHOT} != "no"
124CFLAGS+= -I${SRCTOP}/contrib/libucl/include
125CFLAGS+= -DBHYVE_SNAPSHOT
126.endif
127
128# Disable thread safety analysis since it only finds very simple bugs and
129# yields many false positives.
130NO_WTHREAD_SAFETY=
131
132NO_WCAST_ALIGN=
133
134.include <bsd.prog.mk>
135