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 |
16 .PHONY: all test build_table_apps | 17 USE_OPENSSL = @USE_OPENSSL@ |
| 18 HAVE_PCAP = @HAVE_PCAP@ |
| 19 HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ |
| 20 |
| 21 .PHONY: all shared_library test build_table_apps |
17 | 22 |
18 all: test | 23 all: test |
19 | 24 |
20 runtest: build_table_apps test | 25 runtest: build_table_apps test |
21 @echo "running libsrtp test applications..." | 26 @echo "running libsrtp test applications..." |
22 crypto/test/cipher_driver$(EXE) -v >/dev/null | 27 crypto/test/cipher_driver$(EXE) -v >/dev/null |
23 crypto/test/kernel_driver$(EXE) -v >/dev/null | 28 crypto/test/kernel_driver$(EXE) -v >/dev/null |
24 test/rdbx_driver$(EXE) -v >/dev/null | 29 test/rdbx_driver$(EXE) -v >/dev/null |
25 test/srtp_driver$(EXE) -v >/dev/null | 30 test/srtp_driver$(EXE) -v >/dev/null |
26 test/roc_driver$(EXE) -v >/dev/null | 31 test/roc_driver$(EXE) -v >/dev/null |
27 test/replay_driver$(EXE) -v >/dev/null | 32 test/replay_driver$(EXE) -v >/dev/null |
28 test/dtls_srtp_driver$(EXE) >/dev/null | 33 test/dtls_srtp_driver$(EXE) >/dev/null |
| 34 crypto/test/rand_gen_soak$(EXE) -v >/dev/null |
29 cd test; $(abspath $(srcdir))/test/rtpw_test.sh >/dev/null | 35 cd test; $(abspath $(srcdir))/test/rtpw_test.sh >/dev/null |
| 36 ifeq (1, $(USE_OPENSSL)) |
| 37 cd test; $(abspath $(srcdir))/test/rtpw_test_gcm.sh >/dev/null |
| 38 endif |
30 @echo "libsrtp test applications passed." | 39 @echo "libsrtp test applications passed." |
31 $(MAKE) -C crypto runtest | 40 $(MAKE) -C crypto runtest |
32 | 41 |
33 # makefile variables | 42 # makefile variables |
34 | 43 |
35 CC = @CC@ | 44 CC = @CC@ |
36 INCDIR = -Icrypto/include -I$(srcdir)/include -I$(srcdir)/crypto/include | 45 INCDIR = -Icrypto/include -I$(srcdir)/include -I$(srcdir)/crypto/include |
37 DEFS = @DEFS@ | 46 DEFS = @DEFS@ |
38 CPPFLAGS= @CPPFLAGS@ | 47 CPPFLAGS= -fPIC @CPPFLAGS@ |
39 CFLAGS = @CFLAGS@ | 48 CFLAGS = @CFLAGS@ |
40 LIBS = @LIBS@ | 49 LIBS = @LIBS@ |
41 LDFLAGS»= @LDFLAGS@ -L. | 50 LDFLAGS»= -L. @LDFLAGS@ |
42 COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS) | 51 COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS) |
43 SRTPLIB = -lsrtp | 52 SRTPLIB = -lsrtp |
44 | 53 |
45 RANLIB = @RANLIB@ | 54 RANLIB = @RANLIB@ |
46 INSTALL = @INSTALL@ | 55 INSTALL = @INSTALL@ |
47 | 56 |
48 # EXE defines the suffix on executables - it's .exe for Windows, and | 57 # EXE defines the suffix on executables - it's .exe for Windows, and |
49 # null on linux, bsd, and OS X and other OSes. | 58 # null on linux, bsd, and OS X and other OSes. |
50 EXE = @EXE@ | 59 EXE = @EXE@ |
| 60 |
51 # gdoi is the group domain of interpretation for isakmp, a group key | 61 # gdoi is the group domain of interpretation for isakmp, a group key |
52 # management system which can provide keys for srtp | 62 # management system which can provide keys for srtp |
53 gdoi = @GDOI_OBJS@ | 63 gdoi = @GDOI_OBJS@ |
| 64 |
54 # Random source. | 65 # Random source. |
55 RNG_OBJS = @RNG_OBJS@ | 66 RNG_OBJS = @RNG_OBJS@ |
| 67 HMAC_OBJS = @HMAC_OBJS@ |
| 68 RNG_EXTRA_OBJS = @RNG_EXTRA_OBJS@ |
| 69 AES_ICM_OBJS = @AES_ICM_OBJS@ |
56 | 70 |
57 srcdir = @srcdir@ | 71 srcdir = @srcdir@ |
58 top_srcdir = @top_srcdir@ | 72 top_srcdir = @top_srcdir@ |
59 top_builddir = @top_builddir@ | 73 top_builddir = @top_builddir@ |
60 VPATH = @srcdir@ | 74 VPATH = @srcdir@ |
61 prefix = @prefix@ | 75 prefix = @prefix@ |
62 exec_prefix = @exec_prefix@ | 76 exec_prefix = @exec_prefix@ |
63 includedir = @includedir@ | 77 includedir = @includedir@ |
64 libdir = @libdir@ | 78 libdir = @libdir@ |
| 79 bindir = @bindir@ |
65 | 80 |
| 81 ifeq (1, $(HAVE_PKG_CONFIG)) |
| 82 pkgconfigdir = $(libdir)/pkgconfig |
| 83 pkgconfig_DATA = libsrtp.pc |
| 84 endif |
| 85 |
| 86 SHAREDLIBVERSION = 1 |
| 87 ifeq (linux,$(findstring linux,@host@)) |
| 88 SHAREDLIB_DIR = $(libdir) |
| 89 SHAREDLIB_LDFLAGS = -shared -Wl,-soname,$@ |
| 90 SHAREDLIBSUFFIXNOVER = so |
| 91 SHAREDLIBSUFFIX = $(SHAREDLIBSUFFIXNOVER).$(SHAREDLIBVERSION) |
| 92 else ifeq (mingw,$(findstring mingw,@host@)) |
| 93 SHAREDLIB_DIR = $(bindir) |
| 94 SHAREDLIB_LDFLAGS = -shared -Wl,--out-implib,libsrtp.dll.a |
| 95 SHAREDLIBVERSION = |
| 96 SHAREDLIBSUFFIXNOVER = dll |
| 97 SHAREDLIBSUFFIX = $(SHAREDLIBSUFFIXNOVER) |
| 98 else ifeq (darwin,$(findstring darwin,@host@)) |
| 99 SHAREDLIB_DIR = $(libdir) |
| 100 SHAREDLIB_LDFLAGS = -dynamiclib -twolevel_namespace -undefined dynamic_lookup \ |
| 101 -fno-common -headerpad_max_install_names -install_name $(libdir)/$@ |
| 102 SHAREDLIBSUFFIXNOVER = dylib |
| 103 SHAREDLIBSUFFIX = $(SHAREDLIBVERSION).$(SHAREDLIBSUFFIXNOVER) |
| 104 endif |
66 | 105 |
67 # implicit rules for object files and test apps | 106 # implicit rules for object files and test apps |
68 | 107 |
69 %.o: %.c | 108 %.o: %.c |
70 $(COMPILE) -c $< -o $@ | 109 $(COMPILE) -c $< -o $@ |
71 | 110 |
72 %$(EXE): %.c | 111 %$(EXE): %.c |
73 $(COMPILE) $(LDFLAGS) $< -o $@ $(SRTPLIB) $(LIBS) | 112 $(COMPILE) $(LDFLAGS) $< -o $@ $(SRTPLIB) $(LIBS) |
74 | 113 |
75 | 114 |
76 # libcrypt.a (the crypto engine) | 115 # libcrypt.a (the crypto engine) |
77 ciphers = crypto/cipher/cipher.o crypto/cipher/null_cipher.o \ | 116 ciphers = crypto/cipher/cipher.o crypto/cipher/null_cipher.o \ |
78 crypto/cipher/aes.o crypto/cipher/aes_icm.o \ | 117 $(AES_ICM_OBJS) |
79 crypto/cipher/aes_cbc.o | |
80 | 118 |
81 hashes = crypto/hash/null_auth.o crypto/hash/sha1.o \ | 119 hashes = crypto/hash/null_auth.o crypto/hash/auth.o \ |
82 crypto/hash/hmac.o crypto/hash/auth.o # crypto/hash/tmmhv2.o | 120 » $(HMAC_OBJS) |
83 | 121 |
84 replay = crypto/replay/rdb.o crypto/replay/rdbx.o \ | 122 replay = crypto/replay/rdb.o crypto/replay/rdbx.o \ |
85 crypto/replay/ut_sim.o | 123 crypto/replay/ut_sim.o |
86 | 124 |
87 math = crypto/math/datatypes.o crypto/math/stat.o | 125 math = crypto/math/datatypes.o crypto/math/stat.o |
88 | 126 |
89 ust = crypto/ust/ust.o | 127 ust = crypto/ust/ust.o |
90 | 128 |
91 rng = crypto/rng/$(RNG_OBJS) crypto/rng/prng.o crypto/rng/ctr_prng.o | 129 rng = crypto/rng/$(RNG_OBJS) $(RNG_EXTRA_OBJS) |
92 | 130 |
93 err = crypto/kernel/err.o | 131 err = crypto/kernel/err.o |
94 | 132 |
95 kernel = crypto/kernel/crypto_kernel.o crypto/kernel/alloc.o \ | 133 kernel = crypto/kernel/crypto_kernel.o crypto/kernel/alloc.o \ |
96 crypto/kernel/key.o $(rng) $(err) # $(ust) | 134 crypto/kernel/key.o $(rng) $(err) # $(ust) |
97 | 135 |
98 cryptobj = $(ciphers) $(hashes) $(math) $(stat) $(kernel) $(replay) | 136 cryptobj = $(ciphers) $(hashes) $(math) $(stat) $(kernel) $(replay) |
99 | 137 |
100 # libsrtp.a (implements srtp processing) | 138 # libsrtp.a (implements srtp processing) |
101 | 139 |
102 srtpobj = srtp/srtp.o srtp/ekt.o | 140 srtpobj = srtp/srtp.o srtp/ekt.o |
103 | 141 |
104 libsrtp.a: $(srtpobj) $(cryptobj) $(gdoi) | 142 libsrtp.a: $(srtpobj) $(cryptobj) $(gdoi) |
105 ar cr libsrtp.a $^ | 143 ar cr libsrtp.a $^ |
106 $(RANLIB) libsrtp.a | 144 $(RANLIB) libsrtp.a |
107 | 145 |
| 146 libsrtp.$(SHAREDLIBSUFFIX): $(srtpobj) $(cryptobj) $(gdoi) |
| 147 $(CC) -shared -o $@ $(SHAREDLIB_LDFLAGS) \ |
| 148 $^ $(LDFLAGS) $(LIBS) |
| 149 if [ -n "$(SHAREDLIBVERSION)" ]; then \ |
| 150 ln -sfn $@ libsrtp.$(SHAREDLIBSUFFIXNOVER); \ |
| 151 fi |
| 152 |
| 153 shared_library: libsrtp.$(SHAREDLIBSUFFIX) |
| 154 |
108 # libcryptomath.a contains general-purpose routines that are used to | 155 # libcryptomath.a contains general-purpose routines that are used to |
109 # generate tables and verify cryptoalgorithm implementations - this | 156 # generate tables and verify cryptoalgorithm implementations - this |
110 # library is not meant to be included in production code | 157 # library is not meant to be included in production code |
111 | 158 |
112 cryptomath = crypto/math/math.o crypto/math/gf2_8.o | 159 cryptomath = crypto/math/math.o crypto/math/gf2_8.o |
113 | 160 |
114 libcryptomath.a: $(cryptomath) | 161 libcryptomath.a: $(cryptomath) |
115 ar cr libcryptomath.a $(cryptomath) | 162 ar cr libcryptomath.a $(cryptomath) |
116 $(RANLIB) libcryptomath.a | 163 $(RANLIB) libcryptomath.a |
117 | 164 |
118 | 165 |
119 # test applications | 166 # test applications |
| 167 ifneq (1, $(USE_OPENSSL)) |
| 168 AES_CALC = crypto/test/aes_calc$(EXE) |
| 169 endif |
120 | 170 |
121 crypto_testapp = crypto/test/aes_calc$(EXE) crypto/test/cipher_driver$(EXE) \ | 171 crypto_testapp = $(AES_CALC) crypto/test/cipher_driver$(EXE) \ |
122 crypto/test/datatypes_driver$(EXE) crypto/test/kernel_driver$(EXE) \ | 172 crypto/test/datatypes_driver$(EXE) crypto/test/kernel_driver$(EXE) \ |
123 crypto/test/rand_gen$(EXE) crypto/test/sha1_driver$(EXE) \ | 173 crypto/test/rand_gen$(EXE) crypto/test/sha1_driver$(EXE) \ |
124 » crypto/test/stat_driver$(EXE) | 174 » crypto/test/stat_driver$(EXE) crypto/test/rand_gen_soak$(EXE) |
125 | 175 |
126 testapp = $(crypto_testapp) test/srtp_driver$(EXE) test/replay_driver$(EXE) \ | 176 testapp = $(crypto_testapp) test/srtp_driver$(EXE) test/replay_driver$(EXE) \ |
127 test/roc_driver$(EXE) test/rdbx_driver$(EXE) test/rtpw$(EXE) \ | 177 test/roc_driver$(EXE) test/rdbx_driver$(EXE) test/rtpw$(EXE) \ |
128 test/dtls_srtp_driver$(EXE) | 178 test/dtls_srtp_driver$(EXE) |
129 | 179 |
| 180 ifeq (1, $(HAVE_PCAP)) |
| 181 testapp += test/rtp_decoder$(EXE) |
| 182 endif |
| 183 |
130 $(testapp): libsrtp.a | 184 $(testapp): libsrtp.a |
131 | 185 |
132 test/rtpw$(EXE): test/rtpw.c test/rtp.c test/getopt_s.c | 186 test/rtpw$(EXE): test/rtpw.c test/rtp.c test/getopt_s.c \ |
133 » $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) | 187 crypto/math/datatypes.c |
| 188 » $(COMPILE) -DTESTAPP_SOURCE=1 $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
| 189 |
| 190 ifeq (1, $(HAVE_PCAP)) |
| 191 test/rtp_decoder$(EXE): test/rtp_decoder.c test/rtp.c test/getopt_s.c \ |
| 192 crypto/math/datatypes.c |
| 193 » $(COMPILE) -DTESTAPP_SOURCE=1 $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
| 194 endif |
134 | 195 |
135 test/srtp_driver$(EXE): test/srtp_driver.c test/getopt_s.c | 196 test/srtp_driver$(EXE): test/srtp_driver.c test/getopt_s.c |
136 $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) | 197 $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
137 | 198 |
138 test/rdbx_driver$(EXE): test/rdbx_driver.c test/getopt_s.c | 199 test/rdbx_driver$(EXE): test/rdbx_driver.c test/getopt_s.c |
139 $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) | 200 $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
140 | 201 |
141 test/dtls_srtp_driver$(EXE): test/dtls_srtp_driver.c test/getopt_s.c | 202 test/dtls_srtp_driver$(EXE): test/dtls_srtp_driver.c test/getopt_s.c |
142 $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) | 203 $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
143 | 204 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 243 |
183 # documentation - the target libsrtpdoc builds a PDF file documenting | 244 # documentation - the target libsrtpdoc builds a PDF file documenting |
184 # libsrtp | 245 # libsrtp |
185 | 246 |
186 libsrtpdoc: | 247 libsrtpdoc: |
187 $(MAKE) -C doc | 248 $(MAKE) -C doc |
188 | 249 |
189 .PHONY: clean superclean distclean install | 250 .PHONY: clean superclean distclean install |
190 | 251 |
191 install: | 252 install: |
192 @if [ -r $(DESTDIR)$(includedir)/srtp/srtp.h ]; then \ | |
193 echo "you should run 'make uninstall' first"; exit 1; \ | |
194 fi | |
195 $(INSTALL) -d $(DESTDIR)$(includedir)/srtp | 253 $(INSTALL) -d $(DESTDIR)$(includedir)/srtp |
196 $(INSTALL) -d $(DESTDIR)$(libdir) | 254 $(INSTALL) -d $(DESTDIR)$(libdir) |
| 255 $(INSTALL) -d $(DESTDIR)$(bindir) |
197 cp $(srcdir)/include/*.h $(DESTDIR)$(includedir)/srtp | 256 cp $(srcdir)/include/*.h $(DESTDIR)$(includedir)/srtp |
198 cp $(srcdir)/crypto/include/*.h $(DESTDIR)$(includedir)/srtp | 257 cp $(srcdir)/crypto/include/*.h $(DESTDIR)$(includedir)/srtp |
199 if [ "$(srcdir)" != "." ]; then cp crypto/include/*.h $(DESTDIR)$(includ
edir)/srtp; fi | 258 if [ "$(srcdir)" != "." ]; then cp crypto/include/*.h $(DESTDIR)$(includ
edir)/srtp; fi |
200 if [ -f libsrtp.a ]; then cp libsrtp.a $(DESTDIR)$(libdir)/; fi | 259 if [ -f libsrtp.a ]; then cp libsrtp.a $(DESTDIR)$(libdir)/; fi |
| 260 if [ -f libsrtp.dll.a ]; then cp libsrtp.dll.a $(DESTDIR)$(libdir)/; fi |
| 261 if [ -f libsrtp.$(SHAREDLIBSUFFIX) ]; then \ |
| 262 cp libsrtp.$(SHAREDLIBSUFFIX) $(DESTDIR)$(SHAREDLIB_DIR)/; \ |
| 263 cp libsrtp.$(SHAREDLIBSUFFIXNOVER) $(DESTDIR)$(SHAREDLIB_DIR)/;
\ |
| 264 fi |
| 265 if [ "$(pkgconfig_DATA)" != "" ]; then \ |
| 266 $(INSTALL) -d $(DESTDIR)$(pkgconfigdir); \ |
| 267 cp $(top_builddir)/$(pkgconfig_DATA) $(DESTDIR)$(pkgconfigdir)/;
\ |
| 268 fi |
201 | 269 |
202 uninstall: | 270 uninstall: |
203 rm -f $(DESTDIR)$(includedir)/srtp/*.h | 271 rm -f $(DESTDIR)$(includedir)/srtp/*.h |
204 » rm -f $(DESTDIR)$(libdir)/libsrtp.a | 272 » rm -f $(DESTDIR)$(libdir)/libsrtp.* |
205 -rmdir $(DESTDIR)$(includedir)/srtp | 273 -rmdir $(DESTDIR)$(includedir)/srtp |
| 274 if [ "$(pkgconfig_DATA)" != "" ]; then \ |
| 275 rm -f $(DESTDIR)$(pkgconfigdir)/$(pkgconfig_DATA); \ |
| 276 fi |
206 | 277 |
207 clean: | 278 clean: |
208 rm -rf $(cryptobj) $(srtpobj) $(cryptomath) TAGS \ | 279 rm -rf $(cryptobj) $(srtpobj) $(cryptomath) TAGS \ |
209 libcryptomath.a libsrtp.a core *.core test/core | 280 libcryptomath.a libsrtp.a libsrtp.so libsrtp.dll.a core *.core test/core |
210 for a in * */* */*/*; do \ | 281 for a in * */* */*/*; do \ |
211 if [ -f "$$a~" ] ; then rm -f $$a~; fi; \ | 282 if [ -f "$$a~" ] ; then rm -f $$a~; fi; \ |
212 done; | 283 done; |
213 for a in $(testapp) $(table_apps); do rm -rf $$a$(EXE); done | 284 for a in $(testapp) $(table_apps); do rm -rf $$a$(EXE); done |
214 rm -rf *.pict *.jpg *.dat | 285 rm -rf *.pict *.jpg *.dat |
215 rm -rf freed allocated tmp | 286 rm -rf freed allocated tmp |
216 $(MAKE) -C doc clean | 287 $(MAKE) -C doc clean |
217 $(MAKE) -C crypto clean | 288 $(MAKE) -C crypto clean |
218 | 289 |
219 | 290 |
220 superclean: clean | 291 superclean: clean |
221 rm -rf crypto/include/config.h config.log config.cache config.status \ | 292 rm -rf crypto/include/config.h config.log config.cache config.status \ |
222 Makefile crypto/Makefile doc/Makefile \ | 293 Makefile crypto/Makefile doc/Makefile \ |
223 .gdb_history test/.gdb_history .DS_Store | 294 .gdb_history test/.gdb_history .DS_Store |
224 rm -rf autom4te.cache | 295 rm -rf autom4te.cache |
225 | 296 |
226 distclean: superclean | 297 distclean: superclean |
227 | 298 |
228 distname = srtp-$(shell cat VERSION) | 299 distname = libsrtp-$(shell cat VERSION) |
229 | 300 |
230 distribution: runtest superclean | 301 distribution: runtest superclean |
231 if ! [ -f VERSION ]; then exit 1; fi | 302 if ! [ -f VERSION ]; then exit 1; fi |
232 if [ -f ../$(distname).tgz ]; then \ | 303 if [ -f ../$(distname).tgz ]; then \ |
233 mv ../$(distname).tgz ../$(distname).tgz.bak; \ | 304 mv ../$(distname).tgz ../$(distname).tgz.bak; \ |
234 fi | 305 fi |
235 » cd ..; tar cvzf $(distname).tgz srtp | 306 » cd ..; tar cvzf $(distname).tgz libsrtp |
236 | 307 |
237 # EOF | 308 # EOF |
OLD | NEW |