xref: /illumos-gate/usr/src/cmd/bhyve/Makefile (revision b445c7c6f2f09c2296534b5ccda2c05321c474b1)
1#
2# This file and its contents are supplied under the terms of the
3# Common Development and Distribution License ("CDDL"), version 1.0.
4# You may only use this file in accordance with the terms of version
5# 1.0 of the CDDL.
6#
7# A full copy of the text of the CDDL should have accompanied this
8# source.  A copy of the CDDL is also available via the Internet at
9# http://www.illumos.org/license/CDDL.
10#
11
12#
13# Copyright 2014 Pluribus Networks Inc.
14# Copyright 2019 Joyent, Inc.
15#
16
17PROG =		bhyve
18
19include ../Makefile.cmd
20include ../Makefile.cmd.64
21include ../Makefile.ctf
22
23SUBDIRS = test
24
25all	:=	TARGET = all
26install	:=	TARGET = install
27clean	:=	TARGET = clean
28clobber	:=	TARGET = clobber
29
30SRCS =	acpi.c			\
31	atkbdc.c		\
32	bhyvegc.c		\
33	bhyverun.c		\
34	block_if.c		\
35	bootrom.c		\
36	console.c		\
37	consport.c		\
38	dbgport.c		\
39	fwctl.c			\
40	gdb.c			\
41	inout.c			\
42	ioapic.c		\
43	mem.c			\
44	mevent.c		\
45	mptbl.c			\
46	net_utils.c		\
47	pci_ahci.c		\
48	pci_e82545.c		\
49	pci_emul.c		\
50	pci_fbuf.c		\
51	pci_hostbridge.c	\
52	pci_irq.c		\
53	pci_lpc.c		\
54	pci_nvme.c		\
55	pci_passthru.c		\
56	pci_uart.c		\
57	pci_virtio_block.c	\
58	pci_virtio_console.c	\
59	pci_virtio_net.c	\
60	pci_virtio_rnd.c	\
61	pci_virtio_viona.c	\
62	pci_xhci.c		\
63	pm.c			\
64	post.c			\
65	ps2kbd.c		\
66	ps2mouse.c		\
67	rfb.c			\
68	rtc.c			\
69	smbiostbl.c		\
70	sockstream.c		\
71	task_switch.c		\
72	uart_emul.c		\
73	usb_emul.c		\
74	usb_mouse.c		\
75	vga.c			\
76	virtio.c		\
77	vmm_instruction_emul.c	\
78	vmgenc.c		\
79	xmsr.c			\
80	spinup_ap.c		\
81	iov.c			\
82	bhyve_sol_glue.c
83
84# We are not yet performing instruction emulation in userspace, so going to the
85# trouble of fixing the header tangle for this is not worth the complexity.
86	#kernemu_dev.c		\
87
88# The virtio-scsi driver appears to include  a slew of materials from FreeBSD's
89# native SCSI implementation.  We will omit that complexity for now.
90	#ctl_util.c		\
91	#ctl_scsi_all.c		\
92	#pci_virtio_scsi.c	\
93
94# The audio backend in FreeBSD is different than the one found in audio_oss.h
95	#audio.c		\
96	#hda_codec.c		\
97	#pci_hda.c		\
98
99# The bhyve generic net-backend stuff has been ignored by us at the moment
100# because SmartOS users prefer to use viona for its superior network perf.
101	#net_backends.c		\
102
103
104OBJS = $(SRCS:.c=.o)
105
106CLOBBERFILES =	$(ROOTUSRSBINPROG)
107
108MEVENT_TEST_PROG = mevent_test
109MEVENT_TEST_SRCS = mevent.c mevent_test.c
110MEVENT_TEST_OBJS = $(MEVENT_TEST_SRCS:.c=.o)
111
112CLEANFILES =	$(PROG) $(MEVENT_TEST_PROG) $(MEVENT_TEST_OBJS)
113
114CFLAGS +=	$(CCVERBOSE) -_gcc=-Wimplicit-function-declaration -_gcc=-Wno-parentheses
115CPPFLAGS =	-I$(COMPAT)/bhyve -I$(CONTRIB)/bhyve \
116		-I$(COMPAT)/bhyve/amd64 -I$(CONTRIB)/bhyve/amd64 \
117		-I$(CONTRIB)/bhyve/dev/usb/controller \
118		-I$(CONTRIB)/bhyve/dev/mii \
119		-I$(SRC)/uts/common/io/e1000api \
120		$(CPPFLAGS.master) \
121		-I$(SRC)/uts/i86pc/io/vmm \
122		-I$(SRC)/uts/common \
123		-I$(SRC)/uts/i86pc \
124		-DWITHOUT_CAPSICUM
125
126# Disable the crypto code until it is wired up
127CPPFLAGS +=	-DNO_OPENSSL
128
129pci_nvme.o := CERRWARN += -_gcc=-Wno-pointer-sign
130pci_nvme.o := SMOFF += kmalloc_wrong_size
131
132SMOFF += all_func_returns,leaks,no_if_block
133
134# Force c99 for everything
135CSTD=		$(CSTD_GNU99)
136C99MODE=	-xc99=%all
137
138$(PROG) := LDLIBS += -lsocket -lnsl -ldlpi -ldladm -lmd -luuid -lvmmapi -lz
139$(MEVENT_TEST_PROG) := LDLIBS += -lsocket
140
141.KEEP_STATE:
142
143all: $(PROG) $(MEVENT_TEST_PROG) $(SUBDIRS)
144
145$(PROG): $(OBJS)
146	$(LINK.c) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
147	$(POST_PROCESS)
148
149$(MEVENT_TEST_PROG): $(MEVENT_TEST_OBJS)
150	$(LINK.c) -o $@ $(MEVENT_TEST_OBJS) $(LDFLAGS) $(LDLIBS)
151
152install: all $(ROOTUSRSBINPROG) $(SUBDIRS)
153
154clean: $(SUBDIRS)
155	$(RM) $(OBJS) $(CLEANFILES)
156
157clobber: clean $(SUBDIRS)
158	$(RM) $(CLOBBERFILES)
159
160$(SUBDIRS): FRC
161	@cd $@; pwd; $(MAKE) $(TARGET)
162
163FRC:
164
165%.o: $(SRC)/uts/i86pc/io/vmm/%.c
166	$(COMPILE.c) $<
167	$(POST_PROCESS_O)
168