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 (c) 2018, Joyent, Inc.
14# Copyright 2023 Oxide Computer Company
15#
16
17include $(SRC)/Makefile.master
18
19ROOTOPTPKG = $(ROOT)/opt/util-tests
20TESTDIR = $(ROOTOPTPKG)/tests/
21
22PROGS = libjedec_test libjedec_temp libjedec_spd
23PROGS32 = $(PROGS:%=%.32)
24PROGS64 = $(PROGS:%=%.64)
25
26ROOTOPTPROGS = $(PROGS32:%=$(TESTDIR)/%) \
27	$(PROGS64:%=$(TESTDIR)/%)
28
29include $(SRC)/cmd/Makefile.cmd
30include $(SRC)/test/Makefile.com
31
32CMDS = $(PROGS:%=$(TESTDIR)/%)
33$(CMDS) := FILEMODE = 0555
34
35LDLIBS += -ljedec
36LDLIBS64 += -ljedec
37libjedec_spd.32	:= LDLIBS += -lnvpair
38libjedec_spd.64	:= LDLIBS64 += -lnvpair
39CSTD = $(GNU_C99)
40
41all: $(PROGS32) $(PROGS64)
42
43$(ROOTOPTPROGS): all
44
45install: all $(ROOTOPTPROGS)
46
47clobber: clean
48	-$(RM) $(PROGS32) $(PGROGS64)
49
50clean:
51
52$(CMDS): $(TESTDIR) $(PROG)
53
54$(TESTDIR):
55	$(INS.dir)
56
57$(TESTDIR)/%: %
58	$(INS.file)
59
60%.64: %.c
61	$(LINK64.c) -o $@ $< $(LDLIBS64)
62	$(POST_PROCESS)
63
64%.32: %.c
65	$(LINK.c) -o $@ $< $(LDLIBS)
66	$(POST_PROCESS)
67