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