xref: /illumos-gate/usr/src/test/bhyve-tests/tests/inst_emul/Makefile (revision 578d9a563f6dc0f4f8a56447931b36db474172da)
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 2022 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	triple_fault \
21	cpuid
22
23# C-based payloads need additional utils object
24CPAYLOADS =	cpuid
25
26PAYLOADS = $(PROG)
27include ../Makefile.in_guest
28
29COMMON_OBJS =	in_guest.o
30
31CLEANFILES =	$(COMMON_OBJS) $(PAYLOAD_CLEANFILES) payload_utils.o
32CLOBBERFILES =	$(PROG)
33
34ROOTOPTPKG = $(ROOT)/opt/bhyve-tests
35TESTDIR = $(ROOTOPTPKG)/tests/inst_emul
36
37CMDS = $(PROG:%=$(TESTDIR)/%)
38$(CMDS) := FILEMODE = 0555
39
40CSTD=		$(CSTD_GNU99)
41CPPFLAGS =	-I$(COMPAT)/bhyve -I$(CONTRIB)/bhyve \
42		-I$(COMPAT)/bhyve/amd64 -I$(CONTRIB)/bhyve/amd64 \
43		$(CPPFLAGS.master) \
44		-I$(SRC)/uts/intel/io/vmm \
45		-I$(SRC)/uts/intel \
46		-I../common
47
48ASFLAGS += -P -D__STDC__ -D_ASM
49
50
51$(PROG) :=	LDLIBS += -lvmmapi
52
53all: $(PROG)
54
55install: all $(CMDS)
56
57clean:
58	-$(RM) $(CLEANFILES)
59clobber: clean
60	-$(RM) $(CLOBBERFILES)
61
62$(CMDS): $(TESTDIR) $(PROG)
63
64$(TESTDIR):
65	$(INS.dir)
66
67$(TESTDIR)/%: %
68	$(INS.file)
69
70%: %.c pobj_%.o $(COMMON_OBJS)
71	$(LINK.c) -o $@ $^ $(LDLIBS)
72	$(POST_PROCESS)
73
74%: %.o
75	$(LINK.c) -o $@ $^ $(LDLIBS)
76	$(POST_PROCESS)
77
78$(CPAYLOADS:%=payload_%): payload_utils.o
79