1f3041bfaSJason King# 2f3041bfaSJason King# This file and its contents are supplied under the terms of the 3f3041bfaSJason King# Common Development and Distribution License ("CDDL"), version 1.0. 4f3041bfaSJason King# You may only use this file in accordance with the terms of version 5f3041bfaSJason King# 1.0 of the CDDL. 6f3041bfaSJason King# 7f3041bfaSJason King# A full copy of the text of the CDDL should have accompanied this 8f3041bfaSJason King# source. A copy of the CDDL is also available via the Internet at 9f3041bfaSJason King# http://www.illumos.org/license/CDDL. 10f3041bfaSJason King# 11f3041bfaSJason King 12f3041bfaSJason King# 13f3041bfaSJason King# Copyright 2018, Joyent, Inc. 14f3041bfaSJason King# 15f3041bfaSJason King 16f3041bfaSJason Kinginclude $(SRC)/cmd/Makefile.cmd 17f3041bfaSJason Kinginclude $(SRC)/test/Makefile.com 18f3041bfaSJason Kinginclude $(SRC)/cmd/Makefile.ctf 19f3041bfaSJason King 20*6b2ab905SJason KingALGS = sha1 sha256 sha384 sha512 sha512_224 sha512_256 md5 21f3041bfaSJason KingCRYPTO = pkcs kcf 22f3041bfaSJason King 23e75b2cb0SRobert MustacchiPROGS_pkcs_32 = $(ALGS:%=%_32_pkcs) 24e75b2cb0SRobert MustacchiPROGS_pkcs_64 = $(ALGS:%=%_64_pkcs) 25e75b2cb0SRobert MustacchiPROGS_kcf_32 = $(ALGS:%=%_32_kcf) 26e75b2cb0SRobert MustacchiPROGS_kcf_64 = $(ALGS:%=%_64_kcf) 27e75b2cb0SRobert MustacchiPROGS_pkcs = $(PROGS_pkcs_32) $(PROGS_pkcs_64) 28e75b2cb0SRobert MustacchiPROGS_kcf = $(PROGS_kcf_32) $(PROGS_kcf_64) 29e75b2cb0SRobert MustacchiPROGS_32 = $(PROGS_pkcs_32) $(PROGS_kcf_32) 30e75b2cb0SRobert MustacchiPROGS_64 = $(PROGS_pkcs_64) $(PROGS_kcf_64) 31e75b2cb0SRobert MustacchiPROGS = $(PROGS_32) $(PROGS_64) 32f3041bfaSJason King 33f3041bfaSJason KingROOTOPTPKG = $(ROOT)/opt/crypto-tests 34f3041bfaSJason KingTESTROOT = $(ROOTOPTPKG)/tests/digest 35f3041bfaSJason KingTESTDIR_pkcs = $(TESTROOT)/pkcs 36f3041bfaSJason KingTESTDIR_kcf = $(TESTROOT)/kcf 37f3041bfaSJason King 38f3041bfaSJason KingCOMMONDIR = ../common 39f3041bfaSJason King 40e75b2cb0SRobert Mustacchi$(CRYPTO:%=sha1_32_%) := OBJS = sha1.32.o 41e75b2cb0SRobert Mustacchi$(CRYPTO:%=sha256_32_%) := OBJS = sha256.32.o 42e75b2cb0SRobert Mustacchi$(CRYPTO:%=sha384_32_%) := OBJS = sha384.32.o 43e75b2cb0SRobert Mustacchi$(CRYPTO:%=sha512_32_%) := OBJS = sha512.32.o 4405204290SJason King$(CRYPTO:%=sha512_224_32_%) := OBJS = sha512_224.32.o 4505204290SJason King$(CRYPTO:%=sha512_256_32_%) := OBJS = sha512_256.32.o 46*6b2ab905SJason King$(CRYPTO:%=md5_32_%) := OBJS = md5.32.o 47f3041bfaSJason King 48e75b2cb0SRobert Mustacchi$(CRYPTO:%=sha1_64_%) := OBJS = sha1.64.o 49e75b2cb0SRobert Mustacchi$(CRYPTO:%=sha256_64_%) := OBJS = sha256.64.o 50e75b2cb0SRobert Mustacchi$(CRYPTO:%=sha384_64_%) := OBJS = sha384.64.o 51e75b2cb0SRobert Mustacchi$(CRYPTO:%=sha512_64_%) := OBJS = sha512.64.o 5205204290SJason King$(CRYPTO:%=sha512_224_64_%) := OBJS = sha512_224.64.o 5305204290SJason King$(CRYPTO:%=sha512_256_64_%) := OBJS = sha512_256.64.o 54*6b2ab905SJason King$(CRYPTO:%=md5_64_%) := OBJS = md5.64.o 55e75b2cb0SRobert Mustacchi 56e75b2cb0SRobert Mustacchi$(PROGS_32) := OBJS_COMMON = main.32.o $(COMMONDIR)/testfuncs.32.o 57e75b2cb0SRobert Mustacchi$(PROGS_64) := OBJS_COMMON = main.64.o $(COMMONDIR)/testfuncs.64.o 58e75b2cb0SRobert Mustacchi$(PROGS_pkcs_32) := OBJS_COMMON += $(COMMONDIR)/cryptotest_pkcs.32.o 59e75b2cb0SRobert Mustacchi$(PROGS_pkcs_64) := OBJS_COMMON += $(COMMONDIR)/cryptotest_pkcs.64.o 60e75b2cb0SRobert Mustacchi$(PROGS_kcf_32) := OBJS_COMMON += $(COMMONDIR)/cryptotest_kcf.32.o 61e75b2cb0SRobert Mustacchi$(PROGS_kcf_64) := OBJS_COMMON += $(COMMONDIR)/cryptotest_kcf.64.o 62f3041bfaSJason King 63f3041bfaSJason KingCSTD = $(CSTD_GNU99) 64f3041bfaSJason King 65f3041bfaSJason KingCPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 66f3041bfaSJason KingCPPFLAGS += -I$(COMMONDIR) -I$(SRC)/common/crypto 67f3041bfaSJason King 68f3041bfaSJason KingLINTFLAGS += -xerroff=E_NAME_USED_NOT_DEF2 69f3041bfaSJason KingLINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2 70f3041bfaSJason King 71f3041bfaSJason King$(PROGS_pkcs) := LDLIBS += -lpkcs11 -lcryptoutil 72f3041bfaSJason King 73e75b2cb0SRobert MustacchiCMDS_pkcs = $(PROGS_pkcs:%_pkcs=$(TESTDIR_pkcs)/%) 74e75b2cb0SRobert MustacchiCMDS_kcf = $(PROGS_kcf:%_kcf=$(TESTDIR_kcf)/%) 75f3041bfaSJason KingCMDS = $(CMDS_pkcs) $(CMDS_kcf) 76f3041bfaSJason King 77f3041bfaSJason King$(CMDS) := FILEMODE = 0555 78f3041bfaSJason King 79f3041bfaSJason Kingall: $(PROGS) 80f3041bfaSJason King 81e75b2cb0SRobert Mustacchi$(PROGS): main.32.o main.64.o 82f3041bfaSJason King 83e75b2cb0SRobert Mustacchi%_32_pkcs: %.32.o 84f3041bfaSJason King $(LINK.c) -o $@ $(OBJS) $(OBJS_COMMON) $(LDLIBS) 85f3041bfaSJason King $(POST_PROCESS) 86f3041bfaSJason King 87e75b2cb0SRobert Mustacchi%_64_pkcs: %.64.o 88e75b2cb0SRobert Mustacchi $(LINK64.c) -o $@ $(OBJS) $(OBJS_COMMON) $(LDLIBS) 89e75b2cb0SRobert Mustacchi $(POST_PROCESS) 90e75b2cb0SRobert Mustacchi 91e75b2cb0SRobert Mustacchi%_32_kcf: %.32.o 92f3041bfaSJason King $(LINK.c) -o $@ $(OBJS) $(OBJS_COMMON) $(LDLIBS) 93f3041bfaSJason King $(POST_PROCESS) 94f3041bfaSJason King 95e75b2cb0SRobert Mustacchi%_64_kcf: %.64.o 96e75b2cb0SRobert Mustacchi $(LINK64.c) -o $@ $(OBJS) $(OBJS_COMMON) $(LDLIBS) 97e75b2cb0SRobert Mustacchi $(POST_PROCESS) 98e75b2cb0SRobert Mustacchi 99e75b2cb0SRobert Mustacchi%.32.o: %.c 100f3041bfaSJason King $(COMPILE.c) -o $@ $< 101f3041bfaSJason King $(POST_PROCESS_O) 102f3041bfaSJason King 103e75b2cb0SRobert Mustacchi%.64.o: %.c 104e75b2cb0SRobert Mustacchi $(COMPILE64.c) -o $@ $< 105e75b2cb0SRobert Mustacchi $(POST_PROCESS_O) 106e75b2cb0SRobert Mustacchi 107e75b2cb0SRobert Mustacchi 108f3041bfaSJason Kinginstall: all $(CMDS) 109f3041bfaSJason King 110f3041bfaSJason Kinglint: $(CRYPTO:%=lint_%) 111f3041bfaSJason Kinglint_pkcs: $(ALGS:%=lint_pkcs_%) 112f3041bfaSJason Kinglint_kcf: $(ALGS_kcf:%=lint_kcf_%) 113f3041bfaSJason King 114f3041bfaSJason Kinglint_pkcs_%: 115f3041bfaSJason King $(LINT.c) main.c $(@:lint_pkcs_%=%.c) $(OBJS_COMMON:%.o=%.c) $(LDLIBS) 116f3041bfaSJason King 117f3041bfaSJason Kinglint_pcf_%: 118f3041bfaSJason King $(LINT.c) main.c $(@:lint_kcf_%=%.c) $(OBJS_COMMON:%.o=%.c) $(LDLIBS) 119f3041bfaSJason King 120f3041bfaSJason Kingclobber: clean 121f3041bfaSJason King -$(RM) $(PROGS) 122f3041bfaSJason King 123f3041bfaSJason Kingclean: 124e75b2cb0SRobert Mustacchi -$(RM) $(ALGS:%=%.32.o) $(ALGS:%=%.64.o) main.32.o main.64.o 125f3041bfaSJason King 126f3041bfaSJason King$(CMDS): $(TESTDIR_pkcs) $(TESTDIR_kcf) $(PROGS) 127f3041bfaSJason King 128f3041bfaSJason King$(TESTDIR_pkcs) $(TESTDIR_kcf): 129f3041bfaSJason King $(INS.dir) 130f3041bfaSJason King 131e75b2cb0SRobert Mustacchi$(TESTDIR_pkcs)/%_32: %_32_pkcs 132f3041bfaSJason King $(INS.rename) 133f3041bfaSJason King 134e75b2cb0SRobert Mustacchi$(TESTDIR_pkcs)/%_64: %_64_pkcs 135e75b2cb0SRobert Mustacchi $(INS.rename) 136e75b2cb0SRobert Mustacchi 137e75b2cb0SRobert Mustacchi$(TESTDIR_kcf)/%_32: %_32_kcf 138e75b2cb0SRobert Mustacchi $(INS.rename) 139e75b2cb0SRobert Mustacchi 140e75b2cb0SRobert Mustacchi$(TESTDIR_kcf)/%_64: %_64_kcf 141f3041bfaSJason King $(INS.rename) 142