[MPlayer-cvslog] r34978 - in trunk: Makefile help/help_check.sh

ib subversion at mplayerhq.hu
Wed May 30 23:21:47 CEST 2012


Author: ib
Date: Wed May 30 23:21:46 2012
New Revision: 34978

Log:
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.

Added:
   trunk/help/help_check.sh   (contents, props changed)
Modified:
   trunk/Makefile

Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile	Wed May 30 23:08:05 2012	(r34977)
+++ trunk/Makefile	Wed May 30 23:21:46 2012	(r34978)
@@ -811,6 +811,9 @@ config.mak: configure
 	@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 @@ dhahelperclean:
 -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,

Added: trunk/help/help_check.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/help/help_check.sh	Wed May 30 23:21:46 2012	(r34978)
@@ -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


More information about the MPlayer-cvslog mailing list