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