Mercurial > mplayer.hg
changeset 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 | 8e539c651227 |
children | ebf74b8f90f5 |
files | Makefile help/help_check.sh |
diffstat | 2 files changed, 26 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Wed May 30 21:08:05 2012 +0000 +++ b/Makefile Wed May 30 21:21:46 2012 +0000 @@ -811,6 +811,9 @@ @echo "####### Please run ./configure again - it's changed! #######" @echo "############################################################" +checkhelp: help/help_mp*.h + help/help_check.sh $(CC) $^ + help_mp.h: help/help_mp-en.h $(HELP_FILE) help/help_create.sh $(HELP_FILE) $(CHARSET) @@ -1171,7 +1174,7 @@ -include $(DEP_FILES) $(DRIVER_DEP_FILES) $(TESTS_DEP_FILES) $(TOOLS_DEP_FILES) $(DHAHELPER_DEP_FILES) .PHONY: all doxygen *install* *tools drivers dhahelper* -.PHONY: checkheaders *clean tests check_checksums fatetest +.PHONY: checkheaders *clean tests check_checksums fatetest checkhelp .PHONY: doc html-chunked* html-single* xmllint* # Disable suffix rules. Most of the builtin rules are suffix rules,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/help/help_check.sh Wed May 30 21:21:46 2012 +0000 @@ -0,0 +1,22 @@ +#!/bin/sh +# Check help message header files. + +CHECK=checkhelp + +trap "rm -f ${CHECK}.c ${CHECK}.o" EXIT + +CC=$1 +shift + +for h in "$@"; do + cat <<EOF > ${CHECK}.c +#include <inttypes.h> +#include <string.h> +#include "config.h" +#include "$h" +void $CHECK () { +EOF + sed -n "s:^[ \t]*#define[ \t]\+\([0-9A-Za-z_]\+\)[ \t].*:strdup(\1);:p" "$h" >> ${CHECK}.c + echo "}" >> ${CHECK}.c + $CC -Werror -c -o ${CHECK}.o ${CHECK}.c || exit +done