xref: /illumos-gate/usr/src/test/util-tests/tests/smbios/Makefile (revision 1d111dc8a7b0c978fa8cafbedf00eefa9768061e)
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 2025 Oxide Computer Company
15#
16
17include $(SRC)/Makefile.master
18
19ROOTOPTPKG = $(ROOT)/opt/util-tests
20TESTDIR = $(ROOTOPTPKG)/tests/
21
22SRCS =	smbios.c \
23	smbios_test_addinfo.c \
24	smbios_test_chassis.c \
25	smbios_test_errors.c \
26	smbios_test_extmemdevice.c \
27	smbios_test_fwinfo.c \
28	smbios_test_memdevice.c \
29	smbios_test_mgmtdev.c \
30	smbios_test_proc.c \
31	smbios_test_pinfo.c \
32	smbios_test_slot.c \
33	smbios_test_strings.c \
34	smbios_test_strprop.c \
35	smbios_test_tpm.c
36PROGS = smbios
37
38PROGS32 = $(PROGS:%=%.32)
39PROGS64 = $(PROGS:%=%.64)
40
41OBJS32 = $(SRCS:%.c=%.32.o)
42OBJS64 = $(SRCS:%.c=%.64.o)
43
44include $(SRC)/cmd/Makefile.cmd
45include $(SRC)/cmd/Makefile.ctf
46include $(SRC)/test/Makefile.com
47
48CMDS = $(PROGS32:%=$(TESTDIR)/%) $(PROGS64:%=$(TESTDIR)/%)
49$(CMDS) := FILEMODE = 0555
50CSTD = $(CSTD_GNU17)
51CTF_MODE = link
52
53#
54# Since this program uses quite a number of variables declared on the
55# stack that are then written to by libsmbios, we opt to pay the cost
56# of always have the stack protector on every function as an additional
57# means of checking ourselves.
58#
59STACKPROTECT = all
60
61LDLIBS += -lsmbios -lumem
62LDLIBS64 += -lsmbios -lumem
63CFLAGS += -_gcc=-Wall -_gcc=-Wextra -_gcc=-Wno-unknown-pragmas
64CFLAGS64 += -_gcc=-Wall -_gcc=-Wextra -_gcc=-Wno-unknown-pragmas
65
66all: $(PROGS32) $(PROGS64)
67
68install: all $(CMDS)
69
70clobber: clean
71	-$(RM) $(PROGS32) $(PROGS64)
72
73clean:
74	-$(RM) $(OBJS32) $(OBJS64)
75
76$(CMDS): $(TESTDIR) $(PROGS32) $(PROGS64)
77
78$(TESTDIR):
79	$(INS.dir)
80
81$(TESTDIR)/%: %
82	$(INS.file)
83
84%.32.o: %.c
85	$(COMPILE.c) -o $@ $<
86	$(POST_PROCESS_O)
87
88%.64.o: %.c
89	$(COMPILE64.c) -o $@ $<
90	$(POST_PROCESS_O)
91
92
93$(PROGS32): $(OBJS32)
94	$(LINK.c) -o $@ $(OBJS32) $(LDLIBS)
95	$(POST_PROCESS)
96
97$(PROGS64): $(OBJS64)
98	$(LINK64.c) -o $@ $(OBJS64) $(LDLIBS64)
99	$(POST_PROCESS)
100