blob: 5780d7fdbeca77694e958e98b5d29d1f22c4006b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#!/bin/bash
# Compile each header file, one at a time.
# The compiler will notice if a header file does not include all other header
# files that it depends on.
# Example: In glibmm, go to directory glibmm, and run
# tools/test_scripts/testheaders.sh -I glib glibmm-2.58 gio # compile glibmm/gio/giomm/*.h
# tools/test_scripts/testheaders.sh glibmm-2.58 glib gio # compile glibmm/glib/glibmm/*.h and glibmm/gio/giomm/*.h
# tools/test_scripts/testheaders.sh -I glib -I gio glibmm-2.58 glib/glibmm/ustring.h # compile glibmm/glib/glibmm/ustring.h
# Usage: testheaders.sh [-I<dir>]... <pkg> [<dir> | <file>]...
# -I<dir> is added to the g++ command.
# <pkg> is the name of the package, given to pkg-config.
function usage() {
echo "Usage: $0 [-I<dir>]... <pkg> [<dir> | <file>]..."
exit 1
}
#extra_gcc_args=-std=c++11
extra_gcc_args=
# Search for directories to include in CFLAGS.
idirs=""
while [ $# -gt 0 ]
do
case "$1" in
-I) if [ $# -lt 2 ]
then
usage
fi
idirs+=" -I$2"
shift; shift
;;
-I*) idirs+=" $1"
shift
;;
-*) echo "Illegal option: $1"
usage
;;
*) break
;;
esac
done
# Package name
if [ $# -lt 1 ]
then
echo "No package name"
usage
fi
pkg="$1"
shift
# Search for more directories to include in CFLAGS.
for i in "$@"
do
if [ -d "$1" ]
then
idirs+=" -I$i"
fi
done
CFLAGS="$idirs `pkg-config --cflags $pkg`"
if [ $? -ne 0 ]
then
echo "pkg-config failed"
usage
fi
echo CFLAGS=$CFLAGS
# Compile the specified files
for i in "$@"
do
if [ -d "$i" ]
then
for headerfile in $i/${i}mm/*.h
do
echo "=== $headerfile"
g++ -c -x c++ $extra_gcc_args -o /dev/null $headerfile $CFLAGS
done
else
echo "=== $i"
g++ -c -x c++ $extra_gcc_args -o /dev/null $i $CFLAGS
fi
done
|