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