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) 2012 by Delphix. All rights reserved.
14# Copyright 2014 Garrett D'Amore <garrett@damore.org>
15# Copyright 2020 Tintri by DDN, Inc. All rights reserved.
16#
17
18include $(SRC)/Makefile.master
19include $(SRC)/cmd/Makefile.cmd
20include $(SRC)/test/Makefile.com
21
22#
23# Note: NDR currently is only supported in 32-bit programs.
24#
25OBJS = $(PROG).o util_common.o
26SRCS = $(PROG).c $(TESTCOMMONDIR)/util_common.c
27
28CSTD = $(CSTD_GNU99)
29CPPFLAGS += -I$(TESTCOMMONDIR)
30
31ROOTOPTPKG = $(ROOT)/opt/libmlrpc-tests
32TESTDIR = $(ROOTOPTPKG)/tests/$(TESTSUBDIR)
33
34CMDS = $(PROG:%=$(TESTDIR)/%) $(KSHPROG:%=$(TESTDIR)/%)
35$(CMDS) := FILEMODE = 0555
36
37BINS = $(BINFILES:%=$(TESTDIR)/%)
38$(BINS) := FILEMODE = 0444
39
40all: $(PROG) $(KSHPROG) $(SUBDIRS)
41
42$(PROG): $(OBJS)
43	$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
44	$(POST_PROCESS)
45
46$(KSHPROG): $(KSHPROG).ksh
47	$(RM) $@
48	$(CP) $(KSHPROG).ksh $(@)
49	$(CHMOD) +x $@
50
51%.o: %.c
52	$(COMPILE.c) -o $@ $(CFLAGS_$(MACH)) $<
53
54%.o: $(TESTCOMMONDIR)/%.c
55	$(COMPILE.c) -o $@ $(CFLAGS_$(MACH)) $<
56
57install: $(SUBDIRS) $(CMDS) $(BINS)
58
59lint: lint_SRCS
60
61clobber: clean
62	-$(RM) $(PROG) $(KSHPROG)
63
64clean:
65	-$(RM) $(OBJS)
66
67$(CMDS): $(TESTDIR) $(PROG) $(KSHPROG)
68
69$(BINS): $(TESTDIR)
70
71$(TESTDIR):
72	$(INS.dir)
73
74$(TESTDIR)/%: %
75	$(INS.file)
76