xref: /illumos-gate/usr/src/uts/i86pc/vmm/Makefile (revision c94be9439c4f0773ef60e2cec21d548359cfea20)
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 2013 Pluribus Networks Inc.
14# Copyright 2019 Joyent, Inc.
15#
16
17#
18#	Path to the base of the uts directory tree (usually /usr/src/uts).
19#
20UTSBASE	= ../..
21
22#
23#	Define the module and object file sets.
24#
25MODULE		= vmm
26OBJECTS		= $(VMM_OBJS:%=$(OBJS_DIR)/%)
27ROOTMODULE	= $(USR_DRV_DIR)/$(MODULE)
28CONF_SRCDIR	= $(UTSBASE)/i86pc/io/vmm
29MAPFILE		= $(UTSBASE)/i86pc/io/vmm/vmm.mapfile
30
31#
32#	Include common rules.
33#
34include $(UTSBASE)/i86pc/Makefile.i86pc
35
36#
37#	Define targets
38#
39ALL_TARGET	= $(BINARY)
40INSTALL_TARGET	= $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
41
42#
43#	Overrides and additions
44#
45
46CERRWARN	+= -_gcc=-Wno-empty-body
47
48# 3rd party code
49SMOFF += all_func_returns
50
51# needs work
52$(OBJS_DIR)/vmm_sol_dev.o := SMOFF += signed_integer_overflow_check
53
54# a can't happen: vmx_setcap() warn: variable dereferenced before check 'pptr'
55$(OBJS_DIR)/vmx.o := SMOFF += deref_check
56
57ALL_BUILDS	= $(ALL_BUILDSONLY64)
58DEF_BUILDS	= $(DEF_BUILDSONLY64)
59PRE_INC_PATH	= -I$(COMPAT)/bhyve -I$(COMPAT)/bhyve/amd64 \
60	-I$(CONTRIB)/bhyve -I$(CONTRIB)/bhyve/amd64
61INC_PATH	+= -I$(UTSBASE)/i86pc/io/vmm -I$(UTSBASE)/i86pc/io/vmm/io
62AS_INC_PATH	+= -I$(UTSBASE)/i86pc/io/vmm -I$(OBJS_DIR)
63
64CFLAGS		+= -_gcc=-Wimplicit-function-declaration
65# The FreeBSD %# notation makes gcc gripe
66CFLAGS		+= -_gcc=-Wno-format
67# enable collection of VMM statistics
68CFLAGS		+= -DVMM_KEEP_STATS
69
70$(OBJS_DIR)/vmm.o := CERRWARN += -_gcc=-Wno-pointer-sign -_gcc=-Wno-type-limits
71$(OBJS_DIR)/svm.o := CERRWARN += -_gcc=-Wno-pointer-sign -_gcc=-Wno-type-limits
72$(OBJS_DIR)/vmx.o := CERRWARN += -_gcc=-Wno-unused-variable
73$(OBJS_DIR)/iommu.o := CERRWARN += -_gcc=-Wno-unused-variable
74
75LDFLAGS         += -N misc/acpica -N misc/pcie -N fs/dev
76LDFLAGS         += -z type=kmod -M $(MAPFILE)
77
78OFFSETS_VMX	= $(CONF_SRCDIR)/intel/offsets.in
79OFFSETS_SVM	= $(CONF_SRCDIR)/amd/offsets.in
80ASSYM_VMX	= $(OBJS_DIR)/vmx_assym.h
81ASSYM_SVM	= $(OBJS_DIR)/svm_assym.h
82ASSYM_H		= $(ASSYM_VMX) $(ASSYM_SVM)
83
84CLEANFILES	+= $(ASSYM_H)
85
86#
87#	Default build targets.
88#
89.KEEP_STATE:
90
91def:		$(DEF_DEPS)
92
93all:		$(ALL_DEPS)
94
95clean:		$(CLEAN_DEPS)
96
97clobber:	$(CLOBBER_DEPS)
98
99install:	$(INSTALL_DEPS)
100
101#
102#	Include common targets.
103#
104include $(UTSBASE)/i86pc/Makefile.targ
105
106$(ASSYM_VMX): $(OFFSETS_VMX) $(GENASSYM)
107	$(OFFSETS_CREATE) -I../../i86pc/io/vmm < $(OFFSETS_VMX) >$@
108$(ASSYM_SVM): $(OFFSETS_SVM) $(GENASSYM)
109	$(OFFSETS_CREATE) -I../../i86pc/io/vmm < $(OFFSETS_SVM) >$@
110
111$(OBJS_DIR)/vmx_support.o:  $(ASSYM_VMX)
112$(OBJS_DIR)/svm_support.o:  $(ASSYM_SVM)
113