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