1#!/bin/sh
2
3set -eu
4
5if [ -d include/mbedtls ]; then :; else
6    echo "$0: must be run from root" >&2
7    exit 1
8fi
9
10if grep -i cmake Makefile >/dev/null; then
11    echo "$0: not compatible with cmake" >&2
12    exit 1
13fi
14
15cp include/mbedtls/config.h include/mbedtls/config.h.bak
16scripts/config.pl full
17CFLAGS=-fno-asynchronous-unwind-tables make clean lib >/dev/null 2>&1
18mv include/mbedtls/config.h.bak include/mbedtls/config.h
19if uname | grep -F Darwin >/dev/null; then
20    nm -gUj library/libmbed*.a 2>/dev/null | sed -n -e 's/^_//p'
21elif uname | grep -F Linux >/dev/null; then
22    nm -og library/libmbed*.a | grep -v '^[^ ]*: *U \|^$\|^[^ ]*:$' | sed 's/^[^ ]* . //'
23fi | sort > exported-symbols
24make clean
25
26wc -l exported-symbols
27