3 # Copyright (C) 2011 Gregor Pintar <grpintar@gmail.com>
5 # Permission is granted to deal in this work without any restriction,
6 # including unlimited rights to use, publicly perform, publish,
7 # reproduce, relicence, modify, merge, and/or distribute in any form,
8 # for any purpose, with or without fee, and by any means.
10 # This work is provided "AS IS" and WITHOUT WARRANTY of any kind,
11 # to the utmost extent permitted by applicable law. In no event
12 # shall a licensor, author or contributor be held liable for any
13 # issues arising in any way out of dealing in the work.
17 STRIP
=${STRIP:-"strip"}
18 CFLAGS
="-std=c99 -pedantic -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wbad-function-cast -Wshadow -I include/ -fPIC -D_ANSI_SOURCE -D_ISOC99_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 $CFLAGS"
19 # -fstack-protector-all -fno-strict-aliasing -Werror Wc++-compat -Wcast-align -DNDEBUG -fwhole-program -ffunction-sections -fdata-sections
20 OPTIM
="-O2 -D_FORTIFY_SOURCE=2 -flto -DNDEBUG $OPTIM"
21 LDFLAGS
="-Wall -lm $LDFLAGS"
23 SRC
="lib/version.c lib/authstream.c lib/authstream/eax.c lib/mac.c lib/mac/hmac.c lib/mac/omac.c lib/stream/salsa20.c lib/hash/blake256.c lib/hash/blake512.c lib/hash/blake2s.c lib/hash/blake2b.c lib/hash/keccak1600.c lib/hash/keccak800.c lib/block/xtea.c lib/block/threefish256.c lib/block/threefish512.c lib/block/threefish1024.c lib/stream/ecb.c lib/stream/ctr.c lib/stream/cbc.c lib/stream/ofb.c lib/stream/rc4.c lib/stream/chacha.c lib/block/rijndael.c lib/block/serpent.c lib/block/rc5.c lib/block/rc6.c lib/block/twofish.c lib/block/blowfish.c lib/block/anubis.c lib/block/noekeon.c lib/block/aria.c lib/block/seed.c lib/block/camellia.c lib/block/gost.c lib/hash.c lib/hash/sha1.c lib/hash/sha2_256.c lib/hash/sha2_512.c lib/memwipe.c lib/random.c lib/pkcs7.c lib/block.c lib/stream.c lib/pbkdf2.c lib/scrypt.c lib/stream/cfb.c"
24 OBJ
="version.o authstream.o eax.o mac.o hmac.o omac.o salsa20.o blake256.o blake512.o blake2s.o blake2b.o keccak1600.o keccak800.o xtea.o threefish256.o threefish512.o threefish1024.o ecb.o ctr.o cbc.o ofb.o rc4.o chacha.o rijndael.o serpent.o rc5.o rc6.o twofish.o blowfish.o anubis.o noekeon.o aria.o seed.o camellia.o gost.o hash.o sha1.o sha2_256.o sha2_512.o memwipe.o random.o pkcs7.o block.o stream.o pbkdf2.o scrypt.o cfb.o"
27 while [ $i -le $# ]; do
40 CFLAGS
="$CFLAGS -DKRIPTO_UNIX"
44 CFLAGS
="$CFLAGS -DKRIPTO_WINDOWS"
45 #LDFLAGS="$LDFLAGS -Wl,-subsystem,windows"
49 echo "-shared Build shared library"
50 echo "-os=[unix|windows] Target operating system"
54 CFLAGS
="$CFLAGS $param"
61 # if OS not defined assume UNIX
63 CFLAGS
="$CFLAGS -DKRIPTO_UNIX"
66 if [ -z $debug ]; then
67 CFLAGS
="$CFLAGS $OPTIM"
68 LDFLAGS
="$LDFLAGS $OPTIM"
70 CFLAGS
="$CFLAGS -g -fstack-protector-all"
74 $PREFIX$CC -c $SRC $CFLAGS
77 $PREFIX$AR rcs libkripto.a
$OBJ
79 #if [ -z $debug ]; then
80 # $PREFIX$STRIP -s libkripto.a
84 if [ ! -z $shared ]; then
85 $PREFIX$CC -shared $LDFLAGS -Wl,-soname,libkripto.so
.0 -o libkripto.so
.0.1.0 $OBJ -lc
88 #if [ -z $debug ]; then
89 # $PREFIX$STRIP -s libkripto.so.*