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