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 =	mem_partial \
19	mem_seg_map \
20	mem_devmem \
21	fpu_getset
22
23COMMON_OBJS =	common.o
24CLEAN_OBJS =	$(PROG:%=%.o)
25
26ROOTOPTPKG = $(ROOT)/opt/bhyve-tests
27TESTDIR = $(ROOTOPTPKG)/tests/vmm
28
29CMDS = $(PROG:%=$(TESTDIR)/%)
30$(CMDS) := FILEMODE = 0555
31
32CSTD=		$(CSTD_GNU99)
33CPPFLAGS =	-I$(COMPAT)/bhyve -I$(CONTRIB)/bhyve \
34		-I$(COMPAT)/bhyve/amd64 -I$(CONTRIB)/bhyve/amd64 \
35		$(CPPFLAGS.master) \
36		-I$(SRC)/uts/i86pc/io/vmm \
37		-I$(SRC)/uts/i86pc
38$(PROG) :=	LDLIBS += -lvmmapi
39
40all: $(PROG)
41
42install: all $(CMDS)
43
44clean:
45	-$(RM) $(CLEAN_OBJS) $(COMMON_OBJS)
46clobber: clean
47	-$(RM) $(PROG)
48
49$(PROG): $(COMMON_OBJS)
50
51$(CMDS): $(TESTDIR) $(PROG)
52
53$(TESTDIR):
54	$(INS.dir)
55
56$(TESTDIR)/%: %
57	$(INS.file)
58
59%: %.o
60	$(LINK.c) -o $@ $< $(COMMON_OBJS) $(LDLIBS)
61	$(POST_PROCESS)
62