]> git.lyx.org Git - lyx.git/commitdiff
header_check.sh: allow exclusion of common headers
authorScott Kostyshak <skostysh@lyx.org>
Fri, 3 May 2013 05:41:43 +0000 (01:41 -0400)
committerScott Kostyshak <skostysh@lyx.org>
Fri, 3 May 2013 05:59:57 +0000 (01:59 -0400)
Continuing to address #6305

development/tools/header_check.sh

index f80fa7261253c20544a4acf3825c456502fff5be..88fec324b9c2fd200b45d70ad1cf6edcfbb4189a 100644 (file)
@@ -28,6 +28,10 @@ LOG_FILE="$(basename $0).log"
 # For all headers:
 # PATTERN='^#include'
 
+# Exclude common headers with regex
+# (e.g. 'debug.h' will exclude 'support/debug.h')
+EXCLUDE='\(debug.h\|cstdio\)'
+
 function BUILD_FN ()
 {
        # This is not a clean make.
@@ -48,10 +52,12 @@ do
        grep "${PATTERN}" "${FILE_}" | \
        while read INCLUDE
        do
-               cp "${FILE_COPY}" "${FILE_}" \
-                       || { echo "ERROR: restore copy failed" >&2; exit 1; }
-               sed -i "s@${INCLUDE}@@" "${FILE_}"
-               ( BUILD_FN ) &>/dev/null && echo "${FILE_}::${INCLUDE}" >> "${LOG_FILE}"
+               if echo "${INCLUDE}" | grep -q -v "${EXCLUDE}"; then
+                       cp "${FILE_COPY}" "${FILE_}" \
+                               || { echo "ERROR: restore copy failed" >&2; exit 1; }
+                       sed -i "s@${INCLUDE}@@" "${FILE_}"
+                       ( BUILD_FN ) &>/dev/null && echo "${FILE_}::${INCLUDE}" >> "${LOG_FILE}"
+               fi
        done
        cp "${FILE_COPY}" "${FILE_}"
 done