-
Notifications
You must be signed in to change notification settings - Fork 0
/
doxy.sh
executable file
·59 lines (52 loc) · 1.12 KB
/
doxy.sh
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
# doxy.sh
# Invokes doxygen modifying a pre-defined doxygen config file.
#
# Known bugs:
# - Exclamation marks (!) in any of the arguments break the script due to
# delimiter collision when invoking sed.
OUTPUT_DIR=doxygen_output
usage()
{
cat << EOF
`basename $0`: generate doxygen documentation
Usage: `basename $0` [-o<OUTPUT_DIRECTORY>] [-n<PROJECT_NAME>] input_files
options:
-h Show this message
-n Name of the project
-o Output directory for the generated files (default: $OUTPUT_DIR)
Example: `basename $0` -o"doxygen_output" -n"MyLib" mylib.c include/mylib.h
EOF
}
while getopts "hn:o:" OPTION
do
case $OPTION in
h)
usage
exit 1
;;
n)
NAME="$OPTARG"
;;
o)
OUTPUT_DIR="$OPTARG"
;;
?)
usage
exit
;;
esac
done
# set subsequent non-option arguments to $1...n
shift $((OPTIND-1))
OPTIND=1
if [[ -z "$*" ]]
then
echo "No input files given"
usage
exit 1
fi
cat $(dirname $0)/default.doxycfg | \
sed "s!__MAGIC_PROJECT_NAME__!$NAME!" | \
sed "s!__MAGIC_OUTPUT_DIRECTORY__!$OUTPUT_DIR!" | \
sed "s!__MAGIC_INPUT__!$*!" | \
doxygen -