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) 2015 Joyent, Inc.
14#
15
16include $(SRC)/Makefile.master
17
18ROOTOPTPKG = $(ROOT)/opt/libc-tests
19TESTDIR = $(ROOTOPTPKG)/tests/random
20ROOTBINDIR = $(ROOTOPTPKG)/bin
21
22PROGS = arc4random 		\
23	arc4random_prefork 	\
24	arc4random_fork 	\
25	arc4random_preforkall 	\
26	arc4random_forkall 	\
27	arc4random_preforksig	\
28	arc4random_forksig	\
29	arc4random_rekey 	\
30	chacha 			\
31	getentropy 		\
32	getrandom 		\
33	getrandred		\
34	inz_child		\
35	inz_inval		\
36	inz_mlock		\
37	inz_region 		\
38	inz_split		\
39	inz_split_vpp		\
40	inz_vpp
41
42SCRIPTS = arc4key.ksh
43
44include $(SRC)/cmd/Makefile.cmd
45include $(SRC)/test/Makefile.com
46
47CMDS = $(PROGS:%=$(TESTDIR)/%) $(SCRIPTS:%=$(TESTDIR)/%)
48$(CMDS) := FILEMODE = 0555
49
50all: $(PROGS)
51
52install: all $(CMDS)
53
54lint:
55
56clobber: clean
57	-$(RM) $(PROGS)
58
59clean:
60	-$(RM) *.o
61
62$(CMDS): $(TESTDIR) $(PROGS)
63
64arc4random_prefork: arc4random_fork.c
65	$(LINK.c) -o $@ -DARC4_PREINIT=1 arc4random_fork.c $(LDLIBS)
66	$(POST_PROCESS)
67
68arc4random_preforkall: arc4random_forkall.c
69	$(LINK.c) -o $@ -DARC4_PREINIT=1 arc4random_forkall.c $(LDLIBS)
70	$(POST_PROCESS)
71
72arc4random_preforksig: arc4random_forksig.c
73	$(LINK.c) -o $@ -DARC4_PREINIT=1 arc4random_forksig.c $(LDLIBS)
74	$(POST_PROCESS)
75
76chacha: chacha_tv.c
77	$(COMPILE.c) -DKEYSTREAM_ONLY -I$(SRC)/common/crypto/chacha -o chacha.o -c $(SRC)/common/crypto/chacha/chacha.c
78	$(COMPILE.c) -I$(SRC)/common/crypto/chacha -o chacha_tv.o -c chacha_tv.c
79	$(LINK.c) -o $@ chacha_tv.o chacha.o $(LDLIBS)
80	$(POST_PROCESS)
81
82$(ROOTBINDIR):
83	$(INS.dir)
84
85$(ROOTBINDIR)/%: %
86	$(INS.file)
87
88$(TESTDIR):
89	$(INS.dir)
90
91$(TESTDIR)/%: %
92	$(INS.file)
93
94$(TESTDIR)/%: %
95	$(INS.file)
96