xref: /freebsd/contrib/libfido2/tools/include_check.sh (revision fe6bf738aaeb3d5fd74aabfcbf01eba827df6594)
1#!/bin/sh -u
2
3# Copyright (c) 2019 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# SPDX-License-Identifier: BSD-2-Clause
7
8SKIP='(webauthn.h)'
9
10check() {
11	try="cc $CFLAGS -Isrc -xc -c - -o /dev/null 2>&1"
12	git ls-files "$1" | grep '.*\.h$' | while read -r header; do
13		if echo "$header" | grep -Eq "$SKIP"; then
14			echo "Skipping $header"
15		else
16			body="#include \"$header\""
17			echo "echo $body | $try"
18			echo "$body" | eval "$try"
19		fi
20	done
21}
22
23check examples
24check fuzz
25check openbsd-compat
26CFLAGS="${CFLAGS} -D_FIDO_INTERNAL" check src
27check src/fido.h
28check src/fido
29check tools
30