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