xref: /illumos-gate/usr/src/cmd/bhyve/Makefile (revision b22a70abf81f995ecc990b8444e63308bc389d5c)
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 2019 Joyent, Inc.
15#
16
17PROG =		bhyve
18
19include ../Makefile.cmd
20include ../Makefile.cmd.64
21include ../Makefile.ctf
22
23SUBDIRS = test
24
25all	:=	TARGET = all
26install	:=	TARGET = install
27clean	:=	TARGET = clean
28clobber	:=	TARGET = clobber
29lint	:=	TARGET = lint
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	pci_ahci.c		\
48	pci_e82545.c		\
49	pci_emul.c		\
50	pci_fbuf.c		\
51	pci_hostbridge.c	\
52	pci_irq.c		\
53	pci_lpc.c		\
54	pci_nvme.c		\
55	pci_passthru.c		\
56	pci_uart.c		\
57	pci_virtio_block.c	\
58	pci_virtio_console.c	\
59	pci_virtio_net.c	\
60	pci_virtio_rnd.c	\
61	pci_virtio_viona.c	\
62	pci_xhci.c		\
63	pm.c			\
64	post.c			\
65	ps2kbd.c		\
66	ps2mouse.c		\
67	rfb.c			\
68	rtc.c			\
69	smbiostbl.c		\
70	sockstream.c		\
71	task_switch.c		\
72	uart_emul.c		\
73	usb_emul.c		\
74	usb_mouse.c		\
75	vga.c			\
76	virtio.c		\
77	vmm_instruction_emul.c	\
78	xmsr.c			\
79	spinup_ap.c		\
80	iov.c			\
81	bhyve_sol_glue.c
82
83# The virtio-scsi driver appears to include  a slew of materials from FreeBSD's
84# native SCSI implementation.  We will omit that complexity for now.
85	#ctl_util.c		\
86	#ctl_scsi_all.c		\
87	#pci_virtio_scsi.c	\
88
89
90OBJS = $(SRCS:.c=.o)
91
92CLOBBERFILES =	$(ROOTUSRSBINPROG)
93
94MEVENT_TEST_PROG = mevent_test
95MEVENT_TEST_SRCS = mevent.c mevent_test.c
96MEVENT_TEST_OBJS = $(MEVENT_TEST_SRCS:.c=.o)
97
98CLEANFILES =	$(PROG) $(MEVENT_TEST_PROG) $(MEVENT_TEST_OBJS)
99
100CFLAGS +=	$(CCVERBOSE) -_gcc=-Wimplicit-function-declaration -_gcc=-Wno-parentheses
101CPPFLAGS =	-I$(COMPAT)/freebsd -I$(CONTRIB)/freebsd \
102		-I$(COMPAT)/freebsd/amd64 -I$(CONTRIB)/freebsd/amd64 \
103		-I$(CONTRIB)/freebsd/dev/usb/controller \
104		-I$(CONTRIB)/freebsd/dev/mii \
105		-I$(SRC)/uts/common/io/e1000api \
106		$(CPPFLAGS.master) \
107		-I$(SRC)/uts/i86pc/io/vmm \
108		-I$(SRC)/uts/common \
109		-I$(SRC)/uts/i86pc \
110		-DWITHOUT_CAPSICUM
111
112# Disable the crypto code until it is wired up
113CPPFLAGS +=	-DNO_OPENSSL
114
115pci_nvme.o := CERRWARN += -_gcc=-Wno-pointer-sign
116
117SMOFF += all_func_returns,leaks,no_if_block
118
119# Force c99 for everything
120CSTD=		$(CSTD_GNU99)
121C99MODE=	-xc99=%all
122C99LMODE=	-Xc99=%all
123
124$(PROG) := LDLIBS += -lsocket -lnsl -ldlpi -ldladm -lmd -luuid -lvmmapi -lz
125$(MEVENT_TEST_PROG) := LDLIBS += -lsocket
126
127.KEEP_STATE:
128
129all: $(PROG) $(MEVENT_TEST_PROG) $(SUBDIRS)
130
131$(PROG): $(OBJS)
132	$(LINK.c) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
133	$(POST_PROCESS)
134
135$(MEVENT_TEST_PROG): $(MEVENT_TEST_OBJS)
136	$(LINK.c) -o $@ $(MEVENT_TEST_OBJS) $(LDFLAGS) $(LDLIBS)
137
138install: all $(ROOTUSRSBINPROG) $(SUBDIRS)
139
140clean: $(SUBDIRS)
141	$(RM) $(OBJS) $(CLEANFILES)
142
143clobber: clean $(SUBDIRS)
144	$(RM) $(CLOBBERFILES)
145
146lint:	lint_SRCS $(SUBDIRS)
147
148$(SUBDIRS): FRC
149	@cd $@; pwd; $(MAKE) $(TARGET)
150
151FRC:
152
153%.o: $(SRC)/uts/i86pc/io/vmm/%.c
154	$(COMPILE.c) $<
155	$(POST_PROCESS_O)
156