Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 1 | # Makefile for secure rtp |
| 2 | # |
| 3 | # David A. McGrew |
| 4 | # Cisco Systems, Inc. |
| 5 | |
| 6 | # targets: |
| 7 | # |
| 8 | # runtest runs test applications |
| 9 | # test builds test applications |
jfigus | d196e02 | 2014-11-20 16:43:44 -0500 | [diff] [blame] | 10 | # libsrtp2.a static library implementing srtp |
| 11 | # libsrtp2.so shared library implementing srtp |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 12 | # clean removes objects, libs, and executables |
David McGrew | b67061f | 2005-09-28 14:23:06 +0000 | [diff] [blame] | 13 | # distribution cleans and builds a .tgz |
| 14 | # tags builds etags file from all .c and .h files |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 15 | |
jfigus | 8c36da2 | 2013-10-01 16:41:19 -0400 | [diff] [blame] | 16 | USE_OPENSSL = @USE_OPENSSL@ |
Bernardo Torres | b3c5142 | 2014-10-14 12:40:09 -0300 | [diff] [blame] | 17 | HAVE_PCAP = @HAVE_PCAP@ |
Saúl Ibarra Corretgé | b86063c | 2014-10-01 11:23:24 +0200 | [diff] [blame] | 18 | HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@ |
jfigus | 8c36da2 | 2013-10-01 16:41:19 -0400 | [diff] [blame] | 19 | |
jfigus | 219ce4b | 2014-12-01 11:03:42 -0500 | [diff] [blame] | 20 | .PHONY: all shared_library test |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 21 | |
David McGrew | b67061f | 2005-09-28 14:23:06 +0000 | [diff] [blame] | 22 | all: test |
| 23 | |
jfigus | 8aa936e | 2014-11-06 10:16:35 -0500 | [diff] [blame] | 24 | runtest: test |
jfigus | d196e02 | 2014-11-20 16:43:44 -0500 | [diff] [blame] | 25 | @echo "running libsrtp2 test applications..." |
Marcus Sundberg | b0a9311 | 2005-10-02 21:11:33 +0000 | [diff] [blame] | 26 | crypto/test/cipher_driver$(EXE) -v >/dev/null |
| 27 | crypto/test/kernel_driver$(EXE) -v >/dev/null |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 28 | test/rdbx_driver$(EXE) -v >/dev/null |
| 29 | test/srtp_driver$(EXE) -v >/dev/null |
| 30 | test/roc_driver$(EXE) -v >/dev/null |
David McGrew | 11b2e41 | 2006-03-16 19:13:31 +0000 | [diff] [blame] | 31 | test/replay_driver$(EXE) -v >/dev/null |
David McGrew | 0cb86ee | 2006-07-07 15:46:57 +0000 | [diff] [blame] | 32 | test/dtls_srtp_driver$(EXE) >/dev/null |
Jonathan Lennox | f464743 | 2010-05-14 23:17:51 +0000 | [diff] [blame] | 33 | cd test; $(abspath $(srcdir))/test/rtpw_test.sh >/dev/null |
jfigus | 8c36da2 | 2013-10-01 16:41:19 -0400 | [diff] [blame] | 34 | ifeq (1, $(USE_OPENSSL)) |
| 35 | cd test; $(abspath $(srcdir))/test/rtpw_test_gcm.sh >/dev/null |
| 36 | endif |
jfigus | d196e02 | 2014-11-20 16:43:44 -0500 | [diff] [blame] | 37 | @echo "libsrtp2 test applications passed." |
Marcus Sundberg | 589127e | 2005-09-29 13:34:06 +0000 | [diff] [blame] | 38 | $(MAKE) -C crypto runtest |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 39 | |
| 40 | # makefile variables |
| 41 | |
Marcus Sundberg | 589127e | 2005-09-29 13:34:06 +0000 | [diff] [blame] | 42 | CC = @CC@ |
Marcus Sundberg | 8ebe5ce | 2005-09-29 13:59:56 +0000 | [diff] [blame] | 43 | INCDIR = -Icrypto/include -I$(srcdir)/include -I$(srcdir)/crypto/include |
jfigus | 4494760 | 2014-10-08 13:08:52 -0400 | [diff] [blame] | 44 | DEFS = @DEFS@ |
Nirbheek Chauhan | cae277e | 2014-11-05 18:35:14 +0530 | [diff] [blame] | 45 | CPPFLAGS= -fPIC @CPPFLAGS@ |
Marcus Sundberg | 589127e | 2005-09-29 13:34:06 +0000 | [diff] [blame] | 46 | CFLAGS = @CFLAGS@ |
| 47 | LIBS = @LIBS@ |
Nirbheek Chauhan | cae277e | 2014-11-05 18:35:14 +0530 | [diff] [blame] | 48 | LDFLAGS = -L. @LDFLAGS@ |
Marcus Sundberg | 8ebe5ce | 2005-09-29 13:59:56 +0000 | [diff] [blame] | 49 | COMPILE = $(CC) $(DEFS) $(INCDIR) $(CPPFLAGS) $(CFLAGS) |
jfigus | d196e02 | 2014-11-20 16:43:44 -0500 | [diff] [blame] | 50 | SRTPLIB = -lsrtp2 |
David McGrew | b67061f | 2005-09-28 14:23:06 +0000 | [diff] [blame] | 51 | |
jfigus | 1ce6a74 | 2015-04-06 08:54:01 -0400 | [diff] [blame] | 52 | AR = @AR@ |
Marcus Sundberg | 589127e | 2005-09-29 13:34:06 +0000 | [diff] [blame] | 53 | RANLIB = @RANLIB@ |
| 54 | INSTALL = @INSTALL@ |
David McGrew | b67061f | 2005-09-28 14:23:06 +0000 | [diff] [blame] | 55 | |
Marcus Sundberg | 95e2372 | 2005-10-02 19:44:28 +0000 | [diff] [blame] | 56 | # EXE defines the suffix on executables - it's .exe for Windows, and |
| 57 | # null on linux, bsd, and OS X and other OSes. |
| 58 | EXE = @EXE@ |
Cullen Jennings | ef29a90 | 2013-04-30 12:54:54 -0600 | [diff] [blame] | 59 | |
jfigus | 0d3a268 | 2013-04-02 15:42:37 -0400 | [diff] [blame] | 60 | HMAC_OBJS = @HMAC_OBJS@ |
jfigus | 0d3a268 | 2013-04-02 15:42:37 -0400 | [diff] [blame] | 61 | AES_ICM_OBJS = @AES_ICM_OBJS@ |
Marcus Sundberg | 95e2372 | 2005-10-02 19:44:28 +0000 | [diff] [blame] | 62 | |
Marcus Sundberg | 8ebe5ce | 2005-09-29 13:59:56 +0000 | [diff] [blame] | 63 | srcdir = @srcdir@ |
| 64 | top_srcdir = @top_srcdir@ |
| 65 | top_builddir = @top_builddir@ |
| 66 | VPATH = @srcdir@ |
David McGrew | b67061f | 2005-09-28 14:23:06 +0000 | [diff] [blame] | 67 | prefix = @prefix@ |
| 68 | exec_prefix = @exec_prefix@ |
| 69 | includedir = @includedir@ |
| 70 | libdir = @libdir@ |
Nirbheek Chauhan | cae277e | 2014-11-05 18:35:14 +0530 | [diff] [blame] | 71 | bindir = @bindir@ |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 72 | |
Saúl Ibarra Corretgé | b86063c | 2014-10-01 11:23:24 +0200 | [diff] [blame] | 73 | ifeq (1, $(HAVE_PKG_CONFIG)) |
| 74 | pkgconfigdir = $(libdir)/pkgconfig |
jfigus | d196e02 | 2014-11-20 16:43:44 -0500 | [diff] [blame] | 75 | pkgconfig_DATA = libsrtp2.pc |
Saúl Ibarra Corretgé | b86063c | 2014-10-01 11:23:24 +0200 | [diff] [blame] | 76 | endif |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 77 | |
Nirbheek Chauhan | cae277e | 2014-11-05 18:35:14 +0530 | [diff] [blame] | 78 | SHAREDLIBVERSION = 1 |
| 79 | ifeq (linux,$(findstring linux,@host@)) |
| 80 | SHAREDLIB_DIR = $(libdir) |
| 81 | SHAREDLIB_LDFLAGS = -shared -Wl,-soname,$@ |
| 82 | SHAREDLIBSUFFIXNOVER = so |
| 83 | SHAREDLIBSUFFIX = $(SHAREDLIBSUFFIXNOVER).$(SHAREDLIBVERSION) |
| 84 | else ifeq (mingw,$(findstring mingw,@host@)) |
| 85 | SHAREDLIB_DIR = $(bindir) |
jfigus | 219ce4b | 2014-12-01 11:03:42 -0500 | [diff] [blame] | 86 | SHAREDLIB_LDFLAGS = -shared -Wl,--out-implib,libsrtp2.dll.a |
Nirbheek Chauhan | cae277e | 2014-11-05 18:35:14 +0530 | [diff] [blame] | 87 | SHAREDLIBVERSION = |
| 88 | SHAREDLIBSUFFIXNOVER = dll |
| 89 | SHAREDLIBSUFFIX = $(SHAREDLIBSUFFIXNOVER) |
| 90 | else ifeq (darwin,$(findstring darwin,@host@)) |
| 91 | SHAREDLIB_DIR = $(libdir) |
| 92 | SHAREDLIB_LDFLAGS = -dynamiclib -twolevel_namespace -undefined dynamic_lookup \ |
| 93 | -fno-common -headerpad_max_install_names -install_name $(libdir)/$@ |
| 94 | SHAREDLIBSUFFIXNOVER = dylib |
| 95 | SHAREDLIBSUFFIX = $(SHAREDLIBVERSION).$(SHAREDLIBSUFFIXNOVER) |
| 96 | endif |
| 97 | |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 98 | # implicit rules for object files and test apps |
| 99 | |
| 100 | %.o: %.c |
Marcus Sundberg | 8ebe5ce | 2005-09-29 13:59:56 +0000 | [diff] [blame] | 101 | $(COMPILE) -c $< -o $@ |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 102 | |
Marcus Sundberg | 1f84c40 | 2005-10-06 13:59:21 +0000 | [diff] [blame] | 103 | %$(EXE): %.c |
Marcus Sundberg | 95e2372 | 2005-10-02 19:44:28 +0000 | [diff] [blame] | 104 | $(COMPILE) $(LDFLAGS) $< -o $@ $(SRTPLIB) $(LIBS) |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 105 | |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 106 | ciphers = crypto/cipher/cipher.o crypto/cipher/null_cipher.o \ |
jfigus | 0d3a268 | 2013-04-02 15:42:37 -0400 | [diff] [blame] | 107 | $(AES_ICM_OBJS) |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 108 | |
jfigus | 0d3a268 | 2013-04-02 15:42:37 -0400 | [diff] [blame] | 109 | hashes = crypto/hash/null_auth.o crypto/hash/auth.o \ |
| 110 | $(HMAC_OBJS) |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 111 | |
| 112 | replay = crypto/replay/rdb.o crypto/replay/rdbx.o \ |
| 113 | crypto/replay/ut_sim.o |
| 114 | |
jfigus | fb83841 | 2014-12-04 10:15:47 -0500 | [diff] [blame] | 115 | math = crypto/math/datatypes.o crypto/math/stat.o |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 116 | |
| 117 | ust = crypto/ust/ust.o |
| 118 | |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 119 | err = crypto/kernel/err.o |
| 120 | |
| 121 | kernel = crypto/kernel/crypto_kernel.o crypto/kernel/alloc.o \ |
jfigus | fb83841 | 2014-12-04 10:15:47 -0500 | [diff] [blame] | 122 | crypto/kernel/key.o $(err) # $(ust) |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 123 | |
jfigus | fb83841 | 2014-12-04 10:15:47 -0500 | [diff] [blame] | 124 | cryptobj = $(ciphers) $(hashes) $(math) $(kernel) $(replay) |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 125 | |
jfigus | d196e02 | 2014-11-20 16:43:44 -0500 | [diff] [blame] | 126 | # libsrtp2.a (implements srtp processing) |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 127 | |
David McGrew | 79870d6 | 2007-06-15 18:17:39 +0000 | [diff] [blame] | 128 | srtpobj = srtp/srtp.o srtp/ekt.o |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 129 | |
jfigus | 219ce4b | 2014-12-01 11:03:42 -0500 | [diff] [blame] | 130 | libsrtp2.a: $(srtpobj) $(cryptobj) $(gdoi) |
jfigus | 1ce6a74 | 2015-04-06 08:54:01 -0400 | [diff] [blame] | 131 | $(AR) cr libsrtp2.a $^ |
jfigus | d196e02 | 2014-11-20 16:43:44 -0500 | [diff] [blame] | 132 | $(RANLIB) libsrtp2.a |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 133 | |
jfigus | 219ce4b | 2014-12-01 11:03:42 -0500 | [diff] [blame] | 134 | libsrtp2.$(SHAREDLIBSUFFIX): $(srtpobj) $(cryptobj) $(gdoi) |
Nirbheek Chauhan | cae277e | 2014-11-05 18:35:14 +0530 | [diff] [blame] | 135 | $(CC) -shared -o $@ $(SHAREDLIB_LDFLAGS) \ |
| 136 | $^ $(LDFLAGS) $(LIBS) |
| 137 | if [ -n "$(SHAREDLIBVERSION)" ]; then \ |
jfigus | 219ce4b | 2014-12-01 11:03:42 -0500 | [diff] [blame] | 138 | ln -sfn $@ libsrtp2.$(SHAREDLIBSUFFIXNOVER); \ |
Nirbheek Chauhan | cae277e | 2014-11-05 18:35:14 +0530 | [diff] [blame] | 139 | fi |
| 140 | |
jfigus | 219ce4b | 2014-12-01 11:03:42 -0500 | [diff] [blame] | 141 | shared_library: libsrtp2.$(SHAREDLIBSUFFIX) |
jfigus | 5004642 | 2013-10-10 08:35:16 -0400 | [diff] [blame] | 142 | |
jfigus | d196e02 | 2014-11-20 16:43:44 -0500 | [diff] [blame] | 143 | libsrtp2.so: $(srtpobj) $(cryptobj) |
| 144 | $(CC) -shared -Wl,-soname,libsrtp2.so \ |
| 145 | -o libsrtp2.so $^ $(LDFLAGS) |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 146 | |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 147 | # test applications |
jfigus | 0d3a268 | 2013-04-02 15:42:37 -0400 | [diff] [blame] | 148 | ifneq (1, $(USE_OPENSSL)) |
| 149 | AES_CALC = crypto/test/aes_calc$(EXE) |
| 150 | endif |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 151 | |
jfigus | 0d3a268 | 2013-04-02 15:42:37 -0400 | [diff] [blame] | 152 | crypto_testapp = $(AES_CALC) crypto/test/cipher_driver$(EXE) \ |
Marcus Sundberg | b0a9311 | 2005-10-02 21:11:33 +0000 | [diff] [blame] | 153 | crypto/test/datatypes_driver$(EXE) crypto/test/kernel_driver$(EXE) \ |
jfigus | 339b61d | 2014-11-04 15:36:15 -0500 | [diff] [blame] | 154 | crypto/test/sha1_driver$(EXE) \ |
| 155 | crypto/test/stat_driver$(EXE) |
Marcus Sundberg | b0a9311 | 2005-10-02 21:11:33 +0000 | [diff] [blame] | 156 | |
| 157 | testapp = $(crypto_testapp) test/srtp_driver$(EXE) test/replay_driver$(EXE) \ |
David McGrew | 0cb86ee | 2006-07-07 15:46:57 +0000 | [diff] [blame] | 158 | test/roc_driver$(EXE) test/rdbx_driver$(EXE) test/rtpw$(EXE) \ |
David McGrew | 5506a8b | 2006-07-18 17:42:42 +0000 | [diff] [blame] | 159 | test/dtls_srtp_driver$(EXE) |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 160 | |
jfigus | 98bb4fb | 2014-10-15 09:48:03 -0400 | [diff] [blame] | 161 | ifeq (1, $(HAVE_PCAP)) |
| 162 | testapp += test/rtp_decoder$(EXE) |
| 163 | endif |
| 164 | |
jfigus | d196e02 | 2014-11-20 16:43:44 -0500 | [diff] [blame] | 165 | $(testapp): libsrtp2.a |
Marcus Sundberg | 1f84c40 | 2005-10-06 13:59:21 +0000 | [diff] [blame] | 166 | |
jfigus | 46d6b47 | 2014-11-14 16:42:01 -0500 | [diff] [blame] | 167 | test/rtpw$(EXE): test/rtpw.c test/rtp.c test/util.c test/getopt_s.c \ |
Christian Oien | 9e4c091 | 2014-10-29 09:11:16 +0100 | [diff] [blame] | 168 | crypto/math/datatypes.c |
jfigus | 46d6b47 | 2014-11-14 16:42:01 -0500 | [diff] [blame] | 169 | $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
David McGrew | 79bd301 | 2006-07-17 20:41:21 +0000 | [diff] [blame] | 170 | |
Bernardo Torres | b3c5142 | 2014-10-14 12:40:09 -0300 | [diff] [blame] | 171 | ifeq (1, $(HAVE_PCAP)) |
jfigus | 46d6b47 | 2014-11-14 16:42:01 -0500 | [diff] [blame] | 172 | test/rtp_decoder$(EXE): test/rtp_decoder.c test/rtp.c test/util.c test/getopt_s.c \ |
Christian Oien | 9e4c091 | 2014-10-29 09:11:16 +0100 | [diff] [blame] | 173 | crypto/math/datatypes.c |
jfigus | 46d6b47 | 2014-11-14 16:42:01 -0500 | [diff] [blame] | 174 | $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
Bernardo Torres | b3c5142 | 2014-10-14 12:40:09 -0300 | [diff] [blame] | 175 | endif |
| 176 | |
jfigus | 46d6b47 | 2014-11-14 16:42:01 -0500 | [diff] [blame] | 177 | crypto/test/aes_calc$(EXE): crypto/test/aes_calc.c test/util.c |
XIE Tianming | 6e70c61 | 2015-11-26 15:36:28 +0800 | [diff] [blame] | 178 | $(COMPILE) -I$(srcdir)/test $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
jfigus | 46d6b47 | 2014-11-14 16:42:01 -0500 | [diff] [blame] | 179 | |
| 180 | crypto/test/datatypes_driver$(EXE): crypto/test/datatypes_driver.c test/util.c |
XIE Tianming | 6e70c61 | 2015-11-26 15:36:28 +0800 | [diff] [blame] | 181 | $(COMPILE) -I$(srcdir)/test $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
jfigus | 46d6b47 | 2014-11-14 16:42:01 -0500 | [diff] [blame] | 182 | |
| 183 | crypto/test/sha1_driver$(EXE): crypto/test/sha1_driver.c test/util.c |
XIE Tianming | 6e70c61 | 2015-11-26 15:36:28 +0800 | [diff] [blame] | 184 | $(COMPILE) -I$(srcdir)/test $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
jfigus | 46d6b47 | 2014-11-14 16:42:01 -0500 | [diff] [blame] | 185 | |
| 186 | test/srtp_driver$(EXE): test/srtp_driver.c test/util.c test/getopt_s.c |
David McGrew | 79bd301 | 2006-07-17 20:41:21 +0000 | [diff] [blame] | 187 | $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
| 188 | |
| 189 | test/rdbx_driver$(EXE): test/rdbx_driver.c test/getopt_s.c |
| 190 | $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
| 191 | |
| 192 | test/dtls_srtp_driver$(EXE): test/dtls_srtp_driver.c test/getopt_s.c |
Marcus Sundberg | 8ebe5ce | 2005-09-29 13:59:56 +0000 | [diff] [blame] | 193 | $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 194 | |
Joachim Bauch | 4cdf467 | 2015-03-27 16:56:43 +0100 | [diff] [blame] | 195 | crypto/test/cipher_driver$(EXE): crypto/test/cipher_driver.c test/getopt_s.c |
| 196 | $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
| 197 | |
| 198 | crypto/test/kernel_driver$(EXE): crypto/test/kernel_driver.c test/getopt_s.c |
| 199 | $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
| 200 | |
| 201 | crypto/test/rand_gen$(EXE): crypto/test/rand_gen.c test/getopt_s.c |
| 202 | $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
| 203 | |
| 204 | crypto/test/rand_gen_soak$(EXE): crypto/test/rand_gen_soak.c test/getopt_s.c |
| 205 | $(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB) |
| 206 | |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 207 | test: $(testapp) |
David McGrew | b67061f | 2005-09-28 14:23:06 +0000 | [diff] [blame] | 208 | @echo "Build done. Please run '$(MAKE) runtest' to run self tests." |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 209 | |
| 210 | memtest: test/srtp_driver |
| 211 | @test/srtp_driver -v -d "alloc" > tmp |
| 212 | @grep freed tmp | wc -l > freed |
| 213 | @grep allocated tmp | wc -l > allocated |
| 214 | @echo "checking for memory leaks (only works with --enable-stdout)" |
| 215 | cmp -s allocated freed |
| 216 | @echo "passed (same number of alloc() and dealloc() calls found)" |
| 217 | @rm freed allocated tmp |
| 218 | |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 219 | # the target 'plot' runs the timing test (test/srtp_driver -t) then |
| 220 | # uses gnuplot to produce plots of the results - see the script file |
| 221 | # 'timing' |
| 222 | |
| 223 | plot: test/srtp_driver |
| 224 | test/srtp_driver -t > timing.dat |
| 225 | |
| 226 | |
| 227 | # bookkeeping: tags, clean, and distribution |
| 228 | |
| 229 | tags: |
| 230 | etags */*.[ch] */*/*.[ch] |
| 231 | |
| 232 | |
| 233 | # documentation - the target libsrtpdoc builds a PDF file documenting |
jfigus | d196e02 | 2014-11-20 16:43:44 -0500 | [diff] [blame] | 234 | # libsrtp2 |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 235 | |
jfigus | d196e02 | 2014-11-20 16:43:44 -0500 | [diff] [blame] | 236 | libsrtp2doc: |
Marcus Sundberg | 589127e | 2005-09-29 13:34:06 +0000 | [diff] [blame] | 237 | $(MAKE) -C doc |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 238 | |
Jonathan Lennox | fc65552 | 2010-05-21 17:45:35 +0000 | [diff] [blame] | 239 | .PHONY: clean superclean distclean install |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 240 | |
| 241 | install: |
jfigus | d196e02 | 2014-11-20 16:43:44 -0500 | [diff] [blame] | 242 | $(INSTALL) -d $(DESTDIR)$(includedir)/srtp2 |
David McGrew | b67061f | 2005-09-28 14:23:06 +0000 | [diff] [blame] | 243 | $(INSTALL) -d $(DESTDIR)$(libdir) |
jfigus | d196e02 | 2014-11-20 16:43:44 -0500 | [diff] [blame] | 244 | cp $(srcdir)/include/srtp.h $(DESTDIR)$(includedir)/srtp2 |
| 245 | cp $(srcdir)/include/ekt.h $(DESTDIR)$(includedir)/srtp2 |
| 246 | cp $(srcdir)/include/rtp.h $(DESTDIR)$(includedir)/srtp2 |
| 247 | if [ -f libsrtp2.a ]; then cp libsrtp2.a $(DESTDIR)$(libdir)/; fi |
jfigus | 219ce4b | 2014-12-01 11:03:42 -0500 | [diff] [blame] | 248 | if [ -f libsrtp2.dll.a ]; then cp libsrtp2.dll.a $(DESTDIR)$(libdir)/; fi |
| 249 | if [ -f libsrtp2.$(SHAREDLIBSUFFIX) ]; then \ |
Nikoli | ee93b5e | 2015-03-26 14:25:27 +0300 | [diff] [blame] | 250 | $(INSTALL) -d $(DESTDIR)$(SHAREDLIB_DIR); \ |
jfigus | 219ce4b | 2014-12-01 11:03:42 -0500 | [diff] [blame] | 251 | cp libsrtp2.$(SHAREDLIBSUFFIX) $(DESTDIR)$(SHAREDLIB_DIR)/; \ |
| 252 | cp libsrtp2.$(SHAREDLIBSUFFIXNOVER) $(DESTDIR)$(SHAREDLIB_DIR)/; \ |
Sebastian Dröge | e01dd7b | 2016-02-24 11:23:28 +0200 | [diff] [blame] | 253 | if [ -n "$(SHAREDLIBVERSION)" ]; then \ |
| 254 | ln -sfn libsrtp2.$(SHAREDLIBSUFFIX) $(DESTDIR)$(SHAREDLIB_DIR)/libsrtp2.$(SHAREDLIBSUFFIXNOVER); \ |
| 255 | fi; \ |
Nirbheek Chauhan | cae277e | 2014-11-05 18:35:14 +0530 | [diff] [blame] | 256 | fi |
Saúl Ibarra Corretgé | b86063c | 2014-10-01 11:23:24 +0200 | [diff] [blame] | 257 | if [ "$(pkgconfig_DATA)" != "" ]; then \ |
| 258 | $(INSTALL) -d $(DESTDIR)$(pkgconfigdir); \ |
Tom Hughes | 6fd7fa4 | 2014-12-09 13:32:33 -0800 | [diff] [blame] | 259 | cp $(top_builddir)/$(pkgconfig_DATA) $(DESTDIR)$(pkgconfigdir)/; \ |
Saúl Ibarra Corretgé | b86063c | 2014-10-01 11:23:24 +0200 | [diff] [blame] | 260 | fi |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 261 | |
| 262 | uninstall: |
jfigus | d196e02 | 2014-11-20 16:43:44 -0500 | [diff] [blame] | 263 | rm -f $(DESTDIR)$(includedir)/srtp2/*.h |
jfigus | 219ce4b | 2014-12-01 11:03:42 -0500 | [diff] [blame] | 264 | rm -f $(DESTDIR)$(libdir)/libsrtp2.* |
jfigus | d196e02 | 2014-11-20 16:43:44 -0500 | [diff] [blame] | 265 | -rmdir $(DESTDIR)$(includedir)/srtp2 |
Saúl Ibarra Corretgé | b86063c | 2014-10-01 11:23:24 +0200 | [diff] [blame] | 266 | if [ "$(pkgconfig_DATA)" != "" ]; then \ |
| 267 | rm -f $(DESTDIR)$(pkgconfigdir)/$(pkgconfig_DATA); \ |
| 268 | fi |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 269 | |
| 270 | clean: |
jfigus | 8aa936e | 2014-11-06 10:16:35 -0500 | [diff] [blame] | 271 | rm -rf $(cryptobj) $(srtpobj) TAGS \ |
jfigus | 219ce4b | 2014-12-01 11:03:42 -0500 | [diff] [blame] | 272 | libsrtp2.a libsrtp2.so libsrtp2.dll.a core *.core test/core |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 273 | for a in * */* */*/*; do \ |
| 274 | if [ -f "$$a~" ] ; then rm -f $$a~; fi; \ |
| 275 | done; |
jfigus | 8aa936e | 2014-11-06 10:16:35 -0500 | [diff] [blame] | 276 | for a in $(testapp); do rm -rf $$a$(EXE); done |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 277 | rm -rf *.pict *.jpg *.dat |
| 278 | rm -rf freed allocated tmp |
Marcus Sundberg | 589127e | 2005-09-29 13:34:06 +0000 | [diff] [blame] | 279 | $(MAKE) -C doc clean |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 280 | |
| 281 | superclean: clean |
David McGrew | e11033e | 2005-09-26 20:41:14 +0000 | [diff] [blame] | 282 | rm -rf crypto/include/config.h config.log config.cache config.status \ |
Jonathan Lennox | fc65552 | 2010-05-21 17:45:35 +0000 | [diff] [blame] | 283 | Makefile crypto/Makefile doc/Makefile \ |
| 284 | .gdb_history test/.gdb_history .DS_Store |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 285 | rm -rf autom4te.cache |
| 286 | |
Jonathan Lennox | fc65552 | 2010-05-21 17:45:35 +0000 | [diff] [blame] | 287 | distclean: superclean |
| 288 | |
Cullen Jennings | ef29a90 | 2013-04-30 12:54:54 -0600 | [diff] [blame] | 289 | distname = libsrtp-$(shell cat VERSION) |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 290 | |
David McGrew | b67061f | 2005-09-28 14:23:06 +0000 | [diff] [blame] | 291 | distribution: runtest superclean |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 292 | if ! [ -f VERSION ]; then exit 1; fi |
| 293 | if [ -f ../$(distname).tgz ]; then \ |
| 294 | mv ../$(distname).tgz ../$(distname).tgz.bak; \ |
| 295 | fi |
Cullen Jennings | ef29a90 | 2013-04-30 12:54:54 -0600 | [diff] [blame] | 296 | cd ..; tar cvzf $(distname).tgz libsrtp |
Cullen Jennings | 235513a | 2005-09-21 22:51:36 +0000 | [diff] [blame] | 297 | |
Marcus Sundberg | 8ebe5ce | 2005-09-29 13:59:56 +0000 | [diff] [blame] | 298 | # EOF |