1# Makefile for crypto test suite 2# 3# David A. McGrew 4# Cisco Systems, Inc. 5 6srcdir = @srcdir@ 7top_srcdir = @top_srcdir@ 8top_builddir = @top_builddir@ 9VPATH = @srcdir@ 10 11CC = @CC@ 12INCDIR = -Iinclude -I$(srcdir)/include -I$(top_srcdir)/include 13DEFS = @DEFS@ 14CPPFLAGS= @CPPFLAGS@ 15CFLAGS = @CFLAGS@ 16LIBS = @LIBS@ 17LDFLAGS = @LDFLAGS@ -L. -L.. 18COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS) 19CRYPTOLIB = -lsrtp2 20CRYPTO_LIBDIR = @CRYPTO_LIBDIR@ 21 22RANLIB = @RANLIB@ 23 24# Specify how tests should find shared libraries on macOS and Linux 25# 26# macOS purges DYLD_LIBRARY_PATH when spawning subprocesses, so it's 27# not possible to pass this in from the outside; we have to specify 28# it for any subprocesses we call. No support for dynamic linked 29# tests on Windows. 30ifneq ($(strip $(CRYPTO_LIBDIR)),) 31 ifneq ($(OS),Windows_NT) 32 UNAME_S = $(shell uname -s) 33 ifeq ($(UNAME_S),Linux) 34 FIND_LIBRARIES = LD_LIBRARY_PATH=$(CRYPTO_LIBDIR) 35 endif 36 ifeq ($(UNAME_S),Darwin) 37 FIND_LIBRARIES = DYLD_LIBRARY_PATH=$(CRYPTO_LIBDIR) 38 endif 39 endif 40endif 41 42# EXE defines the suffix on executables - it's .exe for cygwin, and 43# null on linux, bsd, and OS X and other OSes. we define this so that 44# `make clean` will work on the cygwin platform 45EXE = @EXE@ 46# Random source. 47USE_EXTERNAL_CRYPTO = @USE_EXTERNAL_CRYPTO@ 48 49ifdef ARCH 50 DEFS += -D$(ARCH)=1 51endif 52 53ifdef sysname 54 DEFS += -D$(sysname)=1 55endif 56 57.PHONY: dummy all runtest clean superclean 58 59dummy : all runtest 60 61# test applications 62ifneq (1, $(USE_EXTERNAL_CRYPTO)) 63AES_CALC = test/aes_calc$(EXE) 64endif 65 66testapp = test/cipher_driver$(EXE) test/datatypes_driver$(EXE) \ 67 test/stat_driver$(EXE) test/sha1_driver$(EXE) \ 68 test/kernel_driver$(EXE) $(AES_CALC) \ 69 test/env$(EXE) 70 71# data values used to test the aes_calc application for AES-128 72k128=000102030405060708090a0b0c0d0e0f 73p128=00112233445566778899aabbccddeeff 74c128=69c4e0d86a7b0430d8cdb78070b4c55a 75 76 77# data values used to test the aes_calc application for AES-256 78k256=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f 79p256=00112233445566778899aabbccddeeff 80c256=8ea2b7ca516745bfeafc49904b496089 81 82 83runtest: $(testapp) 84 $(FIND_LIBRARIES) test/env$(EXE) # print out information on the build environment 85 @echo "running crypto test applications..." 86ifneq (1, $(USE_EXTERNAL_CRYPTO)) 87 $(FIND_LIBRARIES) test `test/aes_calc $(k128) $(p128)` = $(c128) 88 $(FIND_LIBRARIES) test `test/aes_calc $(k256) $(p256)` = $(c256) 89endif 90 $(FIND_LIBRARIES) test/cipher_driver$(EXE) -v >/dev/null 91 $(FIND_LIBRARIES) test/datatypes_driver$(EXE) -v >/dev/null 92 $(FIND_LIBRARIES) test/stat_driver$(EXE) >/dev/null 93 $(FIND_LIBRARIES) test/sha1_driver$(EXE) -v >/dev/null 94 $(FIND_LIBRARIES) test/kernel_driver$(EXE) -v >/dev/null 95 @echo "crypto test applications passed." 96 97 98# the rule for making object files and test apps 99 100%.o: %.c 101 $(COMPILE) -c $< -o $@ 102 103%$(EXE): %.c $(srcdir)/../test/getopt_s.c 104 $(COMPILE) $(LDFLAGS) $< $(srcdir)/../test/getopt_s.c -o $@ $(CRYPTOLIB) $(LIBS) 105 106all: $(testapp) 107 108# housekeeping functions 109 110clean: 111 rm -f $(testapp) *.o */*.o 112 for a in * .* */*; do if [ -f "$$a~" ] ; then rm $$a~; fi; done; 113 rm -f `find . -name "*.[ch]~*~"` 114 rm -rf latex 115 116superclean: clean 117 rm -f *core TAGS ktrace.out 118 119# EOF 120