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)/%) 27LINTS = $(VMM_OBJS:%.o=$(LINTS_DIR)/%.ln) 28ROOTMODULE = $(USR_DRV_DIR)/$(MODULE) 29CONF_SRCDIR = $(UTSBASE)/i86pc/io/vmm 30MAPFILE = $(UTSBASE)/i86pc/io/vmm/vmm.mapfile 31 32# 33# Include common rules. 34# 35include $(UTSBASE)/i86pc/Makefile.i86pc 36 37# 38# Define targets 39# 40ALL_TARGET = $(BINARY) 41LINT_TARGET = $(MODULE).lint 42INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE) 43 44# 45# Overrides and additions 46# 47LINTTAGS += -erroff=E_EMPTY_DECLARATION 48LINTTAGS += -erroff=E_OPERANDS_INCOMPATIBLE_TYPES 49LINTTAGS += -erroff=E_VOID_CANT_RETURN_VALUE 50LINTTAGS += -erroff=E_YACC_ERROR 51LINTTAGS += -erroff=E_STATIC_UNUSED 52LINTTAGS += -erroff=E_FUNC_RET_MAYBE_IGNORED2 53LINTTAGS += -erroff=E_FUNC_RET_ALWAYS_IGNOR2 54LINTTAGS += -erroff=E_BAD_FORMAT_ARG_TYPE2 55LINTTAGS += -erroff=E_FUNC_ARG_UNUSED 56LINTTAGS += -erroff=E_FUNC_SET_NOT_USED 57LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV 58LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN 59LINTTAGS += -erroff=E_CONSTANT_CONDITION 60LINTTAGS += -erroff=E_PTR_TO_VOID_IN_ARITHMETIC 61LINTTAGS += -erroff=E_CONST_TRUNCATED_BY_ASSIGN 62LINTTAGS += -erroff=E_NOP_ELSE_STMT 63LINTTAGS += -erroff=E_FUNC_NO_RET_VAL 64LINTTAGS += -erroff=E_OLD_STYLE_DECL_OR_BAD_TYPE 65LINTTAGS += -erroff=E_VAR_USED_BEFORE_SET 66LINTTAGS += -erroff=E_INTEGER_OVERFLOW_DETECTED 67LINTTAGS += -erroff=E_STMT_NOT_REACHED 68LINTTAGS += -erroff=E_FUNC_NO_RET_VAL 69LINTTAGS += -erroff=E_USELESS_DECLARATION 70LINTTAGS += -erroff=E_EXPR_NULL_EFFECT 71LINTTAGS += -erroff=E_CASE_FALLTHRU 72LINTTAGS += -erroff=E_FUNC_DECL_VAR_ARG2 73LINTTAGS += -erroff=E_ASM_IMPOSSIBLE_CONSTRAINT 74LINTTAGS += -erroff=E_ASM_UNUSED_PARAM 75LINTTAGS += -erroff=E_NOP_IF_STMT 76LINTTAGS += -erroff=E_ZERO_OR_NEGATIVE_SUBSCRIPT 77 78CERRWARN += -_gcc=-Wno-empty-body 79 80# 3rd party code 81SMOFF += all_func_returns 82 83# needs work 84$(OBJS_DIR)/vmm_sol_dev.o := SMOFF += signed_integer_overflow_check 85 86# a can't happen: vmx_setcap() warn: variable dereferenced before check 'pptr' 87$(OBJS_DIR)/vmx.o := SMOFF += deref_check 88 89# These sources only compile with gcc. Workaround a confluence of cruft 90# regarding dmake and shadow compilation by neutering the sun compiler. 91#amd64_CC = $(ONBLD_TOOLS)/bin/$(MACH)/cw -_gcc 92#CFLAGS += -_cc=-xdryrun 93 94ALL_BUILDS = $(ALL_BUILDSONLY64) 95DEF_BUILDS = $(DEF_BUILDSONLY64) 96PRE_INC_PATH = -I$(COMPAT)/freebsd -I$(COMPAT)/freebsd/amd64 \ 97 -I$(CONTRIB)/freebsd -I$(CONTRIB)/freebsd/amd64 98INC_PATH += -I$(UTSBASE)/i86pc/io/vmm -I$(UTSBASE)/i86pc/io/vmm/io 99AS_INC_PATH += -I$(UTSBASE)/i86pc/io/vmm -I$(OBJS_DIR) 100 101CFLAGS += -_gcc=-Wimplicit-function-declaration 102# The FreeBSD %# notation makes gcc gripe 103CFLAGS += -_gcc=-Wno-format 104# enable collection of VMM statistics 105CFLAGS += -DVMM_KEEP_STATS 106 107LDFLAGS += -Nfs/dev 108 109$(OBJS_DIR)/vmm.o := CERRWARN += -_gcc=-Wno-pointer-sign -_gcc=-Wno-type-limits 110$(OBJS_DIR)/svm.o := CERRWARN += -_gcc=-Wno-pointer-sign -_gcc=-Wno-type-limits 111 112LDFLAGS += -z type=kmod -M $(MAPFILE) 113 114OFFSETS_VMX = $(CONF_SRCDIR)/intel/offsets.in 115OFFSETS_SVM = $(CONF_SRCDIR)/amd/offsets.in 116ASSYM_VMX = $(OBJS_DIR)/vmx_assym.h 117ASSYM_SVM = $(OBJS_DIR)/svm_assym.h 118ASSYM_H = $(ASSYM_VMX) $(ASSYM_SVM) 119 120CLEANFILES += $(ASSYM_H) 121 122# 123# Default build targets. 124# 125.KEEP_STATE: 126 127def: $(DEF_DEPS) 128 129all: $(ALL_DEPS) 130 131clean: $(CLEAN_DEPS) 132 133clobber: $(CLOBBER_DEPS) 134 135lint: $(LINT_DEPS) 136 137modlintlib: $(MODLINTLIB_DEPS) 138 139clean.lint: $(CLEAN_LINT_DEPS) 140 141install: $(INSTALL_DEPS) 142 143# 144# Include common targets. 145# 146include $(UTSBASE)/i86pc/Makefile.targ 147 148$(ASSYM_VMX): $(OFFSETS_VMX) $(GENASSYM) 149 $(OFFSETS_CREATE) -I../../i86pc/io/vmm < $(OFFSETS_VMX) >$@ 150$(ASSYM_SVM): $(OFFSETS_SVM) $(GENASSYM) 151 $(OFFSETS_CREATE) -I../../i86pc/io/vmm < $(OFFSETS_SVM) >$@ 152 153$(OBJS_DIR)/vmx_support.o: $(ASSYM_VMX) 154$(OBJS_DIR)/svm_support.o: $(ASSYM_SVM) 155