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