xref: /illumos-gate/usr/src/test/util-tests/tests/libjedec/hex2spd/Makefile (revision bf05540c1d1b319d8e1d40f0e2fd9e84c5d2389e)
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
16PROGS = libjedec_hex2spd
17OBJS = \
18	libjedec_hex2spd.o	\
19	libjedec_hex2spd_ddr3.o	\
20	libjedec_hex2spd_ddr4.o	\
21	libjedec_hex2spd_ddr5.o	\
22	libjedec_hex2spd_lp3.o	\
23	libjedec_hex2spd_lp4.o	\
24	libjedec_hex2spd_lp5.o
25SPD = \
26	ddr3/M393B4G70BM0-CMA09.spd		\
27	ddr3/MT36KSZF2G72LDZ-1G6E2A7.spd	\
28	ddr4/36ASF8G72PZ-3G2E1.spd		\
29	ddr4/AQD-D4U32N32-SBW.spd		\
30	ddr4/AQD-SD4U16GN32-SE1.spd		\
31	ddr4/M386AAK40B40-CWD70.spd		\
32	ddr5/AQD-D5V16GR48-SB.spd		\
33	ddr5/MTC40F2046S1RC48BA1.spd		\
34	lpddr3/NT6CL256T32CQ.spd		\
35	lpddr4/MT53D1024M32D4.spd		\
36	lpddr5/CAMM2.spd			\
37	lpddr5/MT62F4G32D8DV-023.spd
38SPDDIR = ddr3 ddr4 ddr5 lpddr3 lpddr4 lpddr5
39
40PROGS32 = $(PROGS:%=%.32)
41PROGS64 = $(PROGS:%=%.64)
42OBJS32 = $(OBJS:%.o=%.32.o)
43OBJS64 = $(OBJS:%.o=%.64.o)
44
45ROOTOPTDIR = $(ROOT)/opt/util-tests/tests
46ROOTOPTPROGS = $(PROGS32:%=$(ROOTOPTDIR)/%) $(PROGS64:%=$(ROOTOPTDIR)/%)
47ROOTOPTHEX = $(ROOTOPTDIR)/hex2spd
48ROOTHEXDIRS = $(SPDDIR:%=$(ROOTOPTHEX)/%)
49ROOTHEXSPD = $(SPD:%=$(ROOTOPTHEX)/%)
50
51$(ROOTOPTPROGS) := FILEMODE = 0555
52$(ROOTHEXSPD) := FILEMODE = 0444
53
54include $(SRC)/cmd/Makefile.cmd
55include $(SRC)/cmd/Makefile.ctf
56
57CSTD = $(GNU_C99)
58CTF_MODE = link
59LDLIBS += -ljedec -lnvpair
60LDLIBS64 += -ljedec -lnvpair
61
62.KEEP_STATE:
63
64all: $(PROGS32) $(PROGS64)
65
66install: $(ROOTOPTPROGS) $(ROOTHEXSPD)
67
68clean:
69	$(RM) *.o
70
71clobber: clean
72	$(RM) $(PROGS32) $(PROGS64)
73
74$(ROOTOPTPROGS): $(ROOTOPTHEX)
75
76$(ROOTHEXSPD): $(ROOTHEXDIRS)
77
78$(ROOTOPTHEX):
79	$(INS.dir)
80
81$(ROOTHEXDIRS): $(ROOTOPTHEX)
82	$(INS.dir)
83
84$(ROOTOPTDIR)/%: %
85	$(INS.file)
86
87$(ROOTOPTHEX)/%: data/%
88	$(INS.file)
89
90%.32.o: %.c
91	$(COMPILE.c) -o $@ $<
92	$(POST_PROCESS_O)
93
94%.64.o: %.c
95	$(COMPILE64.c) -o $@ $<
96	$(POST_PROCESS_O)
97
98%.64: $(OBJS64)
99	$(LINK64.c) -o $@ $(OBJS64) $(LDLIBS64)
100	$(POST_PROCESS)
101
102%.32: $(OBJS32)
103	$(LINK.c) -o $@ $(OBJS32) $(LDLIBS)
104	$(POST_PROCESS)
105