Skip to content

Commit

Permalink
Merge pull request Mbed-TLS#238 from itollefsen/autotools
Browse files Browse the repository at this point in the history
configure changes and improvements
  • Loading branch information
pabuhler authored Feb 9, 2017
2 parents 98895c2 + 6c949b6 commit 9d8cb19
Show file tree
Hide file tree
Showing 6 changed files with 1,055 additions and 581 deletions.
73 changes: 33 additions & 40 deletions Makefile.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Makefile for secure rtp
# Makefile for secure rtp
#
# David A. McGrew
# Cisco Systems, Inc.

# targets:
#
# runtest runs test applications
# runtest runs test applications
# test builds test applications
# libsrtp2.a static library implementing srtp
# libsrtp2.so shared library implementing srtp
Expand All @@ -15,11 +15,10 @@

USE_OPENSSL = @USE_OPENSSL@
HAVE_PCAP = @HAVE_PCAP@
HAVE_PKG_CONFIG = @HAVE_PKG_CONFIG@

.PHONY: all shared_library test

all: test
all: test

runtest: test
@echo "running libsrtp2 test applications..."
Expand All @@ -30,9 +29,9 @@ runtest: test
test/roc_driver$(EXE) -v >/dev/null
test/replay_driver$(EXE) -v >/dev/null
test/dtls_srtp_driver$(EXE) >/dev/null
cd test; $(abspath $(srcdir))/test/rtpw_test.sh >/dev/null
cd test; $(abspath $(srcdir))/test/rtpw_test.sh >/dev/null
ifeq (1, $(USE_OPENSSL))
cd test; $(abspath $(srcdir))/test/rtpw_test_gcm.sh >/dev/null
cd test; $(abspath $(srcdir))/test/rtpw_test_gcm.sh >/dev/null
endif
@echo "libsrtp2 test applications passed."
$(MAKE) -C crypto runtest
Expand All @@ -42,7 +41,7 @@ endif
CC = @CC@
INCDIR = -Icrypto/include -I$(srcdir)/include -I$(srcdir)/crypto/include
DEFS = @DEFS@
CPPFLAGS= -fPIC @CPPFLAGS@
CPPFLAGS= @CPPFLAGS@
CFLAGS = @CFLAGS@
LIBS = @LIBS@
LDFLAGS = -L. @LDFLAGS@
Expand Down Expand Up @@ -70,18 +69,16 @@ includedir = @includedir@
libdir = @libdir@
bindir = @bindir@

ifeq (1, $(HAVE_PKG_CONFIG))
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libsrtp2.pc
endif

SHAREDLIBVERSION = 1
ifeq (linux,$(findstring linux,@host@))
SHAREDLIB_DIR = $(libdir)
SHAREDLIB_LDFLAGS = -shared -Wl,-soname,$@
SHAREDLIBSUFFIXNOVER = so
SHAREDLIBSUFFIX = $(SHAREDLIBSUFFIXNOVER).$(SHAREDLIBVERSION)
else ifeq (mingw,$(findstring mingw,@host@))
else ifneq (,$(or $(findstring cygwin,@host@), $(findstring mingw,@host@)))
SHAREDLIB_DIR = $(bindir)
SHAREDLIB_LDFLAGS = -shared -Wl,--out-implib,libsrtp2.dll.a
SHAREDLIBVERSION =
Expand All @@ -90,7 +87,7 @@ SHAREDLIBSUFFIX = $(SHAREDLIBSUFFIXNOVER)
else ifeq (darwin,$(findstring darwin,@host@))
SHAREDLIB_DIR = $(libdir)
SHAREDLIB_LDFLAGS = -dynamiclib -twolevel_namespace -undefined dynamic_lookup \
-fno-common -headerpad_max_install_names -install_name $(libdir)/$@
-fno-common -headerpad_max_install_names -install_name $(libdir)/$@
SHAREDLIBSUFFIXNOVER = dylib
SHAREDLIBSUFFIX = $(SHAREDLIBVERSION).$(SHAREDLIBSUFFIXNOVER)
endif
Expand All @@ -104,22 +101,22 @@ endif
$(COMPILE) $(LDFLAGS) $< -o $@ $(SRTPLIB) $(LIBS)

ciphers = crypto/cipher/cipher.o crypto/cipher/null_cipher.o \
$(AES_ICM_OBJS)
$(AES_ICM_OBJS)

hashes = crypto/hash/null_auth.o crypto/hash/auth.o \
$(HMAC_OBJS)

replay = crypto/replay/rdb.o crypto/replay/rdbx.o \
crypto/replay/ut_sim.o
crypto/replay/ut_sim.o

math = crypto/math/datatypes.o crypto/math/stat.o
math = crypto/math/datatypes.o crypto/math/stat.o

ust = crypto/ust/ust.o
ust = crypto/ust/ust.o

err = crypto/kernel/err.o

kernel = crypto/kernel/crypto_kernel.o crypto/kernel/alloc.o \
crypto/kernel/key.o $(err) # $(ust)
crypto/kernel/key.o $(err) # $(ust)

cryptobj = $(ciphers) $(hashes) $(math) $(kernel) $(replay)

Expand All @@ -133,26 +130,26 @@ libsrtp2.a: $(srtpobj) $(cryptobj) $(gdoi)

libsrtp2.$(SHAREDLIBSUFFIX): $(srtpobj) $(cryptobj) $(gdoi)
$(CC) -shared -o $@ $(SHAREDLIB_LDFLAGS) \
$^ $(LDFLAGS) $(LIBS)
$^ $(LDFLAGS) $(LIBS)
if [ -n "$(SHAREDLIBVERSION)" ]; then \
ln -sfn $@ libsrtp2.$(SHAREDLIBSUFFIXNOVER); \
fi

shared_library: libsrtp2.$(SHAREDLIBSUFFIX)

libsrtp2.so: $(srtpobj) $(cryptobj)
libsrtp2.so: $(srtpobj) $(cryptobj)
$(CC) -shared -Wl,-soname,libsrtp2.so \
-o libsrtp2.so $^ $(LDFLAGS)
-o libsrtp2.so $^ $(LDFLAGS)

# test applications
# test applications
ifneq (1, $(USE_OPENSSL))
AES_CALC = crypto/test/aes_calc$(EXE)
endif

crypto_testapp = $(AES_CALC) crypto/test/cipher_driver$(EXE) \
crypto/test/datatypes_driver$(EXE) crypto/test/kernel_driver$(EXE) \
crypto/test/sha1_driver$(EXE) \
crypto/test/stat_driver$(EXE)
crypto/test/stat_driver$(EXE)

testapp = $(crypto_testapp) test/srtp_driver$(EXE) test/replay_driver$(EXE) \
test/roc_driver$(EXE) test/rdbx_driver$(EXE) test/rtpw$(EXE) \
Expand All @@ -165,12 +162,12 @@ endif
$(testapp): libsrtp2.a

test/rtpw$(EXE): test/rtpw.c test/rtp.c test/util.c test/getopt_s.c \
crypto/math/datatypes.c
crypto/math/datatypes.c
$(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB)

ifeq (1, $(HAVE_PCAP))
test/rtp_decoder$(EXE): test/rtp_decoder.c test/rtp.c test/util.c test/getopt_s.c \
crypto/math/datatypes.c
crypto/math/datatypes.c
$(COMPILE) $(LDFLAGS) -o $@ $^ $(LIBS) $(SRTPLIB)
endif

Expand Down Expand Up @@ -227,7 +224,7 @@ plot: test/srtp_driver
# bookkeeping: tags, clean, and distribution

tags:
etags */*.[ch] */*/*.[ch]
etags */*.[ch] */*/*.[ch]


# documentation - the target libsrtpdoc builds a PDF file documenting
Expand Down Expand Up @@ -256,45 +253,41 @@ install:
ln -sfn libsrtp2.$(SHAREDLIBSUFFIX) $(DESTDIR)$(SHAREDLIB_DIR)/libsrtp2.$(SHAREDLIBSUFFIXNOVER); \
fi; \
fi
if [ "$(pkgconfig_DATA)" != "" ]; then \
$(INSTALL) -d $(DESTDIR)$(pkgconfigdir); \
cp $(top_builddir)/$(pkgconfig_DATA) $(DESTDIR)$(pkgconfigdir)/; \
fi
$(INSTALL) -d $(DESTDIR)$(pkgconfigdir)
cp $(top_builddir)/$(pkgconfig_DATA) $(DESTDIR)$(pkgconfigdir)/

uninstall:
rm -f $(DESTDIR)$(includedir)/srtp2/*.h
rm -f $(DESTDIR)$(libdir)/libsrtp2.*
-rmdir $(DESTDIR)$(includedir)/srtp2
if [ "$(pkgconfig_DATA)" != "" ]; then \
rm -f $(DESTDIR)$(pkgconfigdir)/$(pkgconfig_DATA); \
fi
rm -f $(DESTDIR)$(pkgconfigdir)/$(pkgconfig_DATA)

clean:
rm -rf $(cryptobj) $(srtpobj) TAGS \
libsrtp2.a libsrtp2.so libsrtp2.dll.a core *.core test/core
libsrtp2.a libsrtp2.so libsrtp2.dll.a core *.core test/core
for a in * */* */*/*; do \
if [ -f "$$a~" ] ; then rm -f $$a~; fi; \
done;
if [ -f "$$a~" ] ; then rm -f $$a~; fi; \
done;
for a in $(testapp); do rm -rf $$a$(EXE); done
rm -rf *.pict *.jpg *.dat
rm -rf *.pict *.jpg *.dat
rm -rf freed allocated tmp
$(MAKE) -C doc clean

superclean: clean
rm -rf crypto/include/config.h config.log config.cache config.status \
Makefile crypto/Makefile doc/Makefile \
.gdb_history test/.gdb_history .DS_Store
Makefile crypto/Makefile doc/Makefile \
.gdb_history test/.gdb_history .DS_Store
rm -rf autom4te.cache

distclean: superclean

distname = libsrtp-$(shell cat VERSION)

distribution: runtest superclean
distribution: runtest superclean
if ! [ -f VERSION ]; then exit 1; fi
if [ -f ../$(distname).tgz ]; then \
mv ../$(distname).tgz ../$(distname).tgz.bak; \
fi
mv ../$(distname).tgz ../$(distname).tgz.bak; \
fi
cd ..; tar cvzf $(distname).tgz libsrtp

# EOF
3 changes: 0 additions & 3 deletions config_in.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* Define to 1 if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO

/* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL

Expand Down
Loading

0 comments on commit 9d8cb19

Please sign in to comment.