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 2019 Joyent, Inc.
  14 #
  15 
  16 include $(SRC)/Makefile.master
  17 
  18 ROOTOPTPKG = $(ROOT)/opt/util-tests
  19 TESTDIR = $(ROOTOPTPKG)/tests/libnvpair_json
  20 ROOTBINDIR = $(ROOTOPTPKG)/bin
  21 
  22 PROG = print_json
  23 
  24 SCRIPTS = \
  25         json_00_blank \
  26         json_01_boolean \
  27         json_02_numbers \
  28         json_03_empty_arrays \
  29         json_04_number_arrays \
  30         json_05_strings \
  31         json_06_nested \
  32         json_07_nested_arrays \
  33         json_common
  34 
  35 include $(SRC)/cmd/Makefile.cmd
  36 include $(SRC)/test/Makefile.com
  37 
  38 OBJS = $(PROG:%=%.o)
  39 SRCS = $(OBJS:%.o=%.c)
  40 
  41 CMDS = $(PROG:%=$(ROOTBINDIR)/%) $(SCRIPTS:%=$(TESTDIR)/%)
  42 $(CMDS) := FILEMODE = 0555
  43 
  44 LDLIBS += -lnvpair
  45 
  46 # intentional abort()
  47 SMOFF += unreachable
  48 
  49 all: $(PROG)
  50 
  51 $(PROG): $(OBJS)
  52         $(LINK.c) $(OBJS) -o $@ $(LDLIBS)
  53         $(POST_PROCESS)
  54 
  55 install: all $(CMDS)
  56 
  57 lint: lint_SRCS
  58 
  59 clobber: clean
  60         -$(RM) $(PROG)
  61 
  62 clean:
  63         -$(RM) $(OBJS)
  64 
  65 $(CMDS): $(TESTDIR) $(PROG)
  66 
  67 $(ROOTBINDIR):
  68         $(INS.dir)
  69 
  70 $(ROOTBINDIR)/%: %
  71         $(INS.file)
  72 
  73 $(TESTDIR):
  74         $(INS.dir)
  75 
  76 $(TESTDIR)/%: %.ksh
  77         $(INS.rename)