1#!/bin/sh -u
2
3# Copyright (c) 2018 Yubico AB. All rights reserved.
4# Use of this source code is governed by a BSD-style
5# license that can be found in the LICENSE file.
6
7for f in export.gnu export.llvm export.msvc; do
8	if [ ! -f "${f}" ]; then
9		exit 1
10	fi
11done
12
13TMPDIR="$(mktemp -d)"
14GNU="${TMPDIR}/gnu"
15LLVM="${TMPDIR}/llvm"
16MSVC="${TMPDIR}/msvc"
17
18awk '/^[^*{}]+;$/' export.gnu | tr -d '\t;' | sort > "${GNU}"
19sed 's/^_//' export.llvm | sort > "${LLVM}"
20grep -v '^EXPORTS$' export.msvc | sort > "${MSVC}"
21diff -u "${GNU}" "${LLVM}" && diff -u "${MSVC}" "${LLVM}"
22ERROR=$?
23rm "${GNU}" "${LLVM}" "${MSVC}"
24rmdir "${TMPDIR}"
25
26exit ${ERROR}
27