xref: /illumos-gate/usr/src/test/util-tests/tests/libsff/Makefile (revision 8a2b682e57a046b828f37bcde1776f131ef4629f)
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) 2017, Joyent, Inc.
14#
15
16include $(SRC)/Makefile.master
17
18ROOTOPTPKG = $(ROOT)/opt/util-tests
19TESTDIR = $(ROOTOPTPKG)/tests/libsff
20
21DIFF_PROGS = \
22	libsff_8472 \
23	libsff_8636_diag \
24	libsff_8636_extspec \
25	libsff_8636_tech \
26	libsff_8636_temp \
27	libsff_br \
28	libsff_conn \
29	libsff_compliance \
30	libsff_enc \
31	libsff_ident \
32	libsff_lengths \
33	libsff_opts \
34	libsff_wave
35
36ERR_PROGS = \
37	libsff_efault \
38	libsff_einval
39
40PROGS = $(DIFF_PROGS) \
41	$(ERR_PROGS) \
42	libsff_strings
43
44LINTS = $(PROGS:%=%.ln)
45
46SCRIPTS = libsff
47
48include $(SRC)/cmd/Makefile.cmd
49include $(SRC)/test/Makefile.com
50
51CMDS = $(PROGS:%=$(TESTDIR)/%) $(SCRIPTS:%=$(TESTDIR)/%)
52OUTFILES = $(DIFF_PROGS:%=$(TESTDIR)/%.out)
53$(CMDS) := FILEMODE = 0555
54$(OUTFILES) := FILEMODE = 0444
55
56CPPFLAGS += -I$(SRC)/lib/libsff/common
57
58#
59# Different tests require different sets of libraries. If we try and use
60# the same set, we'll get guidance errors from ld.
61#
62$(ERR_PROGS)	:= LDLIBS += -lsff
63$(DIFF_PROGS)	:= LDLIBS += -lsff -lnvpair
64libsff_strings	:= LDLIBS += -lsff -lnvpair
65$(ERR_PROGS).ln	:= LDLIBS += -lsff
66$(DIFF_PROGS).ln	:= LDLIBS += -lsff -lnvpair
67libsff_strings.ln	:= LDLIBS += -lsff -lnvpair
68
69all: $(PROGS)
70
71install: all $(CMDS) $(OUTFILES)
72
73lint: $(LINTS)
74
75%.ln: %.c
76	$(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 $< $(LDLIBS)
77
78clobber: clean
79	-$(RM) $(PROGS) $(LINTS)
80
81clean:
82
83$(CMDS): $(TESTDIR) $(PROG)
84
85$(TESTDIR):
86	$(INS.dir)
87
88$(TESTDIR)/%: %
89	$(INS.file)
90
91$(TESTDIR)/%: %.ksh
92	$(INS.rename)
93
94%: %.c
95	$(LINK.c) -o $@ $< $(LDLIBS)
96	$(POST_PROCESS)
97