Mercurial > dropbear
comparison makefile @ 143:5d99163f7e32 libtomcrypt-orig
import of libtomcrypt 0.99
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 19 Dec 2004 11:34:45 +0000 |
parents | 6362d3854bb4 |
children | 1c15b283127b |
comparison
equal
deleted
inserted
replaced
15:6362d3854bb4 | 143:5d99163f7e32 |
---|---|
1 # MAKEFILE for linux GCC | 1 # MAKEFILE for linux GCC |
2 # | 2 # |
3 # Tom St Denis | 3 # Tom St Denis |
4 # Modified by Clay Culver | 4 # Modified by Clay Culver |
5 # | |
6 # NOTE: This should later be replaced by autoconf/automake scripts, but for | |
7 # the time being this is actually pretty clean. The only ugly part is | |
8 # handling CFLAGS so that the x86 specific optimizations don't break | |
9 # a build. This is easy to remedy though, for those that have problems. | |
10 | 5 |
11 # The version | 6 # The version |
12 VERSION=0.96 | 7 VERSION=0.99 |
13 | 8 |
14 # Compiler and Linker Names | 9 # Compiler and Linker Names |
15 #CC=gcc | 10 #CC=gcc |
16 #LD=ld | 11 #LD=ld |
17 | 12 |
22 # Compilation flags. Note the += does not write over the user's CFLAGS! | 17 # Compilation flags. Note the += does not write over the user's CFLAGS! |
23 CFLAGS += -c -I./ -Wall -Wsign-compare -W -Wshadow | 18 CFLAGS += -c -I./ -Wall -Wsign-compare -W -Wshadow |
24 # -Werror | 19 # -Werror |
25 | 20 |
26 # optimize for SPEED | 21 # optimize for SPEED |
27 #CFLAGS += -O3 -funroll-loops | 22 #CFLAGS += -O3 -funroll-all-loops |
28 | 23 |
29 #add -fomit-frame-pointer. GCC v3.2 is buggy for certain platforms! | 24 #add -fomit-frame-pointer. hinders debugging! |
30 CFLAGS += -fomit-frame-pointer | 25 #CFLAGS += -fomit-frame-pointer |
31 | 26 |
32 # optimize for SIZE | 27 # optimize for SIZE |
33 CFLAGS += -Os | 28 CFLAGS += -Os -DSMALL_CODE |
34 | 29 |
35 # compile for DEBUGING | 30 # compile for DEBUGING (required for ccmalloc checking!!!) |
36 #CFLAGS += -g3 | 31 #CFLAGS += -g3 |
37 #ch1-01-3 | |
38 | 32 |
39 #These flags control how the library gets built. | 33 #These flags control how the library gets built. |
40 | 34 |
41 #Output filenames for various targets. | 35 #Output filenames for various targets. |
42 LIBNAME=libtomcrypt.a | 36 LIBNAME=libtomcrypt.a |
67 crypt_prng_descriptor.o crypt_register_prng.o crypt_cipher_descriptor.o \ | 61 crypt_prng_descriptor.o crypt_register_prng.o crypt_cipher_descriptor.o \ |
68 crypt_find_cipher_id.o crypt_find_prng.o crypt_prng_is_valid.o \ | 62 crypt_find_cipher_id.o crypt_find_prng.o crypt_prng_is_valid.o \ |
69 crypt_unregister_cipher.o crypt_cipher_is_valid.o crypt_find_hash.o \ | 63 crypt_unregister_cipher.o crypt_cipher_is_valid.o crypt_find_hash.o \ |
70 crypt_hash_descriptor.o crypt_register_cipher.o crypt_unregister_hash.o \ | 64 crypt_hash_descriptor.o crypt_register_cipher.o crypt_unregister_hash.o \ |
71 \ | 65 \ |
72 sprng.o yarrow.o rc4.o rng_get_bytes.o rng_make_prng.o \ | 66 sober128.o fortuna.o sprng.o yarrow.o rc4.o rng_get_bytes.o rng_make_prng.o \ |
73 \ | 67 \ |
74 rand_prime.o is_prime.o \ | 68 rand_prime.o is_prime.o \ |
75 \ | 69 \ |
76 ecc.o dh.o \ | 70 ecc.o dh.o \ |
77 \ | 71 \ |
78 rsa_decrypt_key.o rsa_encrypt_key.o rsa_exptmod.o rsa_free.o rsa_make_key.o \ | 72 rsa_decrypt_key.o rsa_encrypt_key.o rsa_exptmod.o rsa_free.o rsa_make_key.o \ |
79 rsa_sign_hash.o rsa_verify_hash.o rsa_export.o rsa_import.o tim_exptmod.o \ | 73 rsa_sign_hash.o rsa_verify_hash.o rsa_export.o rsa_import.o tim_exptmod.o \ |
74 rsa_v15_encrypt_key.o rsa_v15_decrypt_key.o rsa_v15_sign_hash.o rsa_v15_verify_hash.o \ | |
80 \ | 75 \ |
81 dsa_export.o dsa_free.o dsa_import.o dsa_make_key.o dsa_sign_hash.o \ | 76 dsa_export.o dsa_free.o dsa_import.o dsa_make_key.o dsa_sign_hash.o \ |
82 dsa_verify_hash.o dsa_verify_key.o \ | 77 dsa_verify_hash.o dsa_verify_key.o \ |
83 \ | 78 \ |
84 aes.o aes_enc.o \ | 79 aes.o aes_enc.o \ |
85 \ | 80 \ |
86 blowfish.o des.o safer_tab.o safer.o saferp.o rc2.o xtea.o \ | 81 blowfish.o des.o safer_tab.o safer.o saferp.o rc2.o xtea.o \ |
87 rc6.o rc5.o cast5.o noekeon.o twofish.o skipjack.o \ | 82 rc6.o rc5.o cast5.o noekeon.o twofish.o skipjack.o \ |
88 \ | 83 \ |
89 md2.o md4.o md5.o sha1.o sha256.o sha512.o tiger.o whirl.o \ | 84 md2.o md4.o md5.o sha1.o sha256.o sha512.o tiger.o whirl.o \ |
90 rmd128.o rmd160.o \ | 85 rmd128.o rmd160.o chc.o \ |
91 \ | 86 \ |
92 packet_store_header.o packet_valid_header.o \ | 87 packet_store_header.o packet_valid_header.o \ |
93 \ | 88 \ |
94 eax_addheader.o eax_decrypt.o eax_decrypt_verify_memory.o eax_done.o eax_encrypt.o \ | 89 eax_addheader.o eax_decrypt.o eax_decrypt_verify_memory.o eax_done.o eax_encrypt.o \ |
95 eax_encrypt_authenticate_memory.o eax_init.o eax_test.o \ | 90 eax_encrypt_authenticate_memory.o eax_init.o eax_test.o \ |
117 pkcs_1_pss_encode.o pkcs_1_pss_decode.o pkcs_1_i2osp.o pkcs_1_os2ip.o \ | 112 pkcs_1_pss_encode.o pkcs_1_pss_decode.o pkcs_1_i2osp.o pkcs_1_os2ip.o \ |
118 pkcs_1_v15_es_encode.o pkcs_1_v15_es_decode.o pkcs_1_v15_sa_encode.o pkcs_1_v15_sa_decode.o \ | 113 pkcs_1_v15_es_encode.o pkcs_1_v15_es_decode.o pkcs_1_v15_sa_encode.o pkcs_1_v15_sa_decode.o \ |
119 \ | 114 \ |
120 pkcs_5_1.o pkcs_5_2.o \ | 115 pkcs_5_1.o pkcs_5_2.o \ |
121 \ | 116 \ |
117 der_encode_integer.o der_decode_integer.o der_length_integer.o \ | |
118 der_put_multi_integer.o der_get_multi_integer.o \ | |
119 \ | |
122 burn_stack.o zeromem.o \ | 120 burn_stack.o zeromem.o \ |
121 \ | |
123 $(MPIOBJECT) | 122 $(MPIOBJECT) |
124 | 123 |
125 TESTOBJECTS=demos/test.o | 124 TESTOBJECTS=demos/test.o |
126 HASHOBJECTS=demos/hashsum.o | 125 HASHOBJECTS=demos/hashsum.o |
127 CRYPTOBJECTS=demos/encrypt.o | 126 CRYPTOBJECTS=demos/encrypt.o |
137 | 136 |
138 #Header files used by libtomcrypt. | 137 #Header files used by libtomcrypt. |
139 HEADERS=ltc_tommath.h mycrypt_cfg.h \ | 138 HEADERS=ltc_tommath.h mycrypt_cfg.h \ |
140 mycrypt_misc.h mycrypt_prng.h mycrypt_cipher.h mycrypt_hash.h \ | 139 mycrypt_misc.h mycrypt_prng.h mycrypt_cipher.h mycrypt_hash.h \ |
141 mycrypt_macros.h mycrypt_pk.h mycrypt.h mycrypt_argchk.h \ | 140 mycrypt_macros.h mycrypt_pk.h mycrypt.h mycrypt_argchk.h \ |
142 mycrypt_custom.h mycrypt_pkcs.h | 141 mycrypt_custom.h mycrypt_pkcs.h tommath_class.h tommath_superclass.h |
143 | 142 |
144 #The default rule for make builds the libtomcrypt library. | 143 #The default rule for make builds the libtomcrypt library. |
145 default:library | 144 default:library |
146 | 145 |
147 #ciphers come in two flavours... enc+dec and enc | 146 #ciphers come in two flavours... enc+dec and enc |
148 aes_enc.o: aes.c aes_tab.c | 147 aes_enc.o: aes.c aes_tab.c |
149 $(CC) $(CFLAGS) -DENCRYPT_ONLY -c aes.c -o aes_enc.o | 148 $(CC) $(CFLAGS) -DENCRYPT_ONLY -c aes.c -o aes_enc.o |
150 | 149 |
151 #These are the rules to make certain object files. | 150 #These are the rules to make certain object files. |
151 aes.o: aes.c aes_tab.c | |
152 twofish.o: twofish.c twofish_tab.c | |
153 whirl.o: whirl.c whirltab.c | |
152 ecc.o: ecc.c ecc_sys.c | 154 ecc.o: ecc.c ecc_sys.c |
153 dh.o: dh.c dh_sys.c | 155 dh.o: dh.c dh_sys.c |
154 sha512.o: sha512.c sha384.c | 156 sha512.o: sha512.c sha384.c |
155 sha256.o: sha256.c sha224.c | 157 sha256.o: sha256.c sha224.c |
156 | 158 |
171 #makes the small program | 173 #makes the small program |
172 small: library $(SMALLOBJECTS) | 174 small: library $(SMALLOBJECTS) |
173 $(CC) $(SMALLOBJECTS) $(LIBNAME) -o $(SMALL) $(WARN) | 175 $(CC) $(SMALLOBJECTS) $(LIBNAME) -o $(SMALL) $(WARN) |
174 | 176 |
175 x86_prof: library $(PROFS) | 177 x86_prof: library $(PROFS) |
176 $(CC) $(PROFS) $(LIBNAME) -o $(PROF) | 178 $(CC) $(PROFS) $(LIBNAME) $(EXTRALIBS) -o $(PROF) |
177 | 179 |
178 tv_gen: library $(TVS) | 180 tv_gen: library $(TVS) |
179 $(CC) $(TVS) $(LIBNAME) -o $(TV) | 181 $(CC) $(TVS) $(LIBNAME) $(EXTRALIBS) -o $(TV) |
180 | 182 |
181 #This rule installs the library and the header files. This must be run | 183 #This rule installs the library and the header files. This must be run |
182 #as root in order to have a high enough permission to write to the correct | 184 #as root in order to have a high enough permission to write to the correct |
183 #directories and to set the owner and group to root. | 185 #directories and to set the owner and group to root. |
184 install: library docs | 186 install: library docs |
187 install -d -g root -o root $(DESTDIR)$(DATAPATH) | 189 install -d -g root -o root $(DESTDIR)$(DATAPATH) |
188 install -g root -o root $(LIBNAME) $(DESTDIR)$(LIBPATH) | 190 install -g root -o root $(LIBNAME) $(DESTDIR)$(LIBPATH) |
189 install -g root -o root $(HEADERS) $(DESTDIR)$(INCPATH) | 191 install -g root -o root $(HEADERS) $(DESTDIR)$(INCPATH) |
190 install -g root -o root doc/crypt.pdf $(DESTDIR)$(DATAPATH) | 192 install -g root -o root doc/crypt.pdf $(DESTDIR)$(DATAPATH) |
191 | 193 |
194 install_lib: library | |
195 install -d -g root -o root $(DESTDIR)$(LIBPATH) | |
196 install -d -g root -o root $(DESTDIR)$(INCPATH) | |
197 install -g root -o root $(LIBNAME) $(DESTDIR)$(LIBPATH) | |
198 install -g root -o root $(HEADERS) $(DESTDIR)$(INCPATH) | |
199 | |
192 #This rule cleans the source tree of all compiled code, not including the pdf | 200 #This rule cleans the source tree of all compiled code, not including the pdf |
193 #documentation. | 201 #documentation. |
194 clean: | 202 clean: |
195 rm -f $(OBJECTS) $(TESTOBJECTS) $(HASHOBJECTS) $(CRYPTOBJECTS) $(SMALLOBJECTS) $(LEFTOVERS) $(LIBNAME) | 203 rm -f $(OBJECTS) $(TESTOBJECTS) $(HASHOBJECTS) $(CRYPTOBJECTS) $(SMALLOBJECTS) $(LEFTOVERS) $(LIBNAME) |
196 rm -f $(TEST) $(HASH) $(COMPRESSED) $(PROFS) $(PROF) $(TVS) $(TV) | 204 rm -f $(TEST) $(HASH) $(COMPRESSED) $(PROFS) $(PROF) $(TVS) $(TV) |
197 rm -f *.a *.dll *stackdump *.lib *.exe *.obj demos/*.obj demos/*.o *.bat *.txt *.il *.da demos/*.il demos/*.da *.dyn *.dpi \ | 205 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 \ |
198 *.gcda *.gcno demos/*.gcno demos/*.gcda *~ doc/* | 206 *.gcda *.gcno demos/*.gcno demos/*.gcda *~ doc/* |
199 cd demos/test ; make clean | 207 cd demos/test ; make clean |
200 | 208 rm -rf .libs demos/.libs demos/test/.libs |
209 | |
201 #This builds the crypt.pdf file. Note that the rm -f *.pdf has been removed | 210 #This builds the crypt.pdf file. Note that the rm -f *.pdf has been removed |
202 #from the clean command! This is because most people would like to keep the | 211 #from the clean command! This is because most people would like to keep the |
203 #nice pre-compiled crypt.pdf that comes with libtomcrypt! We only need to | 212 #nice pre-compiled crypt.pdf that comes with libtomcrypt! We only need to |
204 #delete it if we are rebuilding it. | 213 #delete it if we are rebuilding it. |
205 docs: crypt.tex | 214 docs: crypt.tex |
206 rm -f doc/crypt.pdf $(LEFTOVERS) | 215 rm -f doc/crypt.pdf $(LEFTOVERS) |
207 echo "hello" > crypt.ind | 216 echo "hello" > crypt.ind |
208 latex crypt > /dev/null | 217 latex crypt > /dev/null |
209 makeindex crypt > /dev/null | 218 latex crypt > /dev/null |
210 latex crypt > /dev/null | 219 makeindex crypt.idx > /dev/null |
211 latex crypt > /dev/null | 220 latex crypt > /dev/null |
212 dvipdf crypt | 221 dvipdf crypt |
213 mv -ivf crypt.pdf doc/crypt.pdf | 222 mv -ivf crypt.pdf doc/crypt.pdf |
214 rm -f $(LEFTOVERS) | 223 rm -f $(LEFTOVERS) |
215 | 224 |
216 docdvi: crypt.tex | 225 docdvi: crypt.tex |
217 echo hello > crypt.ind | 226 echo hello > crypt.ind |
218 latex crypt > /dev/null | 227 latex crypt > /dev/null |
219 latex crypt > /dev/null | 228 latex crypt > /dev/null |
220 makeindex crypt | 229 makeindex crypt.idx |
221 latex crypt > /dev/null | 230 latex crypt > /dev/null |
222 | 231 |
223 #beta | 232 #pretty build |
224 beta: clean | 233 pretty: |
225 cd .. ; rm -rf crypt* libtomcrypt-$(VERSION)-beta ; mkdir libtomcrypt-$(VERSION)-beta ; \ | 234 perl pretty.build |
226 cp -R ./libtomcrypt/* ./libtomcrypt-$(VERSION)-beta/ ; tar -c libtomcrypt-$(VERSION)-beta/* > crypt-$(VERSION)-beta.tar ; \ | 235 |
227 bzip2 -9vv crypt-$(VERSION)-beta.tar ; zip -9 -r crypt-$(VERSION)-beta.zip libtomcrypt-$(VERSION)-beta/* | 236 #for GCC 3.4+ |
237 profiled: | |
238 make clean | |
239 make CFLAGS="$(CFLAGS) -fprofile-generate" EXTRALIBS=-lgcov x86_prof | |
240 ./x86_prof | |
241 rm *.o *.a x86_prof | |
242 make CFLAGS="$(CFLAGS) -fprofile-use" EXTRALIBS=-lgcov x86_prof | |
228 | 243 |
229 #zipup the project (take that!) | 244 #zipup the project (take that!) |
230 zipup: clean docs | 245 zipup: clean docs |
231 cd .. ; rm -rf crypt* libtomcrypt-$(VERSION) ; mkdir libtomcrypt-$(VERSION) ; \ | 246 cd .. ; rm -rf crypt* libtomcrypt-$(VERSION) ; mkdir libtomcrypt-$(VERSION) ; \ |
232 cp -R ./libtomcrypt/* ./libtomcrypt-$(VERSION)/ ; tar -c libtomcrypt-$(VERSION)/* > crypt-$(VERSION).tar ; \ | 247 cp -R ./libtomcrypt/* ./libtomcrypt-$(VERSION)/ ; tar -c libtomcrypt-$(VERSION)/* > crypt-$(VERSION).tar ; \ |
233 bzip2 -9vv crypt-$(VERSION).tar ; zip -9 -r crypt-$(VERSION).zip libtomcrypt-$(VERSION)/* ; \ | 248 bzip2 -9vv crypt-$(VERSION).tar ; zip -9 -r crypt-$(VERSION).zip libtomcrypt-$(VERSION)/* ; \ |
234 gpg -b -a crypt-$(VERSION).tar.bz2 ; \ | 249 gpg -b -a crypt-$(VERSION).tar.bz2 ; gpg -b -a crypt-$(VERSION).zip |
235 gpg -b -a crypt-$(VERSION).zip |