comparison help/help_check.sh @ 34890:4df5cb727be4

Add a Makefile target for testing the help message text headers. This allows a syntax check without having to compile for each language, but doesn't check the correctness of the used format specifiers though.
author ib
date Wed, 30 May 2012 21:21:46 +0000
parents
children cb9975cda4bc
comparison
equal deleted inserted replaced
34889:8e539c651227 34890:4df5cb727be4
1 #!/bin/sh
2 # Check help message header files.
3
4 CHECK=checkhelp
5
6 trap "rm -f ${CHECK}.c ${CHECK}.o" EXIT
7
8 CC=$1
9 shift
10
11 for h in "$@"; do
12 cat <<EOF > ${CHECK}.c
13 #include <inttypes.h>
14 #include <string.h>
15 #include "config.h"
16 #include "$h"
17 void $CHECK () {
18 EOF
19 sed -n "s:^[ \t]*#define[ \t]\+\([0-9A-Za-z_]\+\)[ \t].*:strdup(\1);:p" "$h" >> ${CHECK}.c
20 echo "}" >> ${CHECK}.c
21 $CC -Werror -c -o ${CHECK}.o ${CHECK}.c || exit
22 done