blob: b6d6fcfc502d1a39be9a0e1e13758161082fcc23 [file] [log] [blame]
David McGrewfec49dd2005-09-23 19:34:11 +00001# Makefile for libcryptomodule.a
Cullen Jennings235513a2005-09-21 22:51:36 +00002#
3# David A. McGrew
4# Cisco Systems, Inc.
5
Marcus Sundberg67a695d2005-09-29 14:10:05 +00006srcdir = @srcdir@
7top_srcdir = @top_srcdir@
8top_builddir = @top_builddir@
9VPATH = @srcdir@
10
11CC = @CC@
Philip A. Prindeville7a8c7b32014-10-21 12:04:25 -060012INCDIR = -Iinclude -I$(srcdir)/include
Marcus Sundberg67a695d2005-09-29 14:10:05 +000013DEFS = @DEFS@
14CPPFLAGS= @CPPFLAGS@
15CFLAGS = @CFLAGS@
16LIBS = @LIBS@
jfigus0d3a2682013-04-02 15:42:37 -040017LDFLAGS = @LDFLAGS@ -L. -L..
Marcus Sundberg67a695d2005-09-29 14:10:05 +000018COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS)
jfigus0d3a2682013-04-02 15:42:37 -040019CRYPTOLIB = -lsrtp
Marcus Sundberg67a695d2005-09-29 14:10:05 +000020
21RANLIB = @RANLIB@
Cullen Jennings235513a2005-09-21 22:51:36 +000022
Marcus Sundbergaefd6842005-10-02 19:47:14 +000023# EXE defines the suffix on executables - it's .exe for cygwin, and
24# null on linux, bsd, and OS X and other OSes. we define this so that
25# `make clean` will work on the cygwin platform
26EXE = @EXE@
Marcus Sundberg5c714e42005-10-03 15:16:06 +000027# Random source.
jfigus0d3a2682013-04-02 15:42:37 -040028USE_OPENSSL = @USE_OPENSSL@
Marcus Sundbergaefd6842005-10-02 19:47:14 +000029
Cullen Jennings235513a2005-09-21 22:51:36 +000030ifdef ARCH
Marcus Sundberg67a695d2005-09-29 14:10:05 +000031 DEFS += -D$(ARCH)=1
Cullen Jennings235513a2005-09-21 22:51:36 +000032endif
33
34ifdef sysname
Marcus Sundberg67a695d2005-09-29 14:10:05 +000035 DEFS += -D$(sysname)=1
Cullen Jennings235513a2005-09-21 22:51:36 +000036endif
37
38.PHONY: dummy all runtest clean superclean
39
40dummy : all runtest
41
David McGrewb67061f2005-09-28 14:23:06 +000042# test applications
jfigus0d3a2682013-04-02 15:42:37 -040043ifneq (1, $(USE_OPENSSL))
44AES_CALC = test/aes_calc$(EXE)
45endif
David McGrewb67061f2005-09-28 14:23:06 +000046
Marcus Sundbergaefd6842005-10-02 19:47:14 +000047testapp = test/cipher_driver$(EXE) test/datatypes_driver$(EXE) \
48 test/stat_driver$(EXE) test/sha1_driver$(EXE) \
jfigus0d3a2682013-04-02 15:42:37 -040049 test/kernel_driver$(EXE) $(AES_CALC) test/rand_gen$(EXE) \
Marcus Sundbergaefd6842005-10-02 19:47:14 +000050 test/env$(EXE)
David McGrewb67061f2005-09-28 14:23:06 +000051
Jonathan Lennox5df951a2010-05-20 20:55:54 +000052# data values used to test the aes_calc application for AES-128
53k128=000102030405060708090a0b0c0d0e0f
54p128=00112233445566778899aabbccddeeff
55c128=69c4e0d86a7b0430d8cdb78070b4c55a
Cullen Jennings235513a2005-09-21 22:51:36 +000056
Jonathan Lennox5df951a2010-05-20 20:55:54 +000057
58# data values used to test the aes_calc application for AES-256
59k256=000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
60p256=00112233445566778899aabbccddeeff
61c256=8ea2b7ca516745bfeafc49904b496089
62
Cullen Jennings235513a2005-09-21 22:51:36 +000063
jfigus0d3a2682013-04-02 15:42:37 -040064runtest: $(testapp)
Marcus Sundberg10050ee2005-10-02 19:51:45 +000065 test/env$(EXE) # print out information on the build environment
jfigus0d3a2682013-04-02 15:42:37 -040066 @echo "running crypto test applications..."
67ifneq (1, $(USE_OPENSSL))
Jonathan Lennox5df951a2010-05-20 20:55:54 +000068 test `test/aes_calc $(k128) $(p128)` = $(c128)
69 test `test/aes_calc $(k256) $(p256)` = $(c256)
jfigus0d3a2682013-04-02 15:42:37 -040070endif
Marcus Sundbergaefd6842005-10-02 19:47:14 +000071 test/cipher_driver$(EXE) -v >/dev/null
72 test/datatypes_driver$(EXE) -v >/dev/null
73 test/stat_driver$(EXE) >/dev/null
74 test/sha1_driver$(EXE) -v >/dev/null
75 test/kernel_driver$(EXE) -v >/dev/null
76 test/rand_gen$(EXE) -n 256 >/dev/null
jfigus0d3a2682013-04-02 15:42:37 -040077 @echo "crypto test applications passed."
Cullen Jennings235513a2005-09-21 22:51:36 +000078
Cullen Jennings235513a2005-09-21 22:51:36 +000079
80# the rule for making object files and test apps
81
82%.o: %.c
Marcus Sundberg67a695d2005-09-29 14:10:05 +000083 $(COMPILE) -c $< -o $@
Cullen Jennings235513a2005-09-21 22:51:36 +000084
jfigus0d3a2682013-04-02 15:42:37 -040085%$(EXE): %.c
Marcus Sundberg10050ee2005-10-02 19:51:45 +000086 $(COMPILE) $(LDFLAGS) $< -o $@ $(CRYPTOLIB) $(LIBS)
Cullen Jennings235513a2005-09-21 22:51:36 +000087
jfigus0d3a2682013-04-02 15:42:37 -040088all: $(testapp)
Cullen Jennings235513a2005-09-21 22:51:36 +000089
Cullen Jennings235513a2005-09-21 22:51:36 +000090# housekeeping functions
91
92clean:
93 rm -f libcryptomodule.a
94 rm -f $(testapp) *.o */*.o
95 for a in * .* */*; do if [ -f "$$a~" ] ; then rm $$a~; fi; done;
96 rm -f `find . -name "*.[ch]~*~"`
97 rm -rf latex
98
99superclean: clean
100 rm -f *core TAGS ktrace.out
101
102
103# the target 'package' builds a compressed tar archive of the source code
104
105distname = crypto-$(shell cat VERSION)
106
107package: superclean
108 cd ..; tar cvzf $(distname).tgz crypto/
109
110
111# EOF