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
16include $(SRC)/Makefile.master
17
18ROOTOPTPKG = $(ROOT)/opt/util-tests
19TESTDIR = $(ROOTOPTPKG)/tests/libnvpair_json
20ROOTBINDIR = $(ROOTOPTPKG)/bin
21
22PROG = print_json
23
24SCRIPTS = \
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
35include $(SRC)/cmd/Makefile.cmd
36include $(SRC)/test/Makefile.com
37
38OBJS = $(PROG:%=%.o)
39SRCS = $(OBJS:%.o=%.c)
40
41CMDS = $(PROG:%=$(ROOTBINDIR)/%) $(SCRIPTS:%=$(TESTDIR)/%)
42$(CMDS) := FILEMODE = 0555
43
44LDLIBS += -lnvpair
45
46# intentional abort()
47SMOFF += unreachable
48
49all: $(PROG)
50
51$(PROG): $(OBJS)
52	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
53	$(POST_PROCESS)
54
55install: all $(CMDS)
56
57lint: lint_SRCS
58
59clobber: clean
60	-$(RM) $(PROG)
61
62clean:
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)
78