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 SCRIPTS = libsff
  45 
  46 include $(SRC)/cmd/Makefile.cmd
  47 include $(SRC)/test/Makefile.com
  48 
  49 CMDS = $(PROGS:%=$(TESTDIR)/%) $(SCRIPTS:%=$(TESTDIR)/%)
  50 OUTFILES = $(DIFF_PROGS:%=$(TESTDIR)/%.out)
  51 $(CMDS) := FILEMODE = 0555
  52 $(OUTFILES) := FILEMODE = 0444
  53 
  54 CPPFLAGS += -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
  62 libsff_strings  := LDLIBS += -lsff -lnvpair
  63 
  64 all: $(PROGS)
  65 
  66 install: all $(CMDS) $(OUTFILES)
  67 
  68 lint: lint_SRCS
  69 
  70 clobber: clean
  71         -$(RM) $(PROGS)
  72 
  73 clean:
  74 
  75 $(CMDS): $(TESTDIR) $(PROG)
  76 
  77 $(TESTDIR):
  78         $(INS.dir)
  79 
  80 $(TESTDIR)/%: %
  81         $(INS.file)
  82 
  83 $(TESTDIR)/%: %.ksh
  84         $(INS.rename)
  85 
  86 %: %.c
  87         $(LINK.c) -o $@ $< $(LDLIBS)
  88         $(POST_PROCESS)