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) 2016 by Delphix. All rights reserved.
14#
15
16include $(SRC)/cmd/Makefile.cmd
17
18ROOTOPTPKG = $(ROOT)/opt/zfs-tests
19TESTDIR = $(ROOTOPTPKG)/tests/functional/channel_program/lua_core
20
21KSHFILES :sh= ls *.ksh
22KSHPROGS = $(KSHFILES:%.ksh=%)
23SRCS :sh= ls *.c
24CPROGS = $(SRCS:%.c=%.exe)
25PROGS = $(KSHPROGS) $(CPROGS)
26FILES :sh= ls *.zcp *.out *.err
27LDLIBS =	$(LDLIBS.cmd)
28LDLIBS += -lzfs_core -lnvpair
29CSTD = $(CSTD_GNU99)
30
31INSTPROGS = $(PROGS:%=$(TESTDIR)/%)
32INSTFILES = $(FILES:%=$(TESTDIR)/%)
33
34OBJS = $(SRCS:%.c=%.o)
35
36$(INSTPROGS) := FILEMODE = 0555
37$(INSTFILES) := FILEMODE = 0444
38
39all lint: $(CPROGS)
40	echo SRCS: $(SRCS)
41	echo PROGS: $(PROGS)
42
43install: $(INSTPROGS) $(INSTFILES)
44
45$(INSTPROGS): $(TESTDIR)
46$(INSTFILES): $(TESTDIR)
47
48$(TESTDIR):
49	$(INS.dir)
50
51$(TESTDIR)/%: %.ksh
52	$(INS.rename)
53
54$(TESTDIR)/%: %
55	$(INS.file)
56
57%.o: ../%.c
58	$(COMPILE.c) $<
59
60%.exe: %.o
61	$(LINK.c) $< -o $@ $(LDLIBS)
62	$(POST_PROCESS)
63
64clobber: clean
65	-$(RM) $(PROGS)
66
67clean:
68	-$(RM) $(OBJS)
69