summaryrefslogtreecommitdiff
path: root/pwx/cleanup_headers.sh
diff options
context:
space:
mode:
authorSven Eden <yamakuzure@gmx.net>2018-06-06 08:03:09 +0200
committerSven Eden <yamakuzure@gmx.net>2018-06-06 08:03:09 +0200
commitc9f620398e0d9e39d7b062de6b78196aeba345d1 (patch)
tree316ca8b8906c83ad8b220d9ebce4ca3e87d26185 /pwx/cleanup_headers.sh
parent91a1648426febf30c9246285ef1e943cce911069 (diff)
Rename pwx to pwx_local as a backup.
Diffstat (limited to 'pwx/cleanup_headers.sh')
-rwxr-xr-xpwx/cleanup_headers.sh55
1 files changed, 0 insertions, 55 deletions
diff --git a/pwx/cleanup_headers.sh b/pwx/cleanup_headers.sh
deleted file mode 100755
index 55c5cefec..000000000
--- a/pwx/cleanup_headers.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/bash
-
-src_files=( $(find -type f -name '*.c') )
-hdr_files=( $(find -type f -name '*.h') )
-
-# Is this a meson build?
-isMeson=0
-if [[ -f meson.build ]]; then
- isMeson=1
-fi
-
-for hdr in $(find -type f -name '*.h') ; do
- h_dir="$(basename $(dirname $hdr))"
- h_file="$(basename $hdr .h)"
-
- # Is it listed in the Makefile.am or meson.build?
- if [[ 1 -eq $isMeson ]]; then
- if [[ 0 -lt $(grep -c "$h_dir/${h_file}.c" meson.build) ]] || \
- [[ 0 -lt $(grep -c "$h_dir/${h_file}.h" meson.build) ]]; then
- # It is needed.
- continue 1
- fi
- else
- if [[ 0 -lt $(grep -c "$h_dir/${h_file}.c" Makefile.am) ]] || \
- [[ 0 -lt $(grep -c "$h_dir/${h_file}.h" Makefile.am) ]]; then
- # It is needed.
- continue 1
- fi
- fi
-
- # Is it included in any source files?
- for src in "${src_files[@]}" ; do
- is_inc=$(grep -P '^#include' $src | grep -c "${h_file}.h")
- if [[ 0 -lt $is_inc ]]; then
- # it is indeed
- continue 2
- fi
- done
-
- # Is it included in any header files?
- for src in "${hdr_files[@]}" ; do
-
- # If we already removed $src, skip it
- [ -f "$src" ] || continue 1
-
- is_inc=$(grep '#include' $src | grep -c "${h_file}.h")
- if [[ 0 -lt $is_inc ]]; then
- # it is indeed
- continue 2
- fi
- done
-
- # As it was not included, remove it.
- git rm $hdr
-done