xref: /illumos-gate/usr/src/cmd/bhyve/Makefile (revision 7c46107350cb9215d4a4b9e371541fbfa02abdb4)
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 2020 Joyent, Inc.
15# Copyright 2020 Oxide Computer Company
16# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
17#
18
19PROG =		bhyve
20
21include ../Makefile.cmd
22include ../Makefile.cmd.64
23include ../Makefile.ctf
24
25SUBDIRS = test
26
27all	:=	TARGET = all
28install	:=	TARGET = install
29clean	:=	TARGET = clean
30clobber	:=	TARGET = clobber
31
32SRCS =	acpi.c			\
33	atkbdc.c		\
34	bhyvegc.c		\
35	bhyverun.c		\
36	block_if.c		\
37	bootrom.c		\
38	console.c		\
39	config.c		\
40	fwctl.c			\
41	gdb.c			\
42	inout.c			\
43	ioapic.c		\
44	mem.c			\
45	mevent.c		\
46	mptbl.c			\
47	net_backends.c		\
48	net_utils.c		\
49	pci_ahci.c		\
50	pci_e82545.c		\
51	pci_emul.c		\
52	pci_fbuf.c		\
53	pci_hostbridge.c	\
54	pci_irq.c		\
55	pci_lpc.c		\
56	pci_nvme.c		\
57	pci_passthru.c		\
58	pci_uart.c		\
59	pci_virtio_9p.c		\
60	pci_virtio_block.c	\
61	pci_virtio_console.c	\
62	pci_virtio_net.c	\
63	pci_virtio_rnd.c	\
64	pci_virtio_viona.c	\
65	pci_xhci.c		\
66	pctestdev.c		\
67	pm.c			\
68	post.c			\
69	privileges.c		\
70	ps2kbd.c		\
71	ps2mouse.c		\
72	rfb.c			\
73	rtc.c			\
74	smbiostbl.c		\
75	sockstream.c		\
76	task_switch.c		\
77	uart_emul.c		\
78	usb_emul.c		\
79	usb_mouse.c		\
80	vga.c			\
81	virtio.c		\
82	vmgenc.c		\
83	xmsr.c			\
84	spinup_ap.c		\
85	iov.c			\
86	bhyve_sol_glue.c
87
88# We are not yet performing instruction emulation in userspace, so going to the
89# trouble of fixing the header tangle for this is not worth the complexity.
90	#kernemu_dev.c		\
91
92# The virtio-scsi driver appears to include a slew of materials from FreeBSD's
93# native SCSI implementation.  We will omit that complexity for now.
94	#ctl_util.c		\
95	#ctl_scsi_all.c		\
96	#pci_virtio_scsi.c	\
97
98# The audio backend in FreeBSD is different than the one found in audio_oss.h
99	#audio.c		\
100	#hda_codec.c		\
101	#pci_hda.c		\
102
103# The virtio input device expects to link to a FreeBSD /dev/input/eventX device
104	#pci_virtio_input.c	\
105
106OBJS = $(SRCS:.c=.o)
107
108CLOBBERFILES =	$(ROOTUSRSBINPROG)
109
110MEVENT_TEST_PROG = mevent_test
111MEVENT_TEST_SRCS = mevent.c mevent_test.c
112MEVENT_TEST_OBJS = $(MEVENT_TEST_SRCS:.c=.o)
113
114CLEANFILES =	$(PROG) $(MEVENT_TEST_PROG) $(MEVENT_TEST_OBJS)
115
116CFLAGS +=	$(CCVERBOSE)
117CFLAGS +=	-_gcc=-Wimplicit-function-declaration -_gcc=-Wno-parentheses
118CPPFLAGS =	-I$(COMPAT)/bhyve -I$(CONTRIB)/bhyve \
119		-I$(COMPAT)/bhyve/amd64 -I$(CONTRIB)/bhyve/amd64 \
120		-I$(CONTRIB)/bhyve/dev/usb/controller \
121		-I$(CONTRIB)/bhyve/dev/mii \
122		-I$(SRC)/lib/lib9p/common \
123		-I$(SRC)/uts/common/io/e1000api \
124		$(CPPFLAGS.master) \
125		-I$(SRC)/uts/i86pc/io/vmm \
126		-I$(SRC)/uts/common \
127		-I$(SRC)/uts/i86pc \
128		-DWITHOUT_CAPSICUM
129
130pci_nvme.o := CERRWARN += -_gcc=-Wno-pointer-sign
131pci_nvme.o := CERRWARN += -_gcc10=-Wno-address-of-packed-member
132pci_nvme.o := CERRWARN += -_gcc11=-Wno-address-of-packed-member
133pci_nvme.o := SMOFF += kmalloc_wrong_size
134
135pci_passthru.o := CERRWARN += -_gcc10=-Wno-address-of-packed-member
136pci_passthru.o := CERRWARN += -_gcc11=-Wno-address-of-packed-member
137
138pci_virtio_9p.o := SMOFF += kmalloc_wrong_size
139
140pci_xhci.o := CERRWARN += -_gcc10=-Wno-address-of-packed-member
141pci_xhci.o := CERRWARN += -_gcc11=-Wno-address-of-packed-member
142
143SMOFF += all_func_returns,leaks,no_if_block
144
145# Force c99 for everything
146CSTD=		$(CSTD_GNU99)
147
148$(PROG) := LDLIBS += \
149	-l9p \
150	-lsocket \
151	-lnsl \
152	-ldlpi \
153	-ldladm \
154	-lmd \
155	-lnvpair \
156	-lproc \
157	-lcrypto \
158	-luuid \
159	-lvmmapi \
160	-lz
161NATIVE_LIBS += libz.so libcrypto.so
162$(MEVENT_TEST_PROG) := LDLIBS += -lsocket -lproc
163$(PROG) := LDFLAGS += $(ZASLR)
164
165.KEEP_STATE:
166
167all: $(PROG) $(MEVENT_TEST_PROG) $(SUBDIRS)
168
169$(PROG): $(OBJS)
170	$(LINK.c) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
171	$(POST_PROCESS)
172
173$(MEVENT_TEST_PROG): $(MEVENT_TEST_OBJS)
174	$(LINK.c) -o $@ $(MEVENT_TEST_OBJS) $(LDFLAGS) $(LDLIBS)
175
176install: all $(ROOTUSRSBINPROG) $(SUBDIRS)
177
178clean: $(SUBDIRS)
179	$(RM) $(OBJS) $(CLEANFILES)
180
181clobber: clean $(SUBDIRS)
182	$(RM) $(CLOBBERFILES)
183
184$(SUBDIRS): FRC
185	@cd $@; pwd; $(MAKE) $(TARGET)
186
187FRC:
188