xref: /illumos-gate/usr/src/cmd/bhyve/Makefile (revision 1a065e93eee983124652c3eb0cfdcb4776cd89ab)
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_utils.c		\
48	pci_ahci.c		\
49	pci_e82545.c		\
50	pci_emul.c		\
51	pci_fbuf.c		\
52	pci_hostbridge.c	\
53	pci_irq.c		\
54	pci_lpc.c		\
55	pci_nvme.c		\
56	pci_passthru.c		\
57	pci_uart.c		\
58	pci_virtio_block.c	\
59	pci_virtio_console.c	\
60	pci_virtio_net.c	\
61	pci_virtio_rnd.c	\
62	pci_virtio_viona.c	\
63	pci_xhci.c		\
64	pctestdev.c		\
65	pm.c			\
66	post.c			\
67	privileges.c		\
68	ps2kbd.c		\
69	ps2mouse.c		\
70	rfb.c			\
71	rtc.c			\
72	smbiostbl.c		\
73	sockstream.c		\
74	task_switch.c		\
75	uart_emul.c		\
76	usb_emul.c		\
77	usb_mouse.c		\
78	vga.c			\
79	virtio.c		\
80	vmgenc.c		\
81	xmsr.c			\
82	spinup_ap.c		\
83	iov.c			\
84	bhyve_sol_glue.c
85
86# We are not yet performing instruction emulation in userspace, so going to the
87# trouble of fixing the header tangle for this is not worth the complexity.
88	#kernemu_dev.c		\
89
90# The virtio-scsi driver appears to include  a slew of materials from FreeBSD's
91# native SCSI implementation.  We will omit that complexity for now.
92	#ctl_util.c		\
93	#ctl_scsi_all.c		\
94	#pci_virtio_scsi.c	\
95
96# The audio backend in FreeBSD is different than the one found in audio_oss.h
97	#audio.c		\
98	#hda_codec.c		\
99	#pci_hda.c		\
100
101# The bhyve generic net-backend stuff has been ignored by us at the moment
102# because illumos users prefer to use viona for its superior network perf.
103	#net_backends.c		\
104
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) -_gcc=-Wimplicit-function-declaration -_gcc=-Wno-parentheses
117CPPFLAGS =	-I$(COMPAT)/bhyve -I$(CONTRIB)/bhyve \
118		-I$(COMPAT)/bhyve/amd64 -I$(CONTRIB)/bhyve/amd64 \
119		-I$(CONTRIB)/bhyve/dev/usb/controller \
120		-I$(CONTRIB)/bhyve/dev/mii \
121		-I$(SRC)/uts/common/io/e1000api \
122		$(CPPFLAGS.master) \
123		-I$(SRC)/uts/i86pc/io/vmm \
124		-I$(SRC)/uts/common \
125		-I$(SRC)/uts/i86pc \
126		-DWITHOUT_CAPSICUM
127
128pci_nvme.o := CERRWARN += -_gcc=-Wno-pointer-sign
129pci_nvme.o := CERRWARN += -_gcc10=-Wno-address-of-packed-member
130pci_nvme.o := SMOFF += kmalloc_wrong_size
131
132pci_passthru.o := CERRWARN += -_gcc10=-Wno-address-of-packed-member
133
134pci_xhci.o := CERRWARN += -_gcc10=-Wno-address-of-packed-member
135
136SMOFF += all_func_returns,leaks,no_if_block
137
138# Force c99 for everything
139CSTD=		$(CSTD_GNU99)
140
141$(PROG) := LDLIBS += \
142	-lsocket \
143	-lnsl \
144	-ldlpi \
145	-ldladm \
146	-lmd \
147	-lnvpair \
148	-lcrypto \
149	-luuid \
150	-lvmmapi \
151	-lz
152NATIVE_LIBS += libz.so libcrypto.so
153$(MEVENT_TEST_PROG) := LDLIBS += -lsocket
154$(PROG) := LDFLAGS += $(ZASLR)
155
156.KEEP_STATE:
157
158all: $(PROG) $(MEVENT_TEST_PROG) $(SUBDIRS)
159
160$(PROG): $(OBJS)
161	$(LINK.c) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
162	$(POST_PROCESS)
163
164$(MEVENT_TEST_PROG): $(MEVENT_TEST_OBJS)
165	$(LINK.c) -o $@ $(MEVENT_TEST_OBJS) $(LDFLAGS) $(LDLIBS)
166
167install: all $(ROOTUSRSBINPROG) $(SUBDIRS)
168
169clean: $(SUBDIRS)
170	$(RM) $(OBJS) $(CLEANFILES)
171
172clobber: clean $(SUBDIRS)
173	$(RM) $(CLOBBERFILES)
174
175$(SUBDIRS): FRC
176	@cd $@; pwd; $(MAKE) $(TARGET)
177
178FRC:
179