Changes to update Tomato RAF.
[tomato.git] / release / src / router / dropbear / libtomcrypt / Makefile
blob8ef579edf581d962b4e46b889d557a9c8cfae91b
1 # MAKEFILE for linux GCC
3 # Tom St Denis
4 # Modified by Clay Culver
6 # The version
7 VERSION=1.16
10 srcdir=.
12 # Compiler and Linker Names
13 #CC=gcc
14 #LD=ld
16 # Archiver [makes .a files]
17 #AR=ar
18 #ARFLAGS=r
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
22 CFLAGS += -c -I$(srcdir)/src/headers/ -I$(srcdir)/../
24 # additional warnings (newer GCC 3.4 and higher)
25 ifdef GCC_34
26 CFLAGS += -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wmissing-prototypes \
27 -Wmissing-declarations -Wpointer-arith
28 endif
30 ifndef IGNORE_SPEED
32 # optimize for SPEED
33 #CFLAGS += -O3 -funroll-loops
35 # add -fomit-frame-pointer. hinders debugging!
36 #CFLAGS += -fomit-frame-pointer
38 # optimize for SIZE
39 #CFLAGS += -Os -DLTC_SMALL_CODE
41 endif
43 # older GCCs can't handle the "rotate with immediate" ROLc/RORc/etc macros
44 # define this to help
45 #CFLAGS += -DLTC_NO_ROLC
47 # compile for DEBUGING (required for ccmalloc checking!!!)
48 #CFLAGS += -g3 -DLTC_NO_ASM
50 #Output filenames for various targets.
51 ifndef LIBNAME
52 LIBNAME=libtomcrypt.a
53 endif
54 ifndef LIBTEST
55 LIBTEST=libtomcrypt_prof.a
56 endif
57 LIBTEST_S=$(LIBTEST)
59 HASH=hashsum
60 CRYPT=encrypt
61 SMALL=small
62 PROF=x86_prof
63 TV=tv_gen
64 MULTI=multi
65 TIMING=timing
66 TEST=test
68 #LIBPATH-The directory for libtomcrypt to be installed to.
69 #INCPATH-The directory to install the header files for libtomcrypt.
70 #DATAPATH-The directory to install the pdf docs.
71 ifndef DESTDIR
72 DESTDIR=
73 endif
75 ifndef LIBPATH
76 LIBPATH=/usr/lib
77 endif
78 ifndef INCPATH
79 INCPATH=/usr/include
80 endif
81 ifndef DATAPATH
82 DATAPATH=/usr/share/doc/libtomcrypt/pdf
83 endif
85 #Who do we install as?
86 ifdef INSTALL_USER
87 USER=$(INSTALL_USER)
88 else
89 USER=root
90 endif
92 ifdef INSTALL_GROUP
93 GROUP=$(INSTALL_GROUP)
94 else
95 GROUP=wheel
96 endif
98 #List of objects to compile.
99 #START_INS
100 OBJECTS=src/ciphers/aes/aes_enc.o src/ciphers/aes/aes.o src/ciphers/anubis.o src/ciphers/blowfish.o \
101 src/ciphers/cast5.o src/ciphers/des.o src/ciphers/kasumi.o src/ciphers/khazad.o src/ciphers/kseed.o \
102 src/ciphers/noekeon.o src/ciphers/rc2.o src/ciphers/rc5.o src/ciphers/rc6.o src/ciphers/safer/safer.o \
103 src/ciphers/safer/safer_tab.o src/ciphers/safer/saferp.o src/ciphers/skipjack.o \
104 src/ciphers/twofish/twofish.o src/ciphers/xtea.o src/encauth/ccm/ccm_memory.o \
105 src/encauth/ccm/ccm_test.o src/encauth/eax/eax_addheader.o src/encauth/eax/eax_decrypt.o \
106 src/encauth/eax/eax_decrypt_verify_memory.o src/encauth/eax/eax_done.o src/encauth/eax/eax_encrypt.o \
107 src/encauth/eax/eax_encrypt_authenticate_memory.o src/encauth/eax/eax_init.o \
108 src/encauth/eax/eax_test.o src/encauth/gcm/gcm_add_aad.o src/encauth/gcm/gcm_add_iv.o \
109 src/encauth/gcm/gcm_done.o src/encauth/gcm/gcm_gf_mult.o src/encauth/gcm/gcm_init.o \
110 src/encauth/gcm/gcm_memory.o src/encauth/gcm/gcm_mult_h.o src/encauth/gcm/gcm_process.o \
111 src/encauth/gcm/gcm_reset.o src/encauth/gcm/gcm_test.o src/encauth/ocb/ocb_decrypt.o \
112 src/encauth/ocb/ocb_decrypt_verify_memory.o src/encauth/ocb/ocb_done_decrypt.o \
113 src/encauth/ocb/ocb_done_encrypt.o src/encauth/ocb/ocb_encrypt.o \
114 src/encauth/ocb/ocb_encrypt_authenticate_memory.o src/encauth/ocb/ocb_init.o src/encauth/ocb/ocb_ntz.o \
115 src/encauth/ocb/ocb_shift_xor.o src/encauth/ocb/ocb_test.o src/encauth/ocb/s_ocb_done.o \
116 src/hashes/chc/chc.o src/hashes/helper/hash_file.o src/hashes/helper/hash_filehandle.o \
117 src/hashes/helper/hash_memory.o src/hashes/helper/hash_memory_multi.o src/hashes/md2.o src/hashes/md4.o \
118 src/hashes/md5.o src/hashes/rmd128.o src/hashes/rmd160.o src/hashes/rmd256.o src/hashes/rmd320.o \
119 src/hashes/sha1.o src/hashes/sha2/sha256.o src/hashes/sha2/sha512.o src/hashes/tiger.o \
120 src/hashes/whirl/whirl.o src/mac/f9/f9_done.o src/mac/f9/f9_file.o src/mac/f9/f9_init.o \
121 src/mac/f9/f9_memory.o src/mac/f9/f9_memory_multi.o src/mac/f9/f9_process.o src/mac/f9/f9_test.o \
122 src/mac/hmac/hmac_done.o src/mac/hmac/hmac_file.o src/mac/hmac/hmac_init.o src/mac/hmac/hmac_memory.o \
123 src/mac/hmac/hmac_memory_multi.o src/mac/hmac/hmac_process.o src/mac/hmac/hmac_test.o \
124 src/mac/omac/omac_done.o src/mac/omac/omac_file.o src/mac/omac/omac_init.o src/mac/omac/omac_memory.o \
125 src/mac/omac/omac_memory_multi.o src/mac/omac/omac_process.o src/mac/omac/omac_test.o \
126 src/mac/pelican/pelican.o src/mac/pelican/pelican_memory.o src/mac/pelican/pelican_test.o \
127 src/mac/pmac/pmac_done.o src/mac/pmac/pmac_file.o src/mac/pmac/pmac_init.o src/mac/pmac/pmac_memory.o \
128 src/mac/pmac/pmac_memory_multi.o src/mac/pmac/pmac_ntz.o src/mac/pmac/pmac_process.o \
129 src/mac/pmac/pmac_shift_xor.o src/mac/pmac/pmac_test.o src/mac/xcbc/xcbc_done.o \
130 src/mac/xcbc/xcbc_file.o src/mac/xcbc/xcbc_init.o src/mac/xcbc/xcbc_memory.o \
131 src/mac/xcbc/xcbc_memory_multi.o src/mac/xcbc/xcbc_process.o src/mac/xcbc/xcbc_test.o \
132 src/math/fp/ltc_ecc_fp_mulmod.o src/math/gmp_desc.o src/math/ltm_desc.o src/math/multi.o \
133 src/math/rand_prime.o src/math/tfm_desc.o src/misc/base64/base64_decode.o \
134 src/misc/base64/base64_encode.o src/misc/burn_stack.o src/misc/crypt/crypt.o \
135 src/misc/crypt/crypt_argchk.o src/misc/crypt/crypt_cipher_descriptor.o \
136 src/misc/crypt/crypt_cipher_is_valid.o src/misc/crypt/crypt_find_cipher.o \
137 src/misc/crypt/crypt_find_cipher_any.o src/misc/crypt/crypt_find_cipher_id.o \
138 src/misc/crypt/crypt_find_hash.o src/misc/crypt/crypt_find_hash_any.o \
139 src/misc/crypt/crypt_find_hash_id.o src/misc/crypt/crypt_find_hash_oid.o \
140 src/misc/crypt/crypt_find_prng.o src/misc/crypt/crypt_fsa.o src/misc/crypt/crypt_hash_descriptor.o \
141 src/misc/crypt/crypt_hash_is_valid.o src/misc/crypt/crypt_ltc_mp_descriptor.o \
142 src/misc/crypt/crypt_prng_descriptor.o src/misc/crypt/crypt_prng_is_valid.o \
143 src/misc/crypt/crypt_register_cipher.o src/misc/crypt/crypt_register_hash.o \
144 src/misc/crypt/crypt_register_prng.o src/misc/crypt/crypt_unregister_cipher.o \
145 src/misc/crypt/crypt_unregister_hash.o src/misc/crypt/crypt_unregister_prng.o \
146 src/misc/error_to_string.o src/misc/pkcs5/pkcs_5_1.o src/misc/pkcs5/pkcs_5_2.o src/misc/zeromem.o \
147 src/modes/cbc/cbc_decrypt.o src/modes/cbc/cbc_done.o src/modes/cbc/cbc_encrypt.o \
148 src/modes/cbc/cbc_getiv.o src/modes/cbc/cbc_setiv.o src/modes/cbc/cbc_start.o \
149 src/modes/cfb/cfb_decrypt.o src/modes/cfb/cfb_done.o src/modes/cfb/cfb_encrypt.o \
150 src/modes/cfb/cfb_getiv.o src/modes/cfb/cfb_setiv.o src/modes/cfb/cfb_start.o \
151 src/modes/ctr/ctr_decrypt.o src/modes/ctr/ctr_done.o src/modes/ctr/ctr_encrypt.o \
152 src/modes/ctr/ctr_getiv.o src/modes/ctr/ctr_setiv.o src/modes/ctr/ctr_start.o src/modes/ctr/ctr_test.o \
153 src/modes/ecb/ecb_decrypt.o src/modes/ecb/ecb_done.o src/modes/ecb/ecb_encrypt.o \
154 src/modes/ecb/ecb_start.o src/modes/f8/f8_decrypt.o src/modes/f8/f8_done.o src/modes/f8/f8_encrypt.o \
155 src/modes/f8/f8_getiv.o src/modes/f8/f8_setiv.o src/modes/f8/f8_start.o src/modes/f8/f8_test_mode.o \
156 src/modes/lrw/lrw_decrypt.o src/modes/lrw/lrw_done.o src/modes/lrw/lrw_encrypt.o \
157 src/modes/lrw/lrw_getiv.o src/modes/lrw/lrw_process.o src/modes/lrw/lrw_setiv.o \
158 src/modes/lrw/lrw_start.o src/modes/lrw/lrw_test.o src/modes/ofb/ofb_decrypt.o src/modes/ofb/ofb_done.o \
159 src/modes/ofb/ofb_encrypt.o src/modes/ofb/ofb_getiv.o src/modes/ofb/ofb_setiv.o \
160 src/modes/ofb/ofb_start.o
162 HEADERS=src/headers/tomcrypt_cfg.h src/headers/tomcrypt_mac.h src/headers/tomcrypt_macros.h \
163 src/headers/tomcrypt_custom.h src/headers/tomcrypt_argchk.h src/headers/tomcrypt_cipher.h \
164 src/headers/tomcrypt_pk.h src/headers/tomcrypt_hash.h src/headers/tomcrypt_math.h \
165 src/headers/tomcrypt_misc.h src/headers/tomcrypt.h src/headers/tomcrypt_pkcs.h \
166 src/headers/tomcrypt_prng.h testprof/tomcrypt_test.h
168 #END_INS
170 TESTOBJECTS=demos/test.o
171 HASHOBJECTS=demos/hashsum.o
172 CRYPTOBJECTS=demos/encrypt.o
173 SMALLOBJECTS=demos/small.o
174 TVS=demos/tv_gen.o
175 MULTIS=demos/multi.o
176 TIMINGS=demos/timing.o
177 TESTS=demos/test.o
179 #Files left over from making the crypt.pdf.
180 LEFTOVERS=*.dvi *.log *.aux *.toc *.idx *.ilg *.ind *.out
182 #Compressed filenames
183 COMPRESSED=crypt-$(VERSION).tar.bz2 crypt-$(VERSION).zip
185 #The default rule for make builds the libtomcrypt library.
186 default:library
188 #ciphers come in two flavours... enc+dec and enc
189 src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
190 $(CC) $(CFLAGS) -DENCRYPT_ONLY -c $< -o src/ciphers/aes/aes_enc.o
192 #These are the rules to make certain object files.
193 src/ciphers/aes/aes.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
194 src/ciphers/twofish/twofish.o: src/ciphers/twofish/twofish.c src/ciphers/twofish/twofish_tab.c
195 src/hashes/whirl/whirl.o: src/hashes/whirl/whirl.c src/hashes/whirl/whirltab.c
196 src/hashes/sha2/sha512.o: src/hashes/sha2/sha512.c src/hashes/sha2/sha384.c
197 src/hashes/sha2/sha256.o: src/hashes/sha2/sha256.c src/hashes/sha2/sha224.c
199 #This rule makes the libtomcrypt library.
200 library: $(LIBNAME)
202 testprof/$(LIBTEST):
203 cd testprof ; CFLAGS="$(CFLAGS)" LIBTEST_S=$(LIBTEST_S) $(MAKE)
205 $(LIBNAME): $(OBJECTS)
206 $(AR) $(ARFLAGS) $@ $(OBJECTS)
207 $(RANLIB) $@
209 #This rule makes the hash program included with libtomcrypt
210 hashsum: library $(HASHOBJECTS)
211 $(CC) $(HASHOBJECTS) $(LIBNAME) $(EXTRALIBS) -o $(HASH) $(WARN)
213 #makes the crypt program
214 crypt: library $(CRYPTOBJECTS)
215 $(CC) $(CRYPTOBJECTS) $(LIBNAME) $(EXTRALIBS) -o $(CRYPT) $(WARN)
217 #makes the small program
218 small: library $(SMALLOBJECTS)
219 $(CC) $(SMALLOBJECTS) $(LIBNAME) $(EXTRALIBS) -o $(SMALL) $(WARN)
221 tv_gen: library $(TVS)
222 $(CC) $(LDFLAGS) $(TVS) $(LIBNAME) $(EXTRALIBS) -o $(TV)
224 multi: library $(MULTIS)
225 $(CC) $(MULTIS) $(LIBNAME) $(EXTRALIBS) -o $(MULTI)
227 timing: library testprof/$(LIBTEST) $(TIMINGS)
228 $(CC) $(LDFLAGS) $(TIMINGS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TIMING)
230 test: library testprof/$(LIBTEST) $(TESTS)
231 $(CC) $(LDFLAGS) $(TESTS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TEST)
233 #This rule installs the library and the header files. This must be run
234 #as root in order to have a high enough permission to write to the correct
235 #directories and to set the owner and group to root.
236 ifndef NODOCS
237 install: library docs
238 else
239 install: library
240 endif
241 install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
242 install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
243 install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(DATAPATH)
244 install -g $(GROUP) -o $(USER) $(LIBNAME) $(DESTDIR)$(LIBPATH)
245 install -g $(GROUP) -o $(USER) $(HEADERS) $(DESTDIR)$(INCPATH)
246 ifndef NODOCS
247 install -g $(GROUP) -o $(USER) doc/crypt.pdf $(DESTDIR)$(DATAPATH)
248 endif
250 install_test: testprof/$(LIBTEST)
251 install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
252 install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
253 install -g $(GROUP) -o $(USER) testprof/$(LIBTEST) $(DESTDIR)$(LIBPATH)
255 profile:
256 CFLAGS="$(CFLAGS) -fprofile-generate" $(MAKE) timing EXTRALIBS="$(EXTRALIBS) -lgcov"
257 ./timing
258 rm -f timing `find . -type f | grep [.][ao] | xargs`
259 CFLAGS="$(CFLAGS) -fprofile-use" $(MAKE) timing EXTRALIBS="$(EXTRALIBS) -lgcov"
262 #This rule cleans the source tree of all compiled code, not including the pdf
263 #documentation.
264 clean:
265 -rm -f $(OBJECTS)
266 -rm -f libtomcrypt.a
268 #build the doxy files (requires Doxygen, tetex and patience)
269 doxy:
270 doxygen
271 cd doc/doxygen/latex ; ${MAKE} ; mv -f refman.pdf ../../.
272 echo The huge doxygen PDF should be available as doc/refman.pdf
274 #This builds the crypt.pdf file. Note that the rm -f *.pdf has been removed
275 #from the clean command! This is because most people would like to keep the
276 #nice pre-compiled crypt.pdf that comes with libtomcrypt! We only need to
277 #delete it if we are rebuilding it.
278 docs: crypt.tex
279 rm -f doc/crypt.pdf $(LEFTOVERS)
280 echo "hello" > crypt.ind
281 latex crypt > /dev/null
282 latex crypt > /dev/null
283 makeindex crypt.idx > /dev/null
284 perl fixupind.pl
285 latex crypt > /dev/null
286 dvipdf crypt
287 mv -ivf crypt.pdf doc/crypt.pdf
288 rm -f $(LEFTOVERS)
290 docdvi: crypt.tex
291 echo hello > crypt.ind
292 latex crypt > /dev/null
293 latex crypt > /dev/null
294 makeindex crypt.idx
295 perl fixupind.pl
296 latex crypt > /dev/null
297 latex crypt > /dev/null
299 #zipup the project (take that!)
300 no_oops: clean
301 cd .. ; cvs commit
302 echo Scanning for scratch/dirty files
303 find . -type f | grep -v CVS | xargs -n 1 bash mess.sh
305 zipup: no_oops docs
306 cd .. ; rm -rf crypt* libtomcrypt-$(VERSION) ; mkdir libtomcrypt-$(VERSION) ; \
307 cp -R ./libtomcrypt/* ./libtomcrypt-$(VERSION)/ ; \
308 cd libtomcrypt-$(VERSION) ; rm -rf `find . -type d | grep CVS | xargs` ; cd .. ; \
309 tar -cjvf crypt-$(VERSION).tar.bz2 libtomcrypt-$(VERSION) ; \
310 zip -9r crypt-$(VERSION).zip libtomcrypt-$(VERSION) ; \
311 gpg -b -a crypt-$(VERSION).tar.bz2 ; gpg -b -a crypt-$(VERSION).zip ; \
312 mv -fv crypt* ~ ; rm -rf libtomcrypt-$(VERSION)
315 # $Source: /cvs/libtom/libtomcrypt/makefile,v $
316 # $Revision: 1.145 $
317 # $Date: 2006/12/02 19:23:21 $