xref: /illumos-gate/usr/src/test/crypto-tests/tests/digest/Makefile (revision f3041bfa3b583d55b68d8c6d8816f646b8d73aee)
1*f3041bfaSJason King#
2*f3041bfaSJason King# This file and its contents are supplied under the terms of the
3*f3041bfaSJason King# Common Development and Distribution License ("CDDL"), version 1.0.
4*f3041bfaSJason King# You may only use this file in accordance with the terms of version
5*f3041bfaSJason King# 1.0 of the CDDL.
6*f3041bfaSJason King#
7*f3041bfaSJason King# A full copy of the text of the CDDL should have accompanied this
8*f3041bfaSJason King# source.  A copy of the CDDL is also available via the Internet at
9*f3041bfaSJason King# http://www.illumos.org/license/CDDL.
10*f3041bfaSJason King#
11*f3041bfaSJason King
12*f3041bfaSJason King#
13*f3041bfaSJason King# Copyright 2018, Joyent, Inc.
14*f3041bfaSJason King#
15*f3041bfaSJason King
16*f3041bfaSJason Kinginclude $(SRC)/cmd/Makefile.cmd
17*f3041bfaSJason Kinginclude $(SRC)/test/Makefile.com
18*f3041bfaSJason Kinginclude $(SRC)/cmd/Makefile.ctf
19*f3041bfaSJason King
20*f3041bfaSJason KingALGS = sha1 sha256 sha384 sha512
21*f3041bfaSJason KingCRYPTO = pkcs kcf
22*f3041bfaSJason King
23*f3041bfaSJason KingPROGS_pkcs = $(ALGS:%=%_pkcs)
24*f3041bfaSJason KingPROGS_kcf = $(ALGS:%=%_kcf)
25*f3041bfaSJason KingPROGS = $(PROGS_pkcs) $(PROGS_kcf)
26*f3041bfaSJason King
27*f3041bfaSJason KingROOTOPTPKG = $(ROOT)/opt/crypto-tests
28*f3041bfaSJason KingTESTROOT = $(ROOTOPTPKG)/tests/digest
29*f3041bfaSJason KingTESTDIR_pkcs = $(TESTROOT)/pkcs
30*f3041bfaSJason KingTESTDIR_kcf = $(TESTROOT)/kcf
31*f3041bfaSJason King
32*f3041bfaSJason KingCOMMONDIR = ../common
33*f3041bfaSJason King
34*f3041bfaSJason King$(CRYPTO:%=sha1_%)	:= OBJS = sha1.o
35*f3041bfaSJason King$(CRYPTO:%=sha256_%)	:= OBJS = sha256.o
36*f3041bfaSJason King$(CRYPTO:%=sha384_%)	:= OBJS = sha384.o
37*f3041bfaSJason King$(CRYPTO:%=sha512_%)	:= OBJS = sha512.o
38*f3041bfaSJason King
39*f3041bfaSJason KingOBJS_COMMON	= $(COMMONDIR)/testfuncs.o
40*f3041bfaSJason King$(PROGS_pkcs)	:= OBJS_COMMON += $(COMMONDIR)/cryptotest_pkcs.o
41*f3041bfaSJason King$(PROGS_kcf)	:= OBJS_COMMON += $(COMMONDIR)/cryptotest_kcf.o
42*f3041bfaSJason King$(PROGS)	:= OBJS += main.o
43*f3041bfaSJason King
44*f3041bfaSJason KingCSTD = $(CSTD_GNU99)
45*f3041bfaSJason King
46*f3041bfaSJason KingCPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
47*f3041bfaSJason KingCPPFLAGS += -I$(COMMONDIR) -I$(SRC)/common/crypto
48*f3041bfaSJason King
49*f3041bfaSJason KingLINTFLAGS += -xerroff=E_NAME_USED_NOT_DEF2
50*f3041bfaSJason KingLINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
51*f3041bfaSJason King
52*f3041bfaSJason King$(PROGS_pkcs) := LDLIBS += -lpkcs11 -lcryptoutil
53*f3041bfaSJason King
54*f3041bfaSJason KingCMDS_pkcs = $(ALGS:%=$(TESTDIR_pkcs)/%)
55*f3041bfaSJason KingCMDS_kcf = $(ALGS:%=$(TESTDIR_kcf)/%)
56*f3041bfaSJason KingCMDS = $(CMDS_pkcs) $(CMDS_kcf)
57*f3041bfaSJason King
58*f3041bfaSJason King$(CMDS) := FILEMODE = 0555
59*f3041bfaSJason King
60*f3041bfaSJason Kingall: $(PROGS)
61*f3041bfaSJason King
62*f3041bfaSJason King$(COMMONDIR)/%.o:
63*f3041bfaSJason King$(PROGS): main.o
64*f3041bfaSJason King
65*f3041bfaSJason King%_pkcs: %.o
66*f3041bfaSJason King	$(LINK.c) -o $@ $(OBJS) $(OBJS_COMMON) $(LDLIBS)
67*f3041bfaSJason King	$(POST_PROCESS)
68*f3041bfaSJason King
69*f3041bfaSJason King%_kcf: %.o
70*f3041bfaSJason King	$(LINK.c) -o $@ $(OBJS) $(OBJS_COMMON) $(LDLIBS)
71*f3041bfaSJason King	$(POST_PROCESS)
72*f3041bfaSJason King
73*f3041bfaSJason King%.o: %.c
74*f3041bfaSJason King	$(COMPILE.c) -o $@ $<
75*f3041bfaSJason King	$(POST_PROCESS_O)
76*f3041bfaSJason King
77*f3041bfaSJason Kinginstall: all $(CMDS)
78*f3041bfaSJason King
79*f3041bfaSJason Kinglint: $(CRYPTO:%=lint_%)
80*f3041bfaSJason Kinglint_pkcs: $(ALGS:%=lint_pkcs_%)
81*f3041bfaSJason Kinglint_kcf: $(ALGS_kcf:%=lint_kcf_%)
82*f3041bfaSJason King
83*f3041bfaSJason Kinglint_pkcs_%:
84*f3041bfaSJason King	$(LINT.c) main.c $(@:lint_pkcs_%=%.c) $(OBJS_COMMON:%.o=%.c) $(LDLIBS)
85*f3041bfaSJason King
86*f3041bfaSJason Kinglint_pcf_%:
87*f3041bfaSJason King	$(LINT.c) main.c $(@:lint_kcf_%=%.c) $(OBJS_COMMON:%.o=%.c) $(LDLIBS)
88*f3041bfaSJason King
89*f3041bfaSJason Kingclobber: clean
90*f3041bfaSJason King	-$(RM) $(PROGS)
91*f3041bfaSJason King
92*f3041bfaSJason Kingclean:
93*f3041bfaSJason King	-$(RM) $(ALGS:%=%.o) main.o
94*f3041bfaSJason King
95*f3041bfaSJason King$(CMDS): $(TESTDIR_pkcs) $(TESTDIR_kcf) $(PROGS)
96*f3041bfaSJason King
97*f3041bfaSJason King$(TESTDIR_pkcs) $(TESTDIR_kcf):
98*f3041bfaSJason King	$(INS.dir)
99*f3041bfaSJason King	@echo Cmds: $(CMDS)
100*f3041bfaSJason King
101*f3041bfaSJason King$(TESTROOT)/pkcs/%: %_pkcs
102*f3041bfaSJason King	$(INS.rename)
103*f3041bfaSJason King
104*f3041bfaSJason King$(TESTROOT)/kcf/%: %_kcf
105*f3041bfaSJason King	$(INS.rename)
106