xref: /illumos-gate/usr/src/test/bhyve-tests/tests/kdev/Makefile (revision b8052df9f609edb713f6828c9eecc3d7be19dfb3)
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 =	vpmtmr_freq \
19	vhpet_freq \
20	vlapic_freq \
21	vlapic_freq_periodic \
22	vlapic_mmio_access \
23	vlapic_msr_access \
24	vatpit_freq
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/kdev
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
51CFLAGS = -m64
52$(PROG) :=	LDLIBS += -lvmmapi
53
54all: $(PROG)
55
56install: all $(CMDS)
57
58clean:
59	-$(RM) $(CLEANFILES)
60clobber: clean
61	-$(RM) $(CLOBBERFILES)
62
63$(CMDS): $(TESTDIR) $(PROG)
64
65$(TESTDIR):
66	$(INS.dir)
67
68$(TESTDIR)/%: %
69	$(INS.file)
70
71%: %.c pobj_%.o $(COMMON_OBJS)
72	$(LINK.c) -o $@ $^ $(LDLIBS)
73	$(POST_PROCESS)
74
75%: %.o
76	$(LINK.c) -o $@ $^ $(LDLIBS)
77	$(POST_PROCESS)
78
79$(PAYLOADS:%=payload_%): payload_utils.o
80