libtomcrypt/makefile

169 lines
5.3 KiB
Makefile
Raw Normal View History

2003-03-03 00:59:24 +00: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
2004-01-25 17:40:34 +00:00
VERSION=0.93
2003-03-03 00:59:24 +00:00
2003-03-03 01:02:10 +00:00
#ch1-01-1
# Compiler and Linker Names
2003-12-24 18:59:57 +00:00
#CC=gcc
#LD=ld
2003-03-03 00:59:24 +00:00
2003-03-03 01:02:10 +00:00
# Archiver [makes .a files]
2003-12-24 18:59:57 +00:00
#AR=ar
#ARFLAGS=r
2003-03-03 01:02:10 +00:00
#ch1-01-1
2003-03-03 00:59:24 +00:00
2003-03-03 01:02:10 +00:00
#ch1-01-3
# Compilation flags. Note the += does not write over the user's CFLAGS!
2003-03-29 18:19:07 +00:00
CFLAGS += -c -I./ -Wall -Wsign-compare -W -Wno-unused -Wshadow -Werror
2003-03-03 00:59:24 +00:00
2003-03-03 01:02:10 +00:00
# optimize for SPEED
2003-03-03 01:00:16 +00:00
#CFLAGS += -O3 -funroll-loops
2003-03-03 00:59:24 +00:00
2003-07-11 02:09:41 +00:00
#add -fomit-frame-pointer. v3.2 is buggy for certain platforms!
#CFLAGS += -fomit-frame-pointer
2003-06-15 22:37:45 +00:00
2003-03-03 01:03:50 +00:00
# optimize for SIZE
CFLAGS += -Os
2003-03-03 00:59:24 +00:00
2003-06-01 18:55:11 +00:00
# compile for DEBUGING
2003-03-03 00:59:24 +00:00
#CFLAGS += -g3
2003-03-03 01:02:10 +00:00
#ch1-01-3
2003-03-03 00:59:24 +00: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 22:37:45 +00:00
PROF=x86_prof
2003-07-11 02:09:41 +00:00
TV=tv_gen
2003-03-03 00:59:24 +00:00
#LIBPATH-The directory for libtomcrypt to be installed to.
#INCPATH-The directory to install the header files for libtomcrypt.
2003-03-03 01:03:50 +00:00
#DATAPATH-The directory to install the pdf docs.
DESTDIR=
2003-03-03 00:59:24 +00:00
LIBPATH=/usr/lib
INCPATH=/usr/include
2003-03-03 01:03:50 +00:00
DATAPATH=/usr/share/doc/libtomcrypt/pdf
2003-03-03 00:59:24 +00:00
#List of objects to compile.
2003-07-11 02:09:41 +00:00
#Leave MPI built-in or force developer to link against libtommath?
MPIOBJECT=mpi.o
2003-03-03 01:02:42 +00:00
OBJECTS=keyring.o gf.o mem.o sprng.o ecc.o base64.o dh.o rsa.o \
2003-03-03 00:59:24 +00:00
bits.o yarrow.o cfb.o ofb.o ecb.o ctr.o cbc.o hash.o tiger.o sha1.o \
2003-06-11 21:10:22 +00:00
md5.o md4.o md2.o sha256.o sha512.o xtea.o aes.o des.o \
2003-03-03 01:01:40 +00:00
safer_tab.o safer.o safer+.o rc4.o rc2.o rc6.o rc5.o cast5.o noekeon.o blowfish.o crypt.o \
2004-01-25 17:40:34 +00:00
prime.o twofish.o packet.o hmac.o strings.o rmd128.o rmd160.o skipjack.o omac.o dsa.o eax.o ocb.o $(MPIOBJECT)
2003-03-03 00:59:24 +00:00
TESTOBJECTS=demos/test.o
HASHOBJECTS=demos/hashsum.o
CRYPTOBJECTS=demos/encrypt.o
SMALLOBJECTS=demos/small.o
2003-06-15 22:37:45 +00:00
PROFS=demos/x86_prof.o
2003-07-11 02:09:41 +00:00
TVS=demos/tv_gen.o
2003-03-03 00:59:24 +00: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 18:55:11 +00:00
HEADERS=tommath.h mycrypt_cfg.h mycrypt_gf.h mycrypt_kr.h \
2003-03-03 00:59:24 +00:00
mycrypt_misc.h mycrypt_prng.h mycrypt_cipher.h mycrypt_hash.h \
2003-03-03 01:03:50 +00:00
mycrypt_macros.h mycrypt_pk.h mycrypt.h mycrypt_argchk.h mycrypt_custom.h
2003-03-03 00:59:24 +00: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
2003-12-24 18:59:57 +00:00
twofish.o: twofish.c twofish_tab.c
2003-03-03 00:59:24 +00:00
sha512.o: sha512.c sha384.c
2003-12-24 18:59:57 +00:00
sha256.o: sha256.c sha224.c
2003-03-03 00:59:24 +00:00
#This rule makes the libtomcrypt library.
2003-09-08 01:06:11 +00:00
library: $(LIBNAME)
$(LIBNAME): $(OBJECTS)
$(AR) $(ARFLAGS) $@ $(OBJECTS)
2003-03-03 00:59:24 +00: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 22:37:45 +00:00
x86_prof: library $(PROFS)
2003-07-11 02:09:41 +00:00
$(CC) $(PROFS) $(LIBNAME) -o $(PROF)
tv_gen: library $(TVS)
$(CC) $(TVS) $(LIBNAME) -o $(TV)
2003-03-03 00:59:24 +00: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-03 01:02:10 +00:00
install: library docs
2003-03-03 01:03:50 +00: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-03 00:59:24 +00: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)
2003-07-11 02:09:41 +00:00
rm -f $(TEST) $(HASH) $(COMPRESSED) $(PROFS) $(PROF) $(TVS) $(TV)
2003-12-24 18:59:57 +00:00
rm -f *.a *.dll *stackdump *.lib *.exe *.obj demos/*.obj demos/*.o *.bat *.txt
2003-03-03 00:59:24 +00: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 18:55:11 +00:00
rm -f crypt.pdf $(LEFTOVERS)
2003-03-03 00:59:24 +00:00
latex crypt > /dev/null
makeindex crypt > /dev/null
pdflatex crypt > /dev/null
rm -f $(LEFTOVERS)
2003-03-03 01:02:10 +00:00
2003-07-11 02:09:41 +00:00
#beta
beta: clean
cd .. ; rm -rf crypt* libtomcrypt-$(VERSION)-beta ; mkdir libtomcrypt-$(VERSION)-beta ; \
cp -R ./libtomcrypt/* ./libtomcrypt-$(VERSION)-beta/ ; tar -c libtomcrypt-$(VERSION)-beta/* > crypt-$(VERSION)-beta.tar ; \
bzip2 -9vv crypt-$(VERSION)-beta.tar ; zip -9 -r crypt-$(VERSION)-beta.zip libtomcrypt-$(VERSION)-beta/*
2003-03-03 00:59:24 +00:00
#zipup the project (take that!)
zipup: clean docs
2003-03-03 01:03:50 +00:00
cd .. ; rm -rf crypt* libtomcrypt-$(VERSION) ; mkdir libtomcrypt-$(VERSION) ; \
2003-03-03 00:59:24 +00:00
cp -R ./libtomcrypt/* ./libtomcrypt-$(VERSION)/ ; tar -c libtomcrypt-$(VERSION)/* > crypt-$(VERSION).tar ; \
2003-03-03 01:03:50 +00:00
bzip2 -9vv crypt-$(VERSION).tar ; zip -9 -r crypt-$(VERSION).zip libtomcrypt-$(VERSION)/*