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