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
44SCRIPTS = libsff
45
46include $(SRC)/cmd/Makefile.cmd
47include $(SRC)/test/Makefile.com
48
49CMDS = $(PROGS:%=$(TESTDIR)/%) $(SCRIPTS:%=$(TESTDIR)/%)
50OUTFILES = $(DIFF_PROGS:%=$(TESTDIR)/%.out)
51$(CMDS) := FILEMODE = 0555
52$(OUTFILES) := FILEMODE = 0444
53
54CPPFLAGS += -I$(SRC)/lib/libsff/common
55
56#
57# Different tests require different sets of libraries. If we try and use
58# the same set, we'll get guidance errors from ld.
59#
60$(ERR_PROGS)	:= LDLIBS += -lsff
61$(DIFF_PROGS)	:= LDLIBS += -lsff -lnvpair
62libsff_strings	:= LDLIBS += -lsff -lnvpair
63$(ERR_PROGS).ln	:= LDLIBS += -lsff
64$(DIFF_PROGS).ln	:= LDLIBS += -lsff -lnvpair
65libsff_strings.ln	:= LDLIBS += -lsff -lnvpair
66
67all: $(PROGS)
68
69install: all $(CMDS) $(OUTFILES)
70
71clobber: clean
72	-$(RM) $(PROGS)
73
74clean:
75
76$(CMDS): $(TESTDIR) $(PROG)
77
78$(TESTDIR):
79	$(INS.dir)
80
81$(TESTDIR)/%: %
82	$(INS.file)
83
84$(TESTDIR)/%: %.ksh
85	$(INS.rename)
86
87%: %.c
88	$(LINK.c) -o $@ $< $(LDLIBS)
89	$(POST_PROCESS)
90