xref: /illumos-gate/usr/src/test/bhyve-tests/tests/inst_emul/Makefile (revision bb9475a199514dcace79d04d02c1eff05d65b94f)
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# Copyright 2024 Oxide Computer Company
13
14include $(SRC)/cmd/Makefile.cmd
15include $(SRC)/cmd/Makefile.cmd.64
16include $(SRC)/test/Makefile.com
17
18PROG =	rdmsr \
19	wrmsr \
20	imul \
21	cpuid \
22	inout
23
24# These should probably go in the `vmm` tests, but since they depend on
25# in-guest payloads, it is easier to build them here.
26PROG +=	triple_fault \
27	exit_paging \
28	page_dirty \
29	exit_consistent \
30	suspend_info \
31	vcpu_barrier
32
33# C-based payloads need additional utils object
34CPAYLOADS =	cpuid \
35		suspend_info
36
37PAYLOADS = $(PROG)
38include ../Makefile.in_guest
39
40COMMON_OBJS =	in_guest.o common.o
41
42CLEANFILES =	$(COMMON_OBJS) $(PAYLOAD_CLEANFILES) payload_utils.o
43CLOBBERFILES =	$(PROG)
44
45ROOTOPTPKG = $(ROOT)/opt/bhyve-tests
46TESTDIR = $(ROOTOPTPKG)/tests/inst_emul
47
48CMDS = $(PROG:%=$(TESTDIR)/%)
49$(CMDS) := FILEMODE = 0555
50
51CSTD=		$(CSTD_GNU99)
52CPPFLAGS =	-I$(COMPAT)/bhyve -I$(CONTRIB)/bhyve \
53		-I$(COMPAT)/bhyve/amd64 -I$(CONTRIB)/bhyve/amd64 \
54		$(CPPFLAGS.master) \
55		-I$(SRC)/uts/intel/io/vmm \
56		-I$(SRC)/uts/intel \
57		-I../common
58
59ASFLAGS +=	-D_ASM
60ASFLAGS64 +=	-D_ASM
61
62$(PROG) :=	LDLIBS += -lvmmapi
63
64all: $(PROG)
65
66install: all $(CMDS)
67
68clean:
69	-$(RM) $(CLEANFILES)
70clobber: clean
71	-$(RM) $(CLOBBERFILES)
72
73$(CMDS): $(TESTDIR) $(PROG)
74
75$(TESTDIR):
76	$(INS.dir)
77
78$(TESTDIR)/%: %
79	$(INS.file)
80
81%: %.c pobj_%.o $(COMMON_OBJS)
82	$(LINK.c) -o $@ $^ $(LDLIBS)
83	$(POST_PROCESS)
84
85%: %.o
86	$(LINK.c) -o $@ $^ $(LDLIBS)
87	$(POST_PROCESS)
88
89$(CPAYLOADS:%=payload_%): payload_utils.o
90