xref: /illumos-gate/usr/src/test/os-tests/tests/xsave/Makefile (revision f37b3cbb6f67aaea5eec1c335bdc7bf432867d64)
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#
13# Copyright 2023 Oxide Computer Company
14#
15
16PROGS = \
17	bad_xregs \
18	fpregs \
19	fpregs_xbv \
20	proc_xregs_set \
21	setcontext_replace \
22	setcontext_restore \
23	swapcontext_extd \
24	signal_restore \
25	xregs_dump \
26	xregs_roundtrip \
27	xregs_set \
28	xsave_baducontext \
29	xsu_hwtype
30
31SCRIPTS = mdb_xregs proc_writes xsave_baducontext
32
33DATAFILES = \
34	mdb_xregs.ymm.32 \
35	mdb_xregs.ymm.64 \
36	mdb_xregs.zmm.32 \
37	mdb_xregs.zmm.64 \
38	proc_writes.fpregs.ymm.32 \
39	proc_writes.fpregs.ymm.64 \
40	proc_writes.fpregs.zmm.32 \
41	proc_writes.fpregs.zmm.64 \
42	proc_writes.xregs.ymm.32 \
43	proc_writes.xregs.ymm.64 \
44	proc_writes.xregs.zmm.32 \
45	proc_writes.xregs.zmm.64
46
47PROGS32 = $(PROGS:%=%.32)
48PROGS64 = $(PROGS:%=%.64)
49
50ROOTOPTDIR = $(ROOT)/opt/os-tests/tests
51ROOTOPTXSAVE = $(ROOTOPTDIR)/xsave
52ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTXSAVE)/%) \
53	$(PROGS64:%=$(ROOTOPTXSAVE)/%) \
54	$(SCRIPTS:%=$(ROOTOPTXSAVE)/%)
55ROOTOPTDATADIR = $(ROOTOPTXSAVE)/data
56ROOTOPTDATA = $(DATAFILES:%=$(ROOTOPTDATADIR)/%)
57
58COMMOBJS32 = xsave_util.32.o xsave_asm32.32.o
59COMMOBJS64 = xsave_util.64.o xsave_asm64.64.o
60
61OBJS32 = $(COMMOBJS32) $(PROGS:%=%.32.o)
62OBJS64 = $(COMMOBJS64) $(PROGS:%=%.64.o)
63
64#
65# To simplify things we always link in the support files to programs
66# even though in some case (e.g. xsave_baducontext) they aren't needed.
67# This also drives a requirement that everything links against libproc
68# (seen below).
69#
70EXTRA_OBJS32 = $(COMMOBJS32)
71EXTRA_OBJS64 = $(COMMOBJS64)
72
73include $(SRC)/cmd/Makefile.cmd
74
75#
76# These are required to get COMPILE.s to work as Makefile.master puts
77# some things in AS_CPPFLAGS, but not what we need to make it work.
78#
79AS_CPPFLAGS += -D_ASM
80
81$(ROOTOPTDATA) := FILEMODE = 0444
82
83LDLIBS += -lproc
84LDLIBS64 += -lproc
85
86CSTD = $(GNU_C99)
87
88.KEEP_STATE:
89
90all: $(PROGS32) $(PROGS64)
91
92install: $(ROOTOPTPROGS) $(ROOTOPTDATA)
93
94clean:
95	$(RM) $(OBJS32) $(OBJS64)
96
97$(PROGS32): $(OBJS32)
98$(PROGS64): $(OBJS64)
99
100$(ROOTOPTPROGS): $(PROGS32) $(PROGS64) $(ROOTOPTXSAVE)
101$(ROOTOPTDATA): $(ROOTOPTDATADIR)
102
103$(ROOTOPTDIR):
104	$(INS.dir)
105
106$(ROOTOPTXSAVE): $(ROOTOPTDIR)
107	$(INS.dir)
108
109$(ROOTOPTDATADIR): $(ROOTOPTXSAVE)
110	$(INS.dir)
111
112$(ROOTOPTXSAVE)/%: %
113	$(INS.file)
114
115$(ROOTOPTXSAVE)/%: %.ksh
116	$(INS.rename)
117
118%.32.o: %.c
119	$(COMPILE.c) -o $@ $<
120	$(POST_PROCESS_O)
121
122%.64.o: %.c
123	$(COMPILE64.c) -o $@ $<
124	$(POST_PROCESS_O)
125
126%.32.o: %.S
127	$(COMPILE.s) -o $@ $<
128	$(POST_PROCESS_S_0)
129
130%.64.o: %.S
131	$(COMPILE64.s) -o $@ $<
132	$(POST_PROCESS_S_0)
133
134%.64: %.64.o
135	$(LINK64.c) -o $@ $< $(LDLIBS64) $(EXTRA_OBJS64)
136	$(POST_PROCESS)
137
138%.32: %.32.o
139	$(LINK.c) -o $@ $< $(LDLIBS) $(EXTRA_OBJS32)
140	$(POST_PROCESS)
141
142clobber: clean
143	$(RM) $(PROGS32) $(PROGS64)
144
145FRC:
146