comparison Makefile.in @ 195:19e5d79b7190 libtomcrypt

Cleanup of import of LTC 1.02, still problematic for Dropbear
author Matt Johnston <matt@ucc.asn.au>
date Mon, 09 May 2005 09:33:00 +0000
parents b4c6e7f276e9
children 704bb050935f
comparison
equal deleted inserted replaced
192:9cc34777b479 195:19e5d79b7190
2 # 2 #
3 # Tom St Denis 3 # Tom St Denis
4 # Modified by Clay Culver 4 # Modified by Clay Culver
5 5
6 # The version 6 # The version
7 VERSION=0.99 7 VERSION=1.02
8 8
9 VPATH=@srcdir@ 9 VPATH=@srcdir@
10 srcdir=@srcdir@ 10 srcdir=@srcdir@
11 11
12 # Compiler and Linker Names 12 # Compiler and Linker Names
17 #AR=ar 17 #AR=ar
18 #ARFLAGS=r 18 #ARFLAGS=r
19 19
20 # Compilation flags. Note the += does not write over the user's CFLAGS! 20 # Compilation flags. Note the += does not write over the user's CFLAGS!
21 # The rest of the flags come from the parent Dropbear makefile 21 # The rest of the flags come from the parent Dropbear makefile
22 CFLAGS += -c -I$(srcdir) 22 CFLAGS += -c -I$(srcdir)/src/headers/ -I$(srcdir)
23 # -Werror 23
24 # additional warnings (newer GCC 3.4 and higher)
25 #CFLAGS += -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wmissing-prototypes \
26 # -Wmissing-declarations -Wpointer-arith
24 27
25 # optimize for SPEED 28 # optimize for SPEED
26 #CFLAGS += -O3 -funroll-all-loops 29 #CFLAGS += -O3 -funroll-loops
27 30
28 #add -fomit-frame-pointer. hinders debugging! 31 # add -fomit-frame-pointer. hinders debugging!
29 #CFLAGS += -fomit-frame-pointer 32 CFLAGS += -fomit-frame-pointer
30 33
31 # optimize for SIZE 34 # optimize for SIZE
32 #CFLAGS += -Os -DSMALL_CODE 35 #CFLAGS += -Os -DLTC_SMALL_CODE
36
37 # older GCCs can't handle the "rotate with immediate" ROLc/RORc/etc macros
38 # define this to help
39 #CFLAGS += -DLTC_NO_ROLC
33 40
34 # compile for DEBUGING (required for ccmalloc checking!!!) 41 # compile for DEBUGING (required for ccmalloc checking!!!)
35 #CFLAGS += -g3 42 #CFLAGS += -g3 -DLTC_NO_ASM
36
37 #These flags control how the library gets built.
38 43
39 #Output filenames for various targets. 44 #Output filenames for various targets.
40 LIBNAME=libtomcrypt.a 45 LIBNAME=libtomcrypt.a
46 LIBTEST=testprof/libtomcrypt_prof.a
41 HASH=hashsum 47 HASH=hashsum
42 CRYPT=encrypt 48 CRYPT=encrypt
43 SMALL=small 49 SMALL=small
44 PROF=x86_prof 50 PROF=x86_prof
45 TV=tv_gen 51 TV=tv_gen
52 MULTI=multi
53 TIMING=timing
54 TEST=test
46 55
47 #LIBPATH-The directory for libtomcrypt to be installed to. 56 #LIBPATH-The directory for libtomcrypt to be installed to.
48 #INCPATH-The directory to install the header files for libtomcrypt. 57 #INCPATH-The directory to install the header files for libtomcrypt.
49 #DATAPATH-The directory to install the pdf docs. 58 #DATAPATH-The directory to install the pdf docs.
50 DESTDIR= 59 DESTDIR=
51 LIBPATH=/usr/lib 60 LIBPATH=/usr/lib
52 INCPATH=/usr/include 61 INCPATH=/usr/include
53 DATAPATH=/usr/share/doc/libtomcrypt/pdf 62 DATAPATH=/usr/share/doc/libtomcrypt/pdf
54 63
64 #Who do we install as?
65 USER=root
66 GROUP=wheel
67
55 #List of objects to compile. 68 #List of objects to compile.
56 69
57 #Leave MPI built-in or force developer to link against libtommath? 70 #Leave MPI built-in or force developer to link against libtommath?
58 #MPIOBJECT=mpi.o 71 #MPIOBJECT=src/misc/mpi/mpi.o
59 #Dropbear uses libtommath 72 #Dropbear uses libtommath
60 MPIOBJECT= 73 MPIOBJECT=
61 74
62 OBJECTS=error_to_string.o mpi_to_ltc_error.o base64_encode.o base64_decode.o \ 75 OBJECTS=src/ciphers/aes/aes_enc.o $(MPIOBJECT) src/ciphers/aes/aes.o \
63 \ 76 src/ciphers/blowfish.o src/ciphers/des.o \
64 crypt.o crypt_find_cipher.o crypt_find_hash_any.o \ 77 src/ciphers/twofish/twofish.o \
65 crypt_hash_is_valid.o crypt_register_hash.o crypt_unregister_prng.o \ 78 src/hashes/helper/hash_memory.o src/hashes/helper/hash_memory_multi.o \
66 crypt_argchk.o crypt_find_cipher_any.o crypt_find_hash_id.o \ 79 src/hashes/md5.o src/hashes/sha1.o src/hashes/sha2/sha256.o \
67 crypt_prng_descriptor.o crypt_register_prng.o crypt_cipher_descriptor.o \ 80 src/hashes/sha2/sha512.o src/hashes/whirl/whirl.o src/mac/hmac/hmac_done.o \
68 crypt_find_cipher_id.o crypt_find_prng.o crypt_prng_is_valid.o \ 81 src/mac/hmac/hmac_file.o src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o \
69 crypt_unregister_cipher.o crypt_cipher_is_valid.o crypt_find_hash.o \ 82 src/mac/hmac/hmac_memory_multi.o src/mac/hmac/hmac_process.o src/mac/hmac/hmac_test.o \
70 crypt_hash_descriptor.o crypt_register_cipher.o crypt_unregister_hash.o \ 83 src/misc/base64/base64_decode.o \
71 \ 84 src/misc/base64/base64_encode.o src/misc/burn_stack.o src/misc/crypt/crypt.o \
72 rand_prime.o is_prime.o \ 85 src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt_cipher_descriptor.o \
73 \ 86 src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_find_cipher.o \
74 aes.o \ 87 src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher_id.o \
75 \ 88 src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_any.o \
76 blowfish.o des.o \ 89 src/misc/crypt/crypt_find_hash_id.o src/misc/crypt/crypt_find_prng.o \
77 twofish.o \ 90 src/misc/crypt/crypt_hash_descriptor.o src/misc/crypt/crypt_hash_is_valid.o \
78 \ 91 src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
79 md5.o sha1.o sha512.o \ 92 src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
80 \ 93 src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_unregister_cipher.o \
81 cbc_start.o cbc_encrypt.o cbc_decrypt.o cbc_getiv.o cbc_setiv.o \ 94 src/misc/crypt/crypt_unregister_hash.o src/misc/crypt/crypt_unregister_prng.o \
82 ecb_start.o ecb_encrypt.o ecb_decrypt.o \ 95 src/misc/error_to_string.o src/misc/mpi/is_prime.o src/misc/mpi/mpi_to_ltc_error.o \
83 \ 96 src/misc/mpi/rand_prime.o src/misc/zeromem.o \
84 hash_memory.o \ 97 src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \
85 \ 98 src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \
86 hmac_done.o hmac_file.o hmac_init.o hmac_memory.o hmac_process.o hmac_test.o \ 99 src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \
87 \ 100 src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o \
88 burn_stack.o zeromem.o \ 101 src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
89 \ 102 src/modes/ofb/ofb_start.o src/pk/asn1/der/der_decode_integer.o \
90 $(MPIOBJECT) 103 src/prngs/rng_get_bytes.o \
104 src/prngs/rng_make_prng.o src/prngs/sober128.o src/prngs/sprng.o src/prngs/yarrow.o
105
106 HEADERS=src/headers/tommath_superclass.h src/headers/tomcrypt_cfg.h \
107 src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h \
108 src/headers/tomcrypt_custom.h src/headers/tomcrypt_argchk.h \
109 src/headers/tomcrypt_cipher.h src/headers/tomcrypt_pk.h \
110 src/headers/tommath_class.h src/headers/ltc_tommath.h src/headers/tomcrypt_hash.h \
111 src/headers/tomcrypt_misc.h src/headers/tomcrypt.h src/headers/tomcrypt_pkcs.h \
112 src/headers/tomcrypt_prng.h testprof/tomcrypt_test.h
91 113
92 TESTOBJECTS=demos/test.o 114 TESTOBJECTS=demos/test.o
93 HASHOBJECTS=demos/hashsum.o 115 HASHOBJECTS=demos/hashsum.o
94 CRYPTOBJECTS=demos/encrypt.o 116 CRYPTOBJECTS=demos/encrypt.o
95 SMALLOBJECTS=demos/small.o 117 SMALLOBJECTS=demos/small.o
96 PROFS=demos/x86_prof.o
97 TVS=demos/tv_gen.o 118 TVS=demos/tv_gen.o
119 MULTIS=demos/multi.o
120 TIMINGS=demos/timing.o
121 TESTS=demos/test.o
98 122
99 #Files left over from making the crypt.pdf. 123 #Files left over from making the crypt.pdf.
100 LEFTOVERS=*.dvi *.log *.aux *.toc *.idx *.ilg *.ind *.out 124 LEFTOVERS=*.dvi *.log *.aux *.toc *.idx *.ilg *.ind *.out
101 125
102 #Compressed filenames 126 #Compressed filenames
103 COMPRESSED=crypt-$(VERSION).tar.bz2 crypt-$(VERSION).zip 127 COMPRESSED=crypt-$(VERSION).tar.bz2 crypt-$(VERSION).zip
104 128
105 #Header files used by libtomcrypt.
106 HEADERS=ltc_tommath.h mycrypt_cfg.h \
107 mycrypt_misc.h mycrypt_prng.h mycrypt_cipher.h mycrypt_hash.h \
108 mycrypt_macros.h mycrypt_pk.h mycrypt.h mycrypt_argchk.h \
109 mycrypt_custom.h mycrypt_pkcs.h
110
111 #The default rule for make builds the libtomcrypt library. 129 #The default rule for make builds the libtomcrypt library.
112 default:library 130 default:library
113 131
114 #ciphers come in two flavours... enc+dec and enc 132 #ciphers come in two flavours... enc+dec and enc
115 aes_enc.o: aes.c aes_tab.c 133 src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
116 $(CC) $(CFLAGS) -DENCRYPT_ONLY -c $(srcdir)/aes.c -o aes_enc.o 134 $(CC) $(CFLAGS) -DENCRYPT_ONLY -c src/ciphers/aes/aes.c -o src/ciphers/aes/aes_enc.o
117 135
118 #These are the rules to make certain object files. 136 #These are the rules to make certain object files.
119 aes.o: aes.c aes_tab.c 137 src/ciphers/aes/aes.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
120 twofish.o: twofish.c twofish_tab.c 138 src/ciphers/twofish/twofish.o: src/ciphers/twofish/twofish.c src/ciphers/twofish/twofish_tab.c
121 whirl.o: whirl.c whirltab.c 139 src/hashes/whirl/whirl.o: src/hashes/whirl/whirl.c src/hashes/whirl/whirltab.c
122 ecc.o: ecc.c ecc_sys.c 140 src/pk/ecc/ecc.o: src/pk/ecc/ecc.c src/pk/ecc/ecc_sys.c
123 dh.o: dh.c dh_sys.c 141 src/pk/dh/dh.o: src/pk/dh/dh.c src/pk/dh/dh_sys.c
124 sha512.o: sha512.c sha384.c 142 src/hashes/sha2/sha512.o: src/hashes/sha2/sha512.c src/hashes/sha2/sha384.c
125 sha256.o: sha256.c sha224.c 143 src/hashes/sha2/sha256.o: src/hashes/sha2/sha256.c src/hashes/sha2/sha224.c
126 144
127 #This rule makes the libtomcrypt library. 145 #This rule makes the libtomcrypt library.
128 library: $(LIBNAME) 146 library: $(LIBTEST) $(LIBNAME)
147
148 $(LIBTEST):
149 cd testprof ; CFLAGS="$(CFLAGS)" make
129 150
130 $(LIBNAME): $(OBJECTS) 151 $(LIBNAME): $(OBJECTS)
131 $(AR) $(ARFLAGS) $@ $(OBJECTS) 152 $(AR) $(ARFLAGS) $@ $(OBJECTS)
132 $(RANLIB) $@ 153 $(RANLIB) $(LIBNAME)
133 154
134 #This rule makes the hash program included with libtomcrypt 155 #This rule makes the hash program included with libtomcrypt
135 hashsum: library $(HASHOBJECTS) 156 hashsum: library $(HASHOBJECTS)
136 $(CC) $(HASHOBJECTS) $(LIBNAME) -o $(HASH) $(WARN) 157 $(CC) $(HASHOBJECTS) $(LIBNAME) -o $(HASH) $(WARN)
137 158
141 162
142 #makes the small program 163 #makes the small program
143 small: library $(SMALLOBJECTS) 164 small: library $(SMALLOBJECTS)
144 $(CC) $(SMALLOBJECTS) $(LIBNAME) -o $(SMALL) $(WARN) 165 $(CC) $(SMALLOBJECTS) $(LIBNAME) -o $(SMALL) $(WARN)
145 166
146 x86_prof: library $(PROFS)
147 $(CC) $(PROFS) $(LIBNAME) $(EXTRALIBS) -o $(PROF)
148
149 tv_gen: library $(TVS) 167 tv_gen: library $(TVS)
150 $(CC) $(TVS) $(LIBNAME) $(EXTRALIBS) -o $(TV) 168 $(CC) $(TVS) $(LIBNAME) $(EXTRALIBS) -o $(TV)
169
170 multi: library $(MULTIS)
171 $(CC) $(MULTIS) $(LIBNAME) -o $(MULTI)
172
173 timing: library $(TIMINGS)
174 $(CC) $(TIMINGS) $(LIBTEST) $(LIBNAME) -o $(TIMING)
175
176 test: library $(TESTS)
177 $(CC) $(TESTS) $(LIBTEST) $(LIBNAME) -o $(TEST)
178
151 179
152 #This rule installs the library and the header files. This must be run 180 #This rule installs the library and the header files. This must be run
153 #as root in order to have a high enough permission to write to the correct 181 #as root in order to have a high enough permission to write to the correct
154 #directories and to set the owner and group to root. 182 #directories and to set the owner and group to root.
155 install: library docs 183 install: library docs
156 install -d -g root -o root $(DESTDIR)$(LIBPATH) 184 install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
157 install -d -g root -o root $(DESTDIR)$(INCPATH) 185 install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
158 install -d -g root -o root $(DESTDIR)$(DATAPATH) 186 install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(DATAPATH)
159 install -g root -o root $(LIBNAME) $(DESTDIR)$(LIBPATH) 187 install -g $(GROUP) -o $(USER) $(LIBNAME) $(DESTDIR)$(LIBPATH)
160 install -g root -o root $(HEADERS) $(DESTDIR)$(INCPATH) 188 install -g $(GROUP) -o $(USER) $(HEADERS) $(DESTDIR)$(INCPATH)
161 install -g root -o root doc/crypt.pdf $(DESTDIR)$(DATAPATH) 189 install -g $(GROUP) -o $(USER) doc/crypt.pdf $(DESTDIR)$(DATAPATH)
162 190
163 install_lib: library 191 install_lib: library
164 install -d -g root -o root $(DESTDIR)$(LIBPATH) 192 install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
165 install -d -g root -o root $(DESTDIR)$(INCPATH) 193 install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
166 install -g root -o root $(LIBNAME) $(DESTDIR)$(LIBPATH) 194 install -g $(GROUP) -o $(USER) $(LIBNAME) $(DESTDIR)$(LIBPATH)
167 install -g root -o root $(HEADERS) $(DESTDIR)$(INCPATH) 195 install -g $(GROUP) -o $(USER) $(HEADERS) $(DESTDIR)$(INCPATH)
168 196
169 #This rule cleans the source tree of all compiled code, not including the pdf 197 #This rule cleans the source tree of all compiled code, not including the pdf
170 #documentation. 198 #documentation.
171 clean: 199 clean:
172 -rm -f $(OBJECTS) $(TESTOBJECTS) $(HASHOBJECTS) $(CRYPTOBJECTS) $(SMALLOBJECTS) $(LEFTOVERS) $(LIBNAME) 200 rm -f `find . -type f | grep "[.]o" | xargs`
173 -rm -f $(TEST) $(HASH) $(COMPRESSED) $(PROFS) $(PROF) $(TVS) $(TV) 201 rm -f `find . -type f | grep "[.]lo" | xargs`
174 -rm -f *.la *.lo *.o *.a *.dll *stackdump *.lib *.exe *.obj demos/*.obj demos/*.o *.bat *.txt *.il *.da demos/*.il demos/*.da *.dyn *.dpi \ 202 rm -f `find . -type f | grep "[.]a" | xargs`
175 *.gcda *.gcno demos/*.gcno demos/*.gcda *~ doc/* 203 rm -f `find . -type f | grep "[.]la" | xargs`
176 -cd demos/test && make clean 204 rm -f `find . -type f | grep "[.]obj" | xargs`
177 -rm -rf .libs demos/.libs demos/test/.libs 205 rm -f `find . -type f | grep "[.]lib" | xargs`
206 rm -f `find . -type f | grep "[.]exe" | xargs`
207 rm -f `find . -type f | grep "[.]gcda" | xargs`
208 rm -f `find . -type f | grep "[.]gcno" | xargs`
209 rm -f `find . -type f | grep "[.]il" | xargs`
210 rm -f `find . -type f | grep "[.]dyn" | xargs`
211 rm -f `find . -type f | grep "[.]dpi" | xargs`
212 rm -rf `find . -type d | grep "[.]libs" | xargs`
213 rm -f crypt.aux crypt.dvi crypt.idx crypt.ilg crypt.ind crypt.log crypt.toc
214 rm -f $(TV) $(PROF) $(SMALL) $(CRYPT) $(HASHSUM) $(MULTI) $(TIMING) $(TEST)
215 rm -rf doc/doxygen
216 rm -f doc/*.pdf
217
218 #build the doxy files (requires Doxygen, tetex and patience)
219 doxy:
220 doxygen
221 cd doc/doxygen/latex ; make ; mv -f refman.pdf ../../.
222 echo The huge doxygen PDF should be available as doc/refman.pdf
178 223
179 #This builds the crypt.pdf file. Note that the rm -f *.pdf has been removed 224 #This builds the crypt.pdf file. Note that the rm -f *.pdf has been removed
180 #from the clean command! This is because most people would like to keep the 225 #from the clean command! This is because most people would like to keep the
181 #nice pre-compiled crypt.pdf that comes with libtomcrypt! We only need to 226 #nice pre-compiled crypt.pdf that comes with libtomcrypt! We only need to
182 #delete it if we are rebuilding it. 227 #delete it if we are rebuilding it.
183 docs: crypt.tex 228 docs: crypt.tex
184 -rm -f doc/crypt.pdf $(LEFTOVERS) 229 rm -f doc/crypt.pdf $(LEFTOVERS)
185 echo "hello" > crypt.ind 230 echo "hello" > crypt.ind
186 latex crypt > /dev/null 231 latex crypt > /dev/null
187 latex crypt > /dev/null 232 latex crypt > /dev/null
188 makeindex crypt.idx > /dev/null 233 makeindex crypt.idx > /dev/null
189 latex crypt > /dev/null 234 latex crypt > /dev/null
190 dvipdf crypt 235 dvipdf crypt
191 mv -ivf crypt.pdf doc/crypt.pdf 236 mv -ivf crypt.pdf doc/crypt.pdf
192 -rm -f $(LEFTOVERS) 237 rm -f $(LEFTOVERS)
193 238
194 docdvi: crypt.tex 239 docdvi: crypt.tex
195 echo hello > crypt.ind 240 echo hello > crypt.ind
196 latex crypt > /dev/null 241 latex crypt > /dev/null
197 latex crypt > /dev/null 242 latex crypt > /dev/null
198 makeindex crypt.idx 243 makeindex crypt.idx
199 latex crypt > /dev/null 244 latex crypt > /dev/null
200 245
201 #pretty build
202 pretty:
203 perl pretty.build
204
205 #for GCC 3.4+
206 profiled:
207 make clean
208 make CFLAGS="$(CFLAGS) -fprofile-generate" EXTRALIBS=-lgcov x86_prof
209 ./x86_prof
210 rm *.o *.a x86_prof
211 make CFLAGS="$(CFLAGS) -fprofile-use" EXTRALIBS=-lgcov x86_prof
212
213 #zipup the project (take that!) 246 #zipup the project (take that!)
214 zipup: clean docs 247 no_oops: clean
248 cd .. ; cvs commit
249
250 zipup: no_oops docs
215 cd .. ; rm -rf crypt* libtomcrypt-$(VERSION) ; mkdir libtomcrypt-$(VERSION) ; \ 251 cd .. ; rm -rf crypt* libtomcrypt-$(VERSION) ; mkdir libtomcrypt-$(VERSION) ; \
216 cp -R ./libtomcrypt/* ./libtomcrypt-$(VERSION)/ ; tar -c libtomcrypt-$(VERSION)/* > crypt-$(VERSION).tar ; \ 252 cp -R ./libtomcrypt/* ./libtomcrypt-$(VERSION)/ ; \
217 bzip2 -9vv crypt-$(VERSION).tar ; zip -9 -r crypt-$(VERSION).zip libtomcrypt-$(VERSION)/* ; \ 253 cd libtomcrypt-$(VERSION) ; rm -rf `find . -type d | grep CVS | xargs` ; cd .. ; \
218 gpg -b -a crypt-$(VERSION).tar.bz2 ; gpg -b -a crypt-$(VERSION).zip 254 tar -cjvf crypt-$(VERSION).tar.bz2 libtomcrypt-$(VERSION) ; \
255 zip -9r crypt-$(VERSION).zip libtomcrypt-$(VERSION) ; \
256 gpg -b -a crypt-$(VERSION).tar.bz2 ; gpg -b -a crypt-$(VERSION).zip ; \
257 mv -fv crypt* ~ ; rm -rf libtomcrypt-$(VERSION)