comparison makefile @ 0:d7da3b1e1540 libtomcrypt

put back the 0.95 makefile which was inadvertently merged over
author Matt Johnston <matt@ucc.asn.au>
date Mon, 31 May 2004 18:21:40 +0000
parents
children 059ec00f32a1
comparison
equal deleted inserted replaced
-1:000000000000 0:d7da3b1e1540
1 # MAKEFILE for linux GCC
2 #
3 # Tom St Denis
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
11 # The version
12 VERSION=0.95
13
14 #ch1-01-1
15 # Compiler and Linker Names
16 #CC=gcc
17 #LD=ld
18
19 # Archiver [makes .a files]
20 #AR=ar
21 #ARFLAGS=r
22 #ch1-01-1
23
24 #ch1-01-3
25 # Compilation flags. Note the += does not write over the user's CFLAGS!
26 # The rest of the flags come from the parent Dropbear makefile
27 CFLAGS += -c -I./
28 # -Werror
29
30 # optimize for SPEED
31 #CFLAGS += -O3 -funroll-loops
32
33 #add -fomit-frame-pointer. v3.2 is buggy for certain platforms!
34 #CFLAGS += -fomit-frame-pointer
35
36 # optimize for SIZE
37 #CFLAGS += -Os
38
39 # compile for DEBUGING
40 #CFLAGS += -g3
41 #ch1-01-3
42
43 #These flags control how the library gets built.
44
45 #Output filenames for various targets.
46 LIBNAME=libtomcrypt.a
47 TEST=test
48 HASH=hashsum
49 CRYPT=encrypt
50 SMALL=small
51 PROF=x86_prof
52 TV=tv_gen
53
54 #LIBPATH-The directory for libtomcrypt to be installed to.
55 #INCPATH-The directory to install the header files for libtomcrypt.
56 #DATAPATH-The directory to install the pdf docs.
57 DESTDIR=
58 LIBPATH=/usr/lib
59 INCPATH=/usr/include
60 DATAPATH=/usr/share/doc/libtomcrypt/pdf
61
62 #List of objects to compile.
63
64 #Leave MPI built-in or force developer to link against libtommath?
65 MPIOBJECT=mpi.o
66
67 OBJECTS=keyring.o gf.o base64.o \
68 \
69 crypt.o crypt_find_cipher.o crypt_find_hash_any.o \
70 crypt_hash_is_valid.o crypt_register_hash.o crypt_unregister_prng.o \
71 crypt_argchk.o crypt_find_cipher_any.o crypt_find_hash_id.o \
72 crypt_prng_descriptor.o crypt_register_prng.o crypt_cipher_descriptor.o \
73 crypt_find_cipher_id.o crypt_find_prng.o crypt_prng_is_valid.o \
74 crypt_unregister_cipher.o crypt_cipher_is_valid.o crypt_find_hash.o \
75 crypt_hash_descriptor.o crypt_register_cipher.o crypt_unregister_hash.o \
76 \
77 sprng.o yarrow.o rc4.o rng_get_bytes.o rng_make_prng.o \
78 \
79 rand_prime.o is_prime.o \
80 \
81 ecc.o dh.o \
82 \
83 rsa.o rsa_exptmod.o rsa_free.o rsa_make_key.o \
84 \
85 dsa_export.o dsa_free.o dsa_import.o dsa_make_key.o dsa_sign_hash.o dsa_verify_hash.o dsa_verify_key.o \
86 \
87 xtea.o aes.o des.o safer_tab.o safer.o saferp.o rc2.o \
88 rc6.o rc5.o cast5.o noekeon.o blowfish.o twofish.o skipjack.o \
89 \
90 md2.o md4.o md5.o sha1.o sha256.o sha512.o tiger.o whirl.o \
91 rmd128.o rmd160.o \
92 \
93 packet_store_header.o packet_valid_header.o \
94 \
95 eax_addheader.o eax_decrypt.o eax_decrypt_verify_memory.o eax_done.o eax_encrypt.o \
96 eax_encrypt_authenticate_memory.o eax_init.o eax_test.o \
97 \
98 ocb_decrypt.o ocb_decrypt_verify_memory.o ocb_done_decrypt.o ocb_done_encrypt.o \
99 ocb_encrypt.o ocb_encrypt_authenticate_memory.o ocb_init.o ocb_ntz.o \
100 ocb_shift_xor.o ocb_test.o s_ocb_done.o \
101 \
102 omac_done.o omac_file.o omac_init.o omac_memory.o omac_process.o omac_test.o \
103 \
104 pmac_done.o pmac_file.o pmac_init.o pmac_memory.o pmac_ntz.o pmac_process.o \
105 pmac_shift_xor.o pmac_test.o \
106 \
107 cbc_start.o cbc_encrypt.o cbc_decrypt.o \
108 cfb_start.o cfb_encrypt.o cfb_decrypt.o \
109 ofb_start.o ofb_encrypt.o ofb_decrypt.o \
110 ctr_start.o ctr_encrypt.o ctr_decrypt.o \
111 ecb_start.o ecb_encrypt.o ecb_decrypt.o \
112 \
113 hash_file.o hash_filehandle.o hash_memory.o \
114 \
115 hmac_done.o hmac_file.o hmac_init.o hmac_memory.o hmac_process.o hmac_test.o \
116 \
117 pkcs_1_mgf1.o pkcs_1_oaep_encode.o pkcs_1_oaep_decode.o \
118 pkcs_1_pss_encode.o pkcs_1_pss_decode.o pkcs_1_i2osp.o pkcs_1_os2ip.o \
119 \
120 pkcs_5_1.o pkcs_5_2.o \
121 \
122 burn_stack.o zeromem.o \
123 $(MPIOBJECT)
124
125 TESTOBJECTS=demos/test.o
126 HASHOBJECTS=demos/hashsum.o
127 CRYPTOBJECTS=demos/encrypt.o
128 SMALLOBJECTS=demos/small.o
129 PROFS=demos/x86_prof.o
130 TVS=demos/tv_gen.o
131
132 #Files left over from making the crypt.pdf.
133 LEFTOVERS=*.dvi *.log *.aux *.toc *.idx *.ilg *.ind
134
135 #Compressed filenames
136 COMPRESSED=crypt.tar.bz2 crypt.zip crypt.tar.gz
137
138 #Header files used by libtomcrypt.
139 HEADERS=tommath.h mycrypt_cfg.h mycrypt_gf.h mycrypt_kr.h \
140 mycrypt_misc.h mycrypt_prng.h mycrypt_cipher.h mycrypt_hash.h \
141 mycrypt_macros.h mycrypt_pk.h mycrypt.h mycrypt_argchk.h \
142 mycrypt_custom.h mycrypt_pkcs.h
143
144 #The default rule for make builds the libtomcrypt library.
145 default:library mycrypt.h mycrypt_cfg.h
146
147 #These are the rules to make certain object files.
148 rsa.o: rsa.c rsa_sys.c
149 ecc.o: ecc.c ecc_sys.c
150 dh.o: dh.c dh_sys.c
151 aes.o: aes.c aes_tab.c
152 twofish.o: twofish.c twofish_tab.c
153 sha512.o: sha512.c sha384.c
154 sha256.o: sha256.c sha224.c
155
156 #This rule makes the libtomcrypt library.
157 library: $(LIBNAME)
158
159 $(LIBNAME): $(OBJECTS)
160 $(AR) $(ARFLAGS) $@ $(OBJECTS)
161
162 #This rule makes the test program included with libtomcrypt
163 test: library $(TESTOBJECTS)
164 $(CC) $(TESTOBJECTS) $(LIBNAME) -o $(TEST) $(WARN)
165
166 #This rule makes the hash program included with libtomcrypt
167 hashsum: library $(HASHOBJECTS)
168 $(CC) $(HASHOBJECTS) $(LIBNAME) -o $(HASH) $(WARN)
169
170 #makes the crypt program
171 crypt: library $(CRYPTOBJECTS)
172 $(CC) $(CRYPTOBJECTS) $(LIBNAME) -o $(CRYPT) $(WARN)
173
174 #makes the small program
175 small: library $(SMALLOBJECTS)
176 $(CC) $(SMALLOBJECTS) $(LIBNAME) -o $(SMALL) $(WARN)
177
178 x86_prof: library $(PROFS)
179 $(CC) $(PROFS) $(LIBNAME) -o $(PROF)
180
181 tv_gen: library $(TVS)
182 $(CC) $(TVS) $(LIBNAME) -o $(TV)
183
184
185 #make a profiled library (takes a while!!!)
186 #
187 # This will build the library with profile generation
188 # then run the test demo and rebuild the library.
189 #
190 # So far I've seen improvements in the MP math
191 #
192 # This works with GCC v3.3.x [tested with 3.3.3]
193 profiled: $(TESTOBJECTS)
194 make CFLAGS="$(CFLAGS) -fprofile-arcs"
195 $(CC) $(TESTOBJECTS) $(LIBNAME) -o $(TEST)
196 ./test
197 rm -f *.a *.o test demos/test.o
198 make CFLAGS="$(CFLAGS) -fbranch-probabilities"
199
200
201 #Profiling in GCC 3.4.x is a little diff.
202 #
203 #Tested with GCC v3.4.0
204 profiled34: $(TESTOBJECTS)
205 make CFLAGS="$(CFLAGS) -fprofile-generate"
206 $(CC) $(TESTOBJECTS) $(LIBNAME) -lgcov -o $(TEST)
207 ./test
208 rm -f *.a *.o test demos/test.o
209 make CFLAGS="$(CFLAGS) -fprofile-use"
210
211
212 #This rule installs the library and the header files. This must be run
213 #as root in order to have a high enough permission to write to the correct
214 #directories and to set the owner and group to root.
215 install: library docs
216 install -d -g root -o root $(DESTDIR)$(LIBPATH)
217 install -d -g root -o root $(DESTDIR)$(INCPATH)
218 install -d -g root -o root $(DESTDIR)$(DATAPATH)
219 install -g root -o root $(LIBNAME) $(DESTDIR)$(LIBPATH)
220 install -g root -o root $(HEADERS) $(DESTDIR)$(INCPATH)
221 install -g root -o root crypt.pdf $(DESTDIR)$(DATAPATH)
222
223 #This rule cleans the source tree of all compiled code, not including the pdf
224 #documentation.
225 clean:
226 rm -f $(OBJECTS) $(TESTOBJECTS) $(HASHOBJECTS) $(CRYPTOBJECTS) $(SMALLOBJECTS) $(LEFTOVERS) $(LIBNAME)
227 rm -f $(TEST) $(HASH) $(COMPRESSED) $(PROFS) $(PROF) $(TVS) $(TV)
228 rm -f *.a *.dll *stackdump *.lib *.exe *.obj demos/*.obj demos/*.o *.bat *.txt *.il *.da demos/*.il demos/*.da *.dyn *.dpi \
229 *.gcda *.gcno demos/*.gcno demos/*.gcda *~
230
231 #This builds the crypt.pdf file. Note that the rm -f *.pdf has been removed
232 #from the clean command! This is because most people would like to keep the
233 #nice pre-compiled crypt.pdf that comes with libtomcrypt! We only need to
234 #delete it if we are rebuilding it.
235 docs: crypt.tex
236 rm -f crypt.pdf $(LEFTOVERS)
237 latex crypt > /dev/null
238 makeindex crypt > /dev/null
239 latex crypt > /dev/null
240 latex crypt > /dev/null
241 dvipdf crypt
242 rm -f $(LEFTOVERS)
243
244 #beta
245 beta: clean
246 cd .. ; rm -rf crypt* libtomcrypt-$(VERSION)-beta ; mkdir libtomcrypt-$(VERSION)-beta ; \
247 cp -R ./libtomcrypt/* ./libtomcrypt-$(VERSION)-beta/ ; tar -c libtomcrypt-$(VERSION)-beta/* > crypt-$(VERSION)-beta.tar ; \
248 bzip2 -9vv crypt-$(VERSION)-beta.tar ; zip -9 -r crypt-$(VERSION)-beta.zip libtomcrypt-$(VERSION)-beta/*
249
250 #zipup the project (take that!)
251 zipup: clean docs
252 cd .. ; rm -rf crypt* libtomcrypt-$(VERSION) ; mkdir libtomcrypt-$(VERSION) ; \
253 cp -R ./libtomcrypt/* ./libtomcrypt-$(VERSION)/ ; tar -c libtomcrypt-$(VERSION)/* > crypt-$(VERSION).tar ; \
254 bzip2 -9vv crypt-$(VERSION).tar ; zip -9 -r crypt-$(VERSION).zip libtomcrypt-$(VERSION)/*