OLD | NEW |
1 # Makefile for secure rtp | 1 # Makefile for secure rtp |
2 # | 2 # |
3 # David A. McGrew | 3 # David A. McGrew |
4 # Cisco Systems, Inc. | 4 # Cisco Systems, Inc. |
5 | 5 |
6 # targets: | 6 # targets: |
7 # | 7 # |
8 # runtest runs test applications | 8 # runtest runs test applications |
9 # test builds test applications | 9 # test builds test applications |
10 # libcrypt.a static library implementing crypto engine | 10 # libcrypt.a static library implementing crypto engine |
11 # libsrtp.a static library implementing srtp | 11 # libsrtp.a static library implementing srtp |
| 12 # libsrtp.so shared library implementing srtp |
12 # clean removes objects, libs, and executables | 13 # clean removes objects, libs, and executables |
13 # distribution cleans and builds a .tgz | 14 # distribution cleans and builds a .tgz |
14 # tags builds etags file from all .c and .h files | 15 # tags builds etags file from all .c and .h files |
15 | 16 |
| 17 USE_OPENSSL = @USE_OPENSSL@ |
| 18 HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ |
| 19 |
16 .PHONY: all test build_table_apps | 20 .PHONY: all test build_table_apps |
17 | 21 |
18 all: test | 22 all: test |
19 | 23 |
20 runtest: build_table_apps test | 24 runtest: build_table_apps test |
21 @echo "running libsrtp test applications..." | 25 @echo "running libsrtp test applications..." |
22 crypto/test/cipher_driver$(EXE) -v >/dev/null | 26 crypto/test/cipher_driver$(EXE) -v >/dev/null |
23 crypto/test/kernel_driver$(EXE) -v >/dev/null | 27 crypto/test/kernel_driver$(EXE) -v >/dev/null |
24 test/rdbx_driver$(EXE) -v >/dev/null | 28 test/rdbx_driver$(EXE) -v >/dev/null |
25 test/srtp_driver$(EXE) -v >/dev/null | 29 test/srtp_driver$(EXE) -v >/dev/null |
26 test/roc_driver$(EXE) -v >/dev/null | 30 test/roc_driver$(EXE) -v >/dev/null |
27 test/replay_driver$(EXE) -v >/dev/null | 31 test/replay_driver$(EXE) -v >/dev/null |
28 test/dtls_srtp_driver$(EXE) >/dev/null | 32 test/dtls_srtp_driver$(EXE) >/dev/null |
| 33 crypto/test/rand_gen_soak$(EXE) -v >/dev/null |
29 cd test; $(abspath $(srcdir))/test/rtpw_test.sh >/dev/null | 34 cd test; $(abspath $(srcdir))/test/rtpw_test.sh >/dev/null |
| 35 ifeq (1, $(USE_OPENSSL)) |
| 36 cd test; $(abspath $(srcdir))/test/rtpw_test_gcm.sh >/dev/null |
| 37 endif |
30 @echo "libsrtp test applications passed." | 38 @echo "libsrtp test applications passed." |
31 $(MAKE) -C crypto runtest | 39 $(MAKE) -C crypto runtest |
32 | 40 |
33 # makefile variables | 41 # makefile variables |
34 | 42 |
35 CC = @CC@ | 43 CC = @CC@ |
36 INCDIR = -Icrypto/include -I$(srcdir)/include -I$(srcdir)/crypto/include | 44 INCDIR = -Icrypto/include -I$(srcdir)/include -I$(srcdir)/crypto/include |
37 DEFS = @DEFS@ | 45 DEFS = @DEFS@ |
38 CPPFLAGS= @CPPFLAGS@ | 46 CPPFLAGS= @CPPFLAGS@ |
39 CFLAGS = @CFLAGS@ | 47 CFLAGS = @CFLAGS@ |
40 LIBS = @LIBS@ | 48 LIBS = @LIBS@ |
41 LDFLAGS = @LDFLAGS@ -L. | 49 LDFLAGS = @LDFLAGS@ -L. |
42 COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS) | 50 COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS) |
43 SRTPLIB = -lsrtp | 51 SRTPLIB = -lsrtp |
44 | 52 |
45 RANLIB = @RANLIB@ | 53 RANLIB = @RANLIB@ |
46 INSTALL = @INSTALL@ | 54 INSTALL = @INSTALL@ |
47 | 55 |
48 # EXE defines the suffix on executables - it's .exe for Windows, and | 56 # EXE defines the suffix on executables - it's .exe for Windows, and |
49 # null on linux, bsd, and OS X and other OSes. | 57 # null on linux, bsd, and OS X and other OSes. |
50 EXE = @EXE@ | 58 EXE = @EXE@ |
| 59 |
51 # gdoi is the group domain of interpretation for isakmp, a group key | 60 # gdoi is the group domain of interpretation for isakmp, a group key |
52 # management system which can provide keys for srtp | 61 # management system which can provide keys for srtp |
53 gdoi = @GDOI_OBJS@ | 62 gdoi = @GDOI_OBJS@ |
| 63 |
54 # Random source. | 64 # Random source. |
55 RNG_OBJS = @RNG_OBJS@ | 65 RNG_OBJS = @RNG_OBJS@ |
| 66 HMAC_OBJS = @HMAC_OBJS@ |
| 67 RNG_EXTRA_OBJS = @RNG_EXTRA_OBJS@ |
| 68 AES_ICM_OBJS = @AES_ICM_OBJS@ |
56 | 69 |
57 srcdir = @srcdir@ | 70 srcdir = @srcdir@ |
58 top_srcdir = @top_srcdir@ | 71 top_srcdir = @top_srcdir@ |
59 top_builddir = @top_builddir@ | 72 top_builddir = @top_builddir@ |
60 VPATH = @srcdir@ | 73 VPATH = @srcdir@ |
61 prefix = @prefix@ | 74 prefix = @prefix@ |
62 exec_prefix = @exec_prefix@ | 75 exec_prefix = @exec_prefix@ |
63 includedir = @includedir@ | 76 includedir = @includedir@ |
64 libdir = @libdir@ | 77 libdir = @libdir@ |
65 | 78 |
| 79 ifeq (1, $(HAVE_PKG_CONFIG)) |
| 80 pkgconfigdir = $(libdir)/pkgconfig |
| 81 pkgconfig_DATA = libsrtp.pc |
| 82 endif |
66 | 83 |
67 # implicit rules for object files and test apps | 84 # implicit rules for object files and test apps |
68 | 85 |
69 %.o: %.c | 86 %.o: %.c |
70 $(COMPILE) -c $< -o $@ | 87 $(COMPILE) -c $< -o $@ |
71 | 88 |
72 %$(EXE): %.c | 89 %$(EXE): %.c |
73 $(COMPILE) $(LDFLAGS) $< -o $@ $(SRTPLIB) $(LIBS) | 90 $(COMPILE) $(LDFLAGS) $< -o $@ $(SRTPLIB) $(LIBS) |
74 | 91 |
75 | 92 |
76 # libcrypt.a (the crypto engine) | 93 # libcrypt.a (the crypto engine) |
77 ciphers = crypto/cipher/cipher.o crypto/cipher/null_cipher.o \ | 94 ciphers = crypto/cipher/cipher.o crypto/cipher/null_cipher.o \ |
78 crypto/cipher/aes.o crypto/cipher/aes_icm.o \ | 95 $(AES_ICM_OBJS) |
79 crypto/cipher/aes_cbc.o | |
80 | 96 |
81 hashes = crypto/hash/null_auth.o crypto/hash/sha1.o \ | 97 hashes = crypto/hash/null_auth.o crypto/hash/auth.o \ |
82 crypto/hash/hmac.o crypto/hash/auth.o # crypto/hash/tmmhv2.o | 98 » $(HMAC_OBJS) |
83 | 99 |
84 replay = crypto/replay/rdb.o crypto/replay/rdbx.o \ | 100 replay = crypto/replay/rdb.o crypto/replay/rdbx.o \ |
85 crypto/replay/ut_sim.o | 101 crypto/replay/ut_sim.o |
86 | 102 |
87 math = crypto/math/datatypes.o crypto/math/stat.o | 103 math = crypto/math/datatypes.o crypto/math/stat.o |
88 | 104 |
89 ust = crypto/ust/ust.o | 105 ust = crypto/ust/ust.o |
90 | 106 |
91 rng = crypto/rng/$(RNG_OBJS) crypto/rng/prng.o crypto/rng/ctr_prng.o | 107 rng = crypto/rng/$(RNG_OBJS) $(RNG_EXTRA_OBJS) |
92 | 108 |
93 err = crypto/kernel/err.o | 109 err = crypto/kernel/err.o |
94 | 110 |
95 kernel = crypto/kernel/crypto_kernel.o crypto/kernel/alloc.o \ | 111 kernel = crypto/kernel/crypto_kernel.o crypto/kernel/alloc.o \ |
96 crypto/kernel/key.o $(rng) $(err) # $(ust) | 112 crypto/kernel/key.o $(rng) $(err) # $(ust) |
97 | 113 |
98 cryptobj = $(ciphers) $(hashes) $(math) $(stat) $(kernel) $(replay) | 114 cryptobj = $(ciphers) $(hashes) $(math) $(stat) $(kernel) $(replay) |
99 | 115 |
100 # libsrtp.a (implements srtp processing) | 116 # libsrtp.a (implements srtp processing) |
101 | 117 |
102 srtpobj = srtp/srtp.o srtp/ekt.o | 118 srtpobj = srtp/srtp.o srtp/ekt.o |
103 | 119 |
104 libsrtp.a: $(srtpobj) $(cryptobj) $(gdoi) | 120 libsrtp.a: $(srtpobj) $(cryptobj) $(gdoi) |
105 ar cr libsrtp.a $^ | 121 ar cr libsrtp.a $^ |
106 $(RANLIB) libsrtp.a | 122 $(RANLIB) libsrtp.a |
107 | 123 |
| 124 libsrtp.so: $(srtpobj) $(cryptobj) $(gdoi) |
| 125 $(CC) -shared -Wl,-soname,libsrtp.so \ |
| 126 -o libsrtp.so $^ $(LDFLAGS) |
| 127 |
108 # libcryptomath.a contains general-purpose routines that are used to | 128 # libcryptomath.a contains general-purpose routines that are used to |
109 # generate tables and verify cryptoalgorithm implementations - this | 129 # generate tables and verify cryptoalgorithm implementations - this |
110 # library is not meant to be included in production code | 130 # library is not meant to be included in production code |
111 | 131 |
112 cryptomath = crypto/math/math.o crypto/math/gf2_8.o | 132 cryptomath = crypto/math/math.o crypto/math/gf2_8.o |
113 | 133 |
114 libcryptomath.a: $(cryptomath) | 134 libcryptomath.a: $(cryptomath) |
115 ar cr libcryptomath.a $(cryptomath) | 135 ar cr libcryptomath.a $(cryptomath) |
116 $(RANLIB) libcryptomath.a | 136 $(RANLIB) libcryptomath.a |
117 | 137 |
118 | 138 |
119 # test applications | 139 # test applications |
| 140 ifneq (1, $(USE_OPENSSL)) |
| 141 AES_CALC = crypto/test/aes_calc$(EXE) |
| 142 endif |
120 | 143 |
121 crypto_testapp = crypto/test/aes_calc$(EXE) crypto/test/cipher_driver$(EXE) \ | 144 crypto_testapp = $(AES_CALC) crypto/test/cipher_driver$(EXE) \ |
122 crypto/test/datatypes_driver$(EXE) crypto/test/kernel_driver$(EXE) \ | 145 crypto/test/datatypes_driver$(EXE) crypto/test/kernel_driver$(EXE) \ |
123 crypto/test/rand_gen$(EXE) crypto/test/sha1_driver$(EXE) \ | 146 crypto/test/rand_gen$(EXE) crypto/test/sha1_driver$(EXE) \ |
124 » crypto/test/stat_driver$(EXE) | 147 » crypto/test/stat_driver$(EXE) crypto/test/rand_gen_soak$(EXE) |
125 | 148 |
126 testapp = $(crypto_testapp) test/srtp_driver$(EXE) test/replay_driver$(EXE) \ | 149 testapp = $(crypto_testapp) test/srtp_driver$(EXE) test/replay_driver$(EXE) \ |
127 test/roc_driver$(EXE) test/rdbx_driver$(EXE) test/rtpw$(EXE) \ | 150 test/roc_driver$(EXE) test/rdbx_driver$(EXE) test/rtpw$(EXE) \ |
128 test/dtls_srtp_driver$(EXE) | 151 test/dtls_srtp_driver$(EXE) |
129 | 152 |
130 $(testapp): libsrtp.a | 153 $(testapp): libsrtp.a |
131 | 154 |
132 test/rtpw$(EXE): test/rtpw.c test/rtp.c test/getopt_s.c | 155 test/rtpw$(EXE): test/rtpw.c test/rtp.c test/getopt_s.c |
133 $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) | 156 $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
134 | 157 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 install: | 214 install: |
192 @if [ -r $(DESTDIR)$(includedir)/srtp/srtp.h ]; then \ | 215 @if [ -r $(DESTDIR)$(includedir)/srtp/srtp.h ]; then \ |
193 echo "you should run 'make uninstall' first"; exit 1; \ | 216 echo "you should run 'make uninstall' first"; exit 1; \ |
194 fi | 217 fi |
195 $(INSTALL) -d $(DESTDIR)$(includedir)/srtp | 218 $(INSTALL) -d $(DESTDIR)$(includedir)/srtp |
196 $(INSTALL) -d $(DESTDIR)$(libdir) | 219 $(INSTALL) -d $(DESTDIR)$(libdir) |
197 cp $(srcdir)/include/*.h $(DESTDIR)$(includedir)/srtp | 220 cp $(srcdir)/include/*.h $(DESTDIR)$(includedir)/srtp |
198 cp $(srcdir)/crypto/include/*.h $(DESTDIR)$(includedir)/srtp | 221 cp $(srcdir)/crypto/include/*.h $(DESTDIR)$(includedir)/srtp |
199 if [ "$(srcdir)" != "." ]; then cp crypto/include/*.h $(DESTDIR)$(includ
edir)/srtp; fi | 222 if [ "$(srcdir)" != "." ]; then cp crypto/include/*.h $(DESTDIR)$(includ
edir)/srtp; fi |
200 if [ -f libsrtp.a ]; then cp libsrtp.a $(DESTDIR)$(libdir)/; fi | 223 if [ -f libsrtp.a ]; then cp libsrtp.a $(DESTDIR)$(libdir)/; fi |
| 224 if [ -f libsrtp.so ]; then cp libsrtp.so $(DESTDIR)$(libdir)/; fi |
| 225 if [ "$(pkgconfig_DATA)" != "" ]; then \ |
| 226 $(INSTALL) -d $(DESTDIR)$(pkgconfigdir); \ |
| 227 cp $(srcdir)/$(pkgconfig_DATA) $(DESTDIR)$(pkgconfigdir)/; \ |
| 228 fi |
201 | 229 |
202 uninstall: | 230 uninstall: |
203 rm -f $(DESTDIR)$(includedir)/srtp/*.h | 231 rm -f $(DESTDIR)$(includedir)/srtp/*.h |
204 rm -f $(DESTDIR)$(libdir)/libsrtp.a | 232 rm -f $(DESTDIR)$(libdir)/libsrtp.a |
| 233 rm -f $(DESTDIR)$(libdir)/libsrtp.so |
205 -rmdir $(DESTDIR)$(includedir)/srtp | 234 -rmdir $(DESTDIR)$(includedir)/srtp |
| 235 if [ "$(pkgconfig_DATA)" != "" ]; then \ |
| 236 rm -f $(DESTDIR)$(pkgconfigdir)/$(pkgconfig_DATA); \ |
| 237 fi |
206 | 238 |
207 clean: | 239 clean: |
208 rm -rf $(cryptobj) $(srtpobj) $(cryptomath) TAGS \ | 240 rm -rf $(cryptobj) $(srtpobj) $(cryptomath) TAGS \ |
209 libcryptomath.a libsrtp.a core *.core test/core | 241 libcryptomath.a libsrtp.a libsrtp.so core *.core test/core |
210 for a in * */* */*/*; do \ | 242 for a in * */* */*/*; do \ |
211 if [ -f "$$a~" ] ; then rm -f $$a~; fi; \ | 243 if [ -f "$$a~" ] ; then rm -f $$a~; fi; \ |
212 done; | 244 done; |
213 for a in $(testapp) $(table_apps); do rm -rf $$a$(EXE); done | 245 for a in $(testapp) $(table_apps); do rm -rf $$a$(EXE); done |
214 rm -rf *.pict *.jpg *.dat | 246 rm -rf *.pict *.jpg *.dat |
215 rm -rf freed allocated tmp | 247 rm -rf freed allocated tmp |
216 $(MAKE) -C doc clean | 248 $(MAKE) -C doc clean |
217 $(MAKE) -C crypto clean | 249 $(MAKE) -C crypto clean |
218 | 250 |
219 | 251 |
220 superclean: clean | 252 superclean: clean |
221 rm -rf crypto/include/config.h config.log config.cache config.status \ | 253 rm -rf crypto/include/config.h config.log config.cache config.status \ |
222 Makefile crypto/Makefile doc/Makefile \ | 254 Makefile crypto/Makefile doc/Makefile \ |
223 .gdb_history test/.gdb_history .DS_Store | 255 .gdb_history test/.gdb_history .DS_Store |
224 rm -rf autom4te.cache | 256 rm -rf autom4te.cache |
225 | 257 |
226 distclean: superclean | 258 distclean: superclean |
227 | 259 |
228 distname = srtp-$(shell cat VERSION) | 260 distname = libsrtp-$(shell cat VERSION) |
229 | 261 |
230 distribution: runtest superclean | 262 distribution: runtest superclean |
231 if ! [ -f VERSION ]; then exit 1; fi | 263 if ! [ -f VERSION ]; then exit 1; fi |
232 if [ -f ../$(distname).tgz ]; then \ | 264 if [ -f ../$(distname).tgz ]; then \ |
233 mv ../$(distname).tgz ../$(distname).tgz.bak; \ | 265 mv ../$(distname).tgz ../$(distname).tgz.bak; \ |
234 fi | 266 fi |
235 » cd ..; tar cvzf $(distname).tgz srtp | 267 » cd ..; tar cvzf $(distname).tgz libsrtp |
236 | 268 |
237 # EOF | 269 # EOF |
OLD | NEW |