xref: /illumos-gate/usr/src/cmd/bhyve/Makefile (revision fd8be61dc48514ff8e3bb97fdb04972e2765a6da)
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#
17
18PROG =		bhyve
19
20include ../Makefile.cmd
21include ../Makefile.cmd.64
22include ../Makefile.ctf
23
24SUBDIRS = test
25
26all	:=	TARGET = all
27install	:=	TARGET = install
28clean	:=	TARGET = clean
29clobber	:=	TARGET = clobber
30
31SRCS =	acpi.c			\
32	atkbdc.c		\
33	bhyvegc.c		\
34	bhyverun.c		\
35	block_if.c		\
36	bootrom.c		\
37	console.c		\
38	consport.c		\
39	dbgport.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	ps2kbd.c		\
68	ps2mouse.c		\
69	rfb.c			\
70	rtc.c			\
71	smbiostbl.c		\
72	sockstream.c		\
73	task_switch.c		\
74	uart_emul.c		\
75	usb_emul.c		\
76	usb_mouse.c		\
77	vga.c			\
78	virtio.c		\
79	vmgenc.c		\
80	xmsr.c			\
81	spinup_ap.c		\
82	iov.c			\
83	bhyve_sol_glue.c
84
85# We are not yet performing instruction emulation in userspace, so going to the
86# trouble of fixing the header tangle for this is not worth the complexity.
87	#kernemu_dev.c		\
88
89# The virtio-scsi driver appears to include  a slew of materials from FreeBSD's
90# native SCSI implementation.  We will omit that complexity for now.
91	#ctl_util.c		\
92	#ctl_scsi_all.c		\
93	#pci_virtio_scsi.c	\
94
95# The audio backend in FreeBSD is different than the one found in audio_oss.h
96	#audio.c		\
97	#hda_codec.c		\
98	#pci_hda.c		\
99
100# The bhyve generic net-backend stuff has been ignored by us at the moment
101# because illumos users prefer to use viona for its superior network perf.
102	#net_backends.c		\
103
104
105OBJS = $(SRCS:.c=.o)
106
107CLOBBERFILES =	$(ROOTUSRSBINPROG)
108
109MEVENT_TEST_PROG = mevent_test
110MEVENT_TEST_SRCS = mevent.c mevent_test.c
111MEVENT_TEST_OBJS = $(MEVENT_TEST_SRCS:.c=.o)
112
113CLEANFILES =	$(PROG) $(MEVENT_TEST_PROG) $(MEVENT_TEST_OBJS)
114
115CFLAGS +=	$(CCVERBOSE) -_gcc=-Wimplicit-function-declaration -_gcc=-Wno-parentheses
116CPPFLAGS =	-I$(COMPAT)/bhyve -I$(CONTRIB)/bhyve \
117		-I$(COMPAT)/bhyve/amd64 -I$(CONTRIB)/bhyve/amd64 \
118		-I$(CONTRIB)/bhyve/dev/usb/controller \
119		-I$(CONTRIB)/bhyve/dev/mii \
120		-I$(SRC)/uts/common/io/e1000api \
121		$(CPPFLAGS.master) \
122		-I$(SRC)/uts/i86pc/io/vmm \
123		-I$(SRC)/uts/common \
124		-I$(SRC)/uts/i86pc \
125		-DWITHOUT_CAPSICUM
126
127pci_nvme.o := CERRWARN += -_gcc=-Wno-pointer-sign
128pci_nvme.o := SMOFF += kmalloc_wrong_size
129
130SMOFF += all_func_returns,leaks,no_if_block
131
132# Force c99 for everything
133CSTD=		$(CSTD_GNU99)
134C99MODE=	-xc99=%all
135
136$(PROG) := LDLIBS += \
137	-lsocket \
138	-lnsl \
139	-ldlpi \
140	-ldladm \
141	-lmd \
142	-lcrypto \
143	-luuid \
144	-lvmmapi \
145	-lz
146NATIVE_LIBS += libz.so libcrypto.so
147$(MEVENT_TEST_PROG) := LDLIBS += -lsocket
148
149.KEEP_STATE:
150
151all: $(PROG) $(MEVENT_TEST_PROG) $(SUBDIRS)
152
153$(PROG): $(OBJS)
154	$(LINK.c) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
155	$(POST_PROCESS)
156
157$(MEVENT_TEST_PROG): $(MEVENT_TEST_OBJS)
158	$(LINK.c) -o $@ $(MEVENT_TEST_OBJS) $(LDFLAGS) $(LDLIBS)
159
160install: all $(ROOTUSRSBINPROG) $(SUBDIRS)
161
162clean: $(SUBDIRS)
163	$(RM) $(OBJS) $(CLEANFILES)
164
165clobber: clean $(SUBDIRS)
166	$(RM) $(CLOBBERFILES)
167
168$(SUBDIRS): FRC
169	@cd $@; pwd; $(MAKE) $(TARGET)
170
171FRC:
172