]> rtime.felk.cvut.cz Git - jailhouse.git/blob - scripts/header_check
jailhouse: hypervisor: Debug output redirected to serial 0 back.
[jailhouse.git] / scripts / header_check
1 #!/bin/bash
2 #
3 # Jailhouse, a Linux-based partitioning hypervisor
4 #
5 # Copyright (c) Siemens AG, 2014
6 #
7 # Authors:
8 #  Jan Kiszka <jan.kiszka@siemens.com>
9 #
10 # This work is licensed under the terms of the GNU GPL, version 2.  See
11 # the COPYING file in the top-level directory.
12 #
13
14 if [ "$ARCH" == "" ]; then
15         ARCH=x86
16 fi
17
18 CFLAGS="-fno-builtin-ffsl -Wall -Wstrict-prototypes -Wtype-limits \
19         -Wmissing-declarations -Wmissing-prototypes \
20         -Ihypervisor/arch/$ARCH/include -Ihypervisor/include \
21         $EXTRA_CFLAGS"
22
23 test_compile()
24 {
25         header=`basename $2`
26         prepend=
27         case $header in
28         cell-config.h|header.h|hypercall.h)
29                 prepend="#include <jailhouse/types.h>"
30                 ;;
31         jailhouse_hypercall.h)
32                 # only included directly for linker script
33                 prepend="#define __ASSEMBLY__
34                          #include <jailhouse/types.h>"
35                 ;;
36         esac
37
38         echo "$prepend" > .header_check.tmp.c
39         echo "#include <$1/$header>" >> .header_check.tmp.c
40
41         if ! ${CROSS_COMPILE}gcc -c -o .header_check.tmp.o .header_check.tmp.c $CFLAGS; then
42                 exit 1;
43         fi
44         echo $1/$header - OK
45 }
46
47 for header in hypervisor/include/jailhouse/*.h; do
48         test_compile jailhouse $header
49 done
50
51 for header in hypervisor/arch/$ARCH/include/asm/*.h; do
52         test_compile asm $header
53 done
54
55 rm -f .header_check.tmp.[oc]