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
16 include $(SRC)/Makefile.master
17
18 ROOTOPTPKG = $(ROOT)/opt/util-tests
19 TESTDIR = $(ROOTOPTPKG)/tests/libsff
20
21 DIFF_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
36 ERR_PROGS = \
37 libsff_efault \
38 libsff_einval
39
40 PROGS = $(DIFF_PROGS) \
41 $(ERR_PROGS) \
42 libsff_strings
43
44 LINTS = $(PROGS:%=%.ln)
45
46 SCRIPTS = libsff
47
48 include $(SRC)/cmd/Makefile.cmd
49 include $(SRC)/test/Makefile.com
50
51 CMDS = $(PROGS:%=$(TESTDIR)/%) $(SCRIPTS:%=$(TESTDIR)/%)
52 OUTFILES = $(DIFF_PROGS:%=$(TESTDIR)/%.out)
53 $(CMDS) := FILEMODE = 0555
54 $(OUTFILES) := FILEMODE = 0444
55
56 CPPFLAGS += -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
64 libsff_strings := LDLIBS += -lsff -lnvpair
65 $(ERR_PROGS).ln := LDLIBS += -lsff
66 $(DIFF_PROGS).ln := LDLIBS += -lsff -lnvpair
67 libsff_strings.ln := LDLIBS += -lsff -lnvpair
68
69 all: $(PROGS)
70
71 install: all $(CMDS) $(OUTFILES)
72
73 lint: $(LINTS)
74
75 %.ln: %.c
76 $(LINT.c) -erroff=E_NAME_USED_NOT_DEF2 $< $(LDLIBS)
77
78 clobber: clean
79 -$(RM) $(PROGS) $(LINTS)
80
81 clean:
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)