xref: /illumos-gate/usr/src/test/nvme-tests/Makefile.com (revision aaceae985c2e78cadef76bf0b7b50ed887ccb3a6)
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 2024 Oxide Computer Company
14#
15
16#
17# Common Makefile rules and patterns for building the various NVMe
18# tests.
19#
20
21PROGS32 = $(PROGS:%=%.32)
22PROGS64 = $(PROGS:%=%.64)
23
24EXTRA_OBJS32 = $(COMMON_SRCS:%.c=%.o.32)
25EXTRA_OBJS64 = $(COMMON_SRCS:%.c=%.o.64)
26
27ROOTOPTDIR = $(ROOT)/opt/nvme-tests
28ROOTOPTTESTS = $(ROOTOPTDIR)/tests
29ROOTOPTTARG = $(ROOTOPTTESTS)/$(TESTDIR)
30ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTTARG)/%) $(PROGS64:%=$(ROOTOPTTARG)/%)
31ROOTOPTPROGS += $(SCRIPTS:%=$(ROOTOPTTARG)/%)
32
33include $(SRC)/cmd/Makefile.cmd
34include $(SRC)/cmd/Makefile.ctf
35
36CPPFLAGS += -D_REENTRANT
37CSTD = $(CSTD_GNU99)
38CTF_MODE = link
39
40.KEEP_STATE:
41
42all: $(PROGS32) $(PROGS64)
43
44clobber: clean
45	-$(RM) $(PROGS32) $(PROGS64)
46
47clean:
48	-$(RM) *.o.32 *.o.64
49
50install: $(ROOTOPTTARG) .WAIT $(ROOTOPTPROGS)
51
52$(ROOTOPTDIR):
53	$(INS.dir)
54
55$(ROOTOPTTESTS): $(ROOTOPTDIR)
56	$(INS.dir)
57
58$(ROOTOPTTARG): $(ROOTOPTTESTS)
59	$(INS.dir)
60
61$(ROOTOPTTARG)/%: %
62	$(INS.file)
63
64$(ROOTOPTTARG)/%: %.ksh
65	$(INS.rename)
66
67%.o.32: %.c
68	$(COMPILE.c) -o $@ -c $<
69	$(POST_PROCESS_O)
70
71%.o.64: %.c
72	$(COMPILE64.c) -o $@ -c $<
73	$(POST_PROCESS_O)
74
75%.o.32: $(SRC)/common/nvme/%.c
76	$(COMPILE.c) -o $@ -c $<
77	$(POST_PROCESS_O)
78
79%.o.64: $(SRC)/common/nvme/%.c
80	$(COMPILE64.c) -o $@ -c $<
81	$(POST_PROCESS_O)
82
83%.64: %.o.64 $(EXTRA_OBJS64)
84	$(LINK64.c) -o $@ $< $(EXTRA_OBJS64) $(LDLIBS64)
85	$(POST_PROCESS)
86
87%.32: %.o.32 $(EXTRA_OBJS32)
88	$(LINK.c) -o $@ $< $(EXTRA_OBJS32) $(LDLIBS)
89	$(POST_PROCESS)
90