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