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