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 2015 Nexenta Systems, Inc. All rights reserved. 15# Copyright 2019 Joyent, Inc. 16# 17 18include $(SRC)/cmd/Makefile.cmd 19include $(SRC)/test/Makefile.com 20include $(SRC)/cmd/Makefile.ctf 21 22PROGS_32 = $(CRYPTO:%=$(BASEPROG)_32_%) 23PROGS_64 = $(CRYPTO:%=$(BASEPROG)_64_%) 24PROGS = $(PROGS_32) $(PROGS_64) 25 26COMMON_OBJS_32 = $(COMMON_OBJS:%.o=%.32.o) 27COMMON_OBJS_64 = $(COMMON_OBJS:%.o=%.64.o) 28 29# Some tests may only be relevant for PKCS#11 or KCF. One can use 30# a statement like 'CRYPTO_kcf = $(POUND_SIGN)' in a test's Makefile to 31# disable creation of tests for a given framework. For an example, see 32# modes/aes/cbc_pad/Makefile 33$(CRYPTO_pkcs)PROGS_pkcs = $(BASEPROG:%=%_32_pkcs) $(BASEPROG:%=%_64_pkcs) 34$(CRYPTO_kcf)PROGS_kcf = $(BASEPROG:%=%_32_kcf) $(BASEPROG:%=%_64_kcf) 35 36# $(TESTROOT) must be set by whatever includes this file 37$(CRYPTO_pkcs)TESTDIR_pkcs = $(TESTROOT)/pkcs 38$(CRYPTO_kcf)TESTDIR_kcf = $(TESTROOT)/kcf 39 40COMMONDIR = $(SRC)/test/crypto-tests/tests/common 41$(PROGS_32) := OBJS += $(BASEPROG:%=%.32.o) $(COMMON_OBJS_32) 42$(PROGS_64) := OBJS += $(BASEPROG:%=%.64.o) $(COMMON_OBJS_64) 43$(PROGS_32) := OBJS += $(COMMONDIR)/testfuncs.32.o 44$(PROGS_64) := OBJS += $(COMMONDIR)/testfuncs.64.o 45$(CRYPTO_pkcs)$(BASEPROG)_32_pkcs := OBJS += $(COMMONDIR)/cryptotest_pkcs.32.o 46$(CRYPTO_pkcs)$(BASEPROG)_64_pkcs := OBJS += $(COMMONDIR)/cryptotest_pkcs.64.o 47$(CRYPTO_kcf)$(BASEPROG)_32_kcf := OBJS += $(COMMONDIR)/cryptotest_kcf.32.o 48$(CRYPTO_kcf)$(BASEPROG)_64_kcf := OBJS += $(COMMONDIR)/cryptotest_kcf.64.o 49 50$(CRYPTO_pkcs)$(PROGS_pkcs) := LDLIBS += -lpkcs11 -lcryptoutil 51 52CSTD = $(CSTD_GNU99) 53 54$(CRYPTO_pkcs)CMDS_pkcs = $(PROGS_pkcs:%_pkcs=$(TESTDIR_pkcs)/%) 55$(CRYPTO_kcf)CMDS_kcf = $(PROGS_kcf:%_kcf=$(TESTDIR_kcf)/%) 56CMDS = $(CMDS_pkcs) $(CMDS_kcf) 57 58$(CMDS) := FILEMODE = 0555 59 60CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 61CPPFLAGS += -I$(COMMONDIR) -I$(SRC)/common/crypto/ 62 63all: $(PROGS) 64 65%_32_pkcs: %.32.o $(COMMON_OBJS_32) 66 $(LINK.c) $(OBJS) -o $@ $(LDLIBS) 67 $(POST_PROCESS) 68 69%_64_pkcs: %.64.o $(COMMON_OBJS_64) 70 $(LINK64.c) $(OBJS) -o $@ $(LDLIBS) 71 $(POST_PROCESS) 72 73%_32_kcf: %.32.o $(COMMON_OBJS_32) 74 $(LINK.c) $(OBJS) -o $@ $(LDLIBS) 75 $(POST_PROCESS) 76 77%_64_kcf: %.64.o $(COMMON_OBJS_64) 78 $(LINK64.c) $(OBJS) -o $@ $(LDLIBS) 79 $(POST_PROCESS) 80 81%.32.o: %.c 82 $(COMPILE.c) -o $@ $< 83 $(POST_PROCESS_O) 84 85%.64.o: %.c 86 $(COMPILE64.c) -o $@ $< 87 $(POST_PROCESS_O) 88 89install: all $(CMDS) 90 91clobber: clean 92 -$(RM) $(PROGS) 93 94clean: 95 -$(RM) *.o $(COMMON_OBJS_32) $(COMMON_OBJS_64) 96 97$(CMDS): $(TESTDIR_pkcs) $(TESTDIR_kcf) $(PROGS) 98 99$(TESTDIR_pkcs) $(TESTDIR_kcf): 100 $(INS.dir) 101 102$(TESTDIR_pkcs)/%_32: %_32_pkcs 103 $(INS.rename) 104 105$(TESTDIR_pkcs)/%_64: %_64_pkcs 106 $(INS.rename) 107 108$(TESTDIR_kcf)/%_32: %_32_kcf 109 $(INS.rename) 110 111$(TESTDIR_kcf)/%_64: %_64_kcf 112 $(INS.rename) 113