tomcrypt/makefile

195 lines
5.8 KiB
Makefile
Raw Normal View History

2003-03-02 19:59:24 -05:00
# MAKEFILE for linux GCC
#
# Tom St Denis
# Modified by Clay Culver
#
# NOTE: This should later be replaced by autoconf/automake scripts, but for
# the time being this is actually pretty clean. The only ugly part is
# handling CFLAGS so that the x86 specific optimizations don't break
# a build. This is easy to remedy though, for those that have problems.
# The version
2003-06-15 18:37:45 -04:00
VERSION=0.86
2003-03-02 19:59:24 -05:00
2003-03-02 20:02:10 -05:00
#ch1-01-1
# Compiler and Linker Names
2003-03-02 19:59:24 -05:00
CC=gcc
LD=ld
2003-03-02 20:02:10 -05:00
# Archiver [makes .a files]
2003-03-02 19:59:24 -05:00
AR=ar
2003-03-02 20:02:10 -05:00
ARFLAGS=r
#ch1-01-1
2003-03-02 19:59:24 -05:00
2003-03-02 20:02:10 -05:00
#ch1-01-3
# Compilation flags. Note the += does not write over the user's CFLAGS!
2003-03-29 13:19:07 -05:00
CFLAGS += -c -I./ -Wall -Wsign-compare -W -Wno-unused -Wshadow -Werror
2003-03-02 19:59:24 -05:00
2003-03-02 20:02:10 -05:00
# optimize for SPEED
2003-03-02 20:00:16 -05:00
#CFLAGS += -O3 -funroll-loops
2003-03-02 19:59:24 -05:00
2003-06-15 18:37:45 -04:00
#add -fomit-frame-pointer. v3.2 is buggy for certain platforms so this is used for files it is known to work for
#default is off but you may enable this to get further performance [make sure you run the test suite!]
#EXT_CFLAGS = -fomit-frame-pointer
2003-03-02 20:03:50 -05:00
# optimize for SIZE
CFLAGS += -Os
2003-03-02 19:59:24 -05:00
2003-06-01 14:55:11 -04:00
# compile for DEBUGING
2003-03-02 19:59:24 -05:00
#CFLAGS += -g3
2003-03-02 20:02:10 -05:00
#ch1-01-3
2003-03-02 19:59:24 -05:00
#These flags control how the library gets built.
#Output filenames for various targets.
LIBNAME=libtomcrypt.a
TEST=test
HASH=hashsum
CRYPT=encrypt
SMALL=small
2003-06-15 18:37:45 -04:00
PROF=x86_prof
2003-03-02 19:59:24 -05:00
#LIBPATH-The directory for libtomcrypt to be installed to.
#INCPATH-The directory to install the header files for libtomcrypt.
2003-03-02 20:03:50 -05:00
#DATAPATH-The directory to install the pdf docs.
DESTDIR=
2003-03-02 19:59:24 -05:00
LIBPATH=/usr/lib
INCPATH=/usr/include
2003-03-02 20:03:50 -05:00
DATAPATH=/usr/share/doc/libtomcrypt/pdf
2003-03-02 19:59:24 -05:00
#List of objects to compile.
2003-03-02 20:02:42 -05:00
OBJECTS=keyring.o gf.o mem.o sprng.o ecc.o base64.o dh.o rsa.o \
2003-03-02 19:59:24 -05:00
bits.o yarrow.o cfb.o ofb.o ecb.o ctr.o cbc.o hash.o tiger.o sha1.o \
2003-06-11 17:10:22 -04:00
md5.o md4.o md2.o sha256.o sha512.o xtea.o aes.o des.o \
2003-03-02 20:01:40 -05:00
safer_tab.o safer.o safer+.o rc4.o rc2.o rc6.o rc5.o cast5.o noekeon.o blowfish.o crypt.o \
2003-06-11 17:10:22 -04:00
mpi.o prime.o twofish.o packet.o hmac.o strings.o
2003-03-02 19:59:24 -05:00
TESTOBJECTS=demos/test.o
HASHOBJECTS=demos/hashsum.o
CRYPTOBJECTS=demos/encrypt.o
SMALLOBJECTS=demos/small.o
2003-06-15 18:37:45 -04:00
PROFS=demos/x86_prof.o
2003-03-02 19:59:24 -05:00
#Files left over from making the crypt.pdf.
LEFTOVERS=*.dvi *.log *.aux *.toc *.idx *.ilg *.ind
#Compressed filenames
COMPRESSED=crypt.tar.bz2 crypt.zip crypt.tar.gz
#Header files used by libtomcrypt.
2003-06-01 14:55:11 -04:00
HEADERS=tommath.h mycrypt_cfg.h mycrypt_gf.h mycrypt_kr.h \
2003-03-02 19:59:24 -05:00
mycrypt_misc.h mycrypt_prng.h mycrypt_cipher.h mycrypt_hash.h \
2003-03-02 20:03:50 -05:00
mycrypt_macros.h mycrypt_pk.h mycrypt.h mycrypt_argchk.h mycrypt_custom.h
2003-03-02 19:59:24 -05:00
#The default rule for make builds the libtomcrypt library.
default:library mycrypt.h mycrypt_cfg.h
#These are the rules to make certain object files.
rsa.o: rsa.c rsa_sys.c
ecc.o: ecc.c ecc_sys.c
dh.o: dh.c dh_sys.c
aes.o: aes.c aes_tab.c
sha512.o: sha512.c sha384.c
2003-06-15 18:37:45 -04:00
#These are objects that are known to build with -fomit-frame-pointer successfully
aes.o: aes.c
$(CC) $(CFLAGS) $(EXT_CFLAGS) -c aes.c
blowfish.o: blowfish.c
$(CC) $(CFLAGS) $(EXT_CFLAGS) -c blowfish.c
cast5.o: cast5.c
$(CC) $(CFLAGS) $(EXT_CFLAGS) -c cast5.c
des.o: des.c
$(CC) $(CFLAGS) $(EXT_CFLAGS) -c des.c
twofish.o: twofish.c
$(CC) $(CFLAGS) $(EXT_CFLAGS) -c twofish.c
md2.o: md2.c
$(CC) $(CFLAGS) $(EXT_CFLAGS) -c md2.c
md4.o: md4.c
$(CC) $(CFLAGS) $(EXT_CFLAGS) -c md4.c
md5.o: md5.c
$(CC) $(CFLAGS) $(EXT_CFLAGS) -c md5.c
sha1.o: sha1.c
$(CC) $(CFLAGS) $(EXT_CFLAGS) -c sha1.c
sha256.o: sha256.c
$(CC) $(CFLAGS) $(EXT_CFLAGS) -c sha256.c
sha512.o: sha512.c
$(CC) $(CFLAGS) $(EXT_CFLAGS) -c sha512.c
tiger.o: tiger.c
$(CC) $(CFLAGS) $(EXT_CFLAGS) -c tiger.c
2003-03-02 19:59:24 -05:00
#This rule makes the libtomcrypt library.
library: $(OBJECTS)
$(AR) $(ARFLAGS) $(LIBNAME) $(OBJECTS)
2003-03-02 20:02:10 -05:00
ranlib $(LIBNAME)
2003-03-02 19:59:24 -05:00
#This rule makes the test program included with libtomcrypt
test: library $(TESTOBJECTS)
$(CC) $(TESTOBJECTS) $(LIBNAME) -o $(TEST) $(WARN)
#This rule makes the hash program included with libtomcrypt
hashsum: library $(HASHOBJECTS)
$(CC) $(HASHOBJECTS) $(LIBNAME) -o $(HASH) $(WARN)
#makes the crypt program
crypt: library $(CRYPTOBJECTS)
$(CC) $(CRYPTOBJECTS) $(LIBNAME) -o $(CRYPT) $(WARN)
#makes the small program
small: library $(SMALLOBJECTS)
$(CC) $(SMALLOBJECTS) $(LIBNAME) -o $(SMALL) $(WARN)
2003-06-15 18:37:45 -04:00
x86_prof: library $(PROFS)
nasm -f coff demos/timer.asm
$(CC) demos/x86_prof.o demos/timer.o $(LIBNAME) -o $(PROF)
#for linux
x86_profl: library $(PROFS)
nasm -f elf -DUSE_ELF demos/timer.asm
$(CC) demos/x86_prof.o demos/timer.o $(LIBNAME) -o $(PROF)
2003-03-02 19:59:24 -05:00
#This rule installs the library and the header files. This must be run
#as root in order to have a high enough permission to write to the correct
#directories and to set the owner and group to root.
2003-03-02 20:02:10 -05:00
install: library docs
2003-03-02 20:03:50 -05:00
install -d -g root -o root $(DESTDIR)$(LIBPATH)
install -d -g root -o root $(DESTDIR)$(INCPATH)
install -d -g root -o root $(DESTDIR)$(DATAPATH)
install -g root -o root $(LIBNAME) $(DESTDIR)$(LIBPATH)
install -g root -o root $(HEADERS) $(DESTDIR)$(INCPATH)
install -g root -o root crypt.pdf $(DESTDIR)$(DATAPATH)
2003-03-02 19:59:24 -05:00
#This rule cleans the source tree of all compiled code, not including the pdf
#documentation.
clean:
rm -f $(OBJECTS) $(TESTOBJECTS) $(HASHOBJECTS) $(CRYPTOBJECTS) $(SMALLOBJECTS) $(LEFTOVERS) $(LIBNAME)
rm -f $(TEST) $(HASH) $(COMPRESSED)
2003-06-15 18:37:45 -04:00
rm -f *stackdump *.lib *.exe *.obj demos/*.obj demos/*.o *.bat
2003-03-02 19:59:24 -05:00
#This builds the crypt.pdf file. Note that the rm -f *.pdf has been removed
#from the clean command! This is because most people would like to keep the
#nice pre-compiled crypt.pdf that comes with libtomcrypt! We only need to
#delete it if we are rebuilding it.
docs: crypt.tex
2003-06-01 14:55:11 -04:00
rm -f crypt.pdf $(LEFTOVERS)
2003-03-02 19:59:24 -05:00
latex crypt > /dev/null
makeindex crypt > /dev/null
pdflatex crypt > /dev/null
rm -f $(LEFTOVERS)
2003-03-02 20:02:10 -05:00
2003-03-02 19:59:24 -05:00
#zipup the project (take that!)
zipup: clean docs
2003-03-02 20:03:50 -05:00
cd .. ; rm -rf crypt* libtomcrypt-$(VERSION) ; mkdir libtomcrypt-$(VERSION) ; \
2003-03-02 19:59:24 -05:00
cp -R ./libtomcrypt/* ./libtomcrypt-$(VERSION)/ ; tar -c libtomcrypt-$(VERSION)/* > crypt-$(VERSION).tar ; \
2003-03-02 20:03:50 -05:00
bzip2 -9vv crypt-$(VERSION).tar ; zip -9 -r crypt-$(VERSION).zip libtomcrypt-$(VERSION)/*