1
# Makefile for libcryptomodule.a
12
INCDIR = -Iinclude -I$(srcdir)/include
13
DEFS = -DHAVE_CONFIG_H
15
CFLAGS = -Wall -O4 -fexpensive-optimizations -funroll-loops
18
COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS)
19
CRYPTOLIB = -lcryptomodule
23
# 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
28
RNG_OBJS = rand_source.o
35
DEFS += -D$(sysname)=1
38
.PHONY: dummy all runtest clean superclean
44
testapp = test/cipher_driver$(EXE) test/datatypes_driver$(EXE) \
45
test/stat_driver$(EXE) test/sha1_driver$(EXE) \
46
test/kernel_driver$(EXE) test/aes_calc$(EXE) test/rand_gen$(EXE) \
49
# data values used to test the aes_calc application
51
k=000102030405060708090a0b0c0d0e0f
52
p=00112233445566778899aabbccddeeff
53
c=69c4e0d86a7b0430d8cdb78070b4c55a
55
runtest: libcryptomodule.a $(testapp)
56
test/env$(EXE) # print out information on the build environment
57
@echo "running libcryptomodule test applications..."
58
test `test/aes_calc $k $p` = $c
59
test/cipher_driver$(EXE) -v >/dev/null
60
test/datatypes_driver$(EXE) -v >/dev/null
61
test/stat_driver$(EXE) >/dev/null
62
test/sha1_driver$(EXE) -v >/dev/null
63
test/kernel_driver$(EXE) -v >/dev/null
64
test/rand_gen$(EXE) -n 256 >/dev/null
65
@echo "libcryptomodule test applications passed."
67
# libcryptomodule.a (the crypto engine)
69
ciphers = cipher/cipher.o cipher/null_cipher.o \
70
cipher/aes.o cipher/aes_icm.o \
73
hashes = hash/null_auth.o hash/sha1.o \
74
hash/hmac.o hash/auth.o
76
math = math/datatypes.o math/stat.o
78
rng = rng/$(RNG_OBJS) rng/rand_source.o rng/prng.o rng/ctr_prng.o
82
kernel = kernel/crypto_kernel.o kernel/alloc.o \
83
kernel/key.o $(rng) $(err)
87
cryptobj = $(ciphers) $(hashes) $(math) $(stat) $(kernel) $(xfm)
89
# the rule for making object files and test apps
92
$(COMPILE) -c $< -o $@
94
%$(EXE): %.c libcryptomodule.a
95
$(COMPILE) $(LDFLAGS) $< -o $@ $(CRYPTOLIB) $(LIBS)
101
# and the crypto module library itself
103
libcryptomodule.a: $(cryptobj)
104
$(AR) cr libcryptomodule.a $(cryptobj)
105
$(RANLIB) libcryptomodule.a
107
all: libcryptomodule.a $(testapp)
109
# housekeeping functions
112
rm -f libcryptomodule.a
113
rm -f $(testapp) *.o */*.o
114
for a in * .* */*; do if [ -f "$$a~" ] ; then rm $$a~; fi; done;
115
rm -f `find . -name "*.[ch]~*~"`
119
rm -f *core TAGS ktrace.out
122
# the target 'package' builds a compressed tar archive of the source code
124
distname = crypto-$(shell cat VERSION)
127
cd ..; tar cvzf $(distname).tgz crypto/