summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJochen Nitschke <j.nitschke+logerrit@ok.de>2017-06-22 10:14:39 +0200
committerMichael Stahl <mstahl@redhat.com>2017-06-22 13:29:14 +0200
commit438c0ed5ea4116e93eb2167a53a740ba5097565f (patch)
tree05419c3ec5b4f86eda0eb39856a36d4b365ea0eb
parent9ea64f959cb3dd25724552ab260d84ba54d204b2 (diff)
reformat bin/gen-iwyu-dummy-lib script
no logic change intended. follow some shellcheck advises: use block for redirects to same file for better style (SC2129) double quote vars (SC2086) ignore false positive warnings SC1003 and SC2016 Change-Id: Ic3a01484d4d13c8d23662ee24c46b166ee006cd4 Reviewed-on: https://gerrit.libreoffice.org/39090 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rwxr-xr-xbin/gen-iwyu-dummy-lib92
1 files changed, 49 insertions, 43 deletions
diff --git a/bin/gen-iwyu-dummy-lib b/bin/gen-iwyu-dummy-lib
index aa757b684f0b..faa61e762c33 100755
--- a/bin/gen-iwyu-dummy-lib
+++ b/bin/gen-iwyu-dummy-lib
@@ -16,58 +16,64 @@
set -e
-iwyu_INCLUDES=$(grep -h -r ":$" ${BUILDDIR}/workdir/Dep/*Object* \
+iwyu_INCLUDES=$(grep -h -r ":$" "$BUILDDIR"/workdir/Dep/*Object* \
| grep -v 'workdir\|config_host' | grep -v "^/usr" \
| sed -e "s,^${SRCDIR}/,," | sed -e "s/:$//" | sort -u)
-iwyu_INCLUDEDIRS=$(echo "${iwyu_INCLUDES}" | sed -e "s,/[^/]*$,," | grep -v "^include" | sort -u)
+iwyu_INCLUDEDIRS=$(echo "$iwyu_INCLUDES" | sed -e "s,/[^/]*$,," | grep -v "^include" | sort -u)
-iwyu_EXTERNALS=$(ls ${SRCDIR}/*/*Library*mk ${SRCDIR}/*/*Executable*mk \
- | xargs awk -f ${SRCDIR}/bin/gen-iwyu-dummy-lib.awk \
+iwyu_EXTERNALS=$(ls "$SRCDIR"/*/*Library*mk "$SRCDIR"/*/*Executable*mk \
+ | xargs awk -f "$SRCDIR"/bin/gen-iwyu-dummy-lib.awk \
| grep -v '$(\|)\|tde\|expat_x64\|zlib_x64\|mozilla\|apr\|serf')
-mkdir -p ${BUILDDIR}/iwyudummy
-iwyu_MOD=${BUILDDIR}/iwyudummy/Module_iwyudummy.mk
-iwyu_LIB=${BUILDDIR}/iwyudummy/StaticLibrary_iwyudummy.mk
+iwyu_DIR="$BUILDDIR"/iwyudummy/
+mkdir -p "$iwyu_DIR"
-echo 'module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))' > ${BUILDDIR}/iwyudummy/Makefile
-echo "include ${SRCDIR}/solenv/gbuild/partial_build.mk" >> ${BUILDDIR}/iwyudummy/Makefile
-echo '$(eval $(call gb_Module_Module,iwyudummy))' > ${iwyu_MOD}
-echo '$(eval $(call gb_Module_add_targets,iwyudummy,StaticLibrary_iwyudummy))' >> ${iwyu_MOD}
+{
+ echo 'module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))'
+ echo "include ${SRCDIR}/solenv/gbuild/partial_build.mk"
+} > "$iwyu_DIR"Makefile
-# prevent some common configuration errors
-echo 'ifneq ($(COMPILER_PLUGINS),)' > ${iwyu_LIB}
-echo ' $(call gb_Output_error,--enable-compiler-plugins does not work well with this: bailing out)' >> ${iwyu_LIB}
-echo 'endif' >> ${iwyu_LIB}
+{
+ echo '$(eval $(call gb_Module_Module,iwyudummy))'
+ echo '$(eval $(call gb_Module_add_targets,iwyudummy,StaticLibrary_iwyudummy))'
+} > "$iwyu_DIR"Module_iwyudummy.mk
-echo '$(eval $(call gb_StaticLibrary_StaticLibrary,iwyudummy))' >> ${iwyu_LIB}
-# clang will "compile" headers to .gch by default
-echo '$(eval $(call gb_StaticLibrary_add_cxxflags,iwyudummy,-x c++ -Wno-unused-macros -Wno-unused-const-variable))' >> ${iwyu_LIB}
-echo '$(eval $(call gb_StaticLibrary_use_custom_headers,iwyudummy,officecfg/registry))' >> ${iwyu_LIB}
-echo '$(eval $(call gb_StaticLibrary_use_sdk_api,iwyudummy))' >> ${iwyu_LIB}
-echo '$(eval $(call gb_StaticLibrary_use_externals,iwyudummy,\' >> ${iwyu_LIB}
-for ext in ${iwyu_EXTERNALS}; do
- echo "${ext} \\";
-done >> ${iwyu_LIB}
-echo '))' >> ${iwyu_LIB}
+{
+ # prevent some common configuration errors
+ echo 'ifneq ($(COMPILER_PLUGINS),)'
+ echo ' $(call gb_Output_error,--enable-compiler-plugins does not work well with this: bailing out)'
+ echo 'endif'
-echo '$(eval $(call gb_StaticLibrary_set_include,iwyudummy,\' >> ${iwyu_LIB}
-echo '$$(INCLUDE) \' >> ${iwyu_LIB}
-for dir in ${iwyu_INCLUDEDIRS}; do
- if echo ${dir} | grep ".*/inc/" &>/dev/null; then
- iwyu_INCLUDEDIRS_EXTRA+=" ${dir%/inc/*}/inc"
- fi
-done
-for dir in $(echo ${iwyu_INCLUDEDIRS_EXTRA} | sed -e "s/ /\n/g" | uniq) ${iwyu_INCLUDEDIRS}; do
- echo "-I${SRCDIR}/${dir} \\";
-done >> ${iwyu_LIB}
-# it fails to find stddef.h?
-echo "-I/usr/lib/clang/$(llvm-config --version)/include \\" >> ${iwyu_LIB}
-echo "))" >> ${iwyu_LIB} >> ${iwyu_LIB}
+ echo '$(eval $(call gb_StaticLibrary_StaticLibrary,iwyudummy))'
+ # clang will "compile" headers to .gch by default
+ echo '$(eval $(call gb_StaticLibrary_add_cxxflags,iwyudummy,-x c++ -Wno-unused-macros -Wno-unused-const-variable))'
+ echo '$(eval $(call gb_StaticLibrary_use_custom_headers,iwyudummy,officecfg/registry))'
+ echo '$(eval $(call gb_StaticLibrary_use_sdk_api,iwyudummy))'
+ echo '$(eval $(call gb_StaticLibrary_use_externals,iwyudummy,\'
+ for ext in ${iwyu_EXTERNALS}; do
+ echo "${ext} \\";
+ done
+ echo '))'
-echo '$(eval $(call gb_StaticLibrary__add_iwyu_headers,iwyudummy,\' >> ${iwyu_LIB}
-for hdr in ${iwyu_INCLUDES}; do
- echo "${hdr} \\";
-done >> ${iwyu_LIB}
-echo '))' >> ${iwyu_LIB}
+ echo '$(eval $(call gb_StaticLibrary_set_include,iwyudummy,\'
+ echo '$$(INCLUDE) \'
+ for dir in ${iwyu_INCLUDEDIRS}; do
+ if echo "$dir" | grep ".*/inc/" &>/dev/null; then
+ iwyu_INCLUDEDIRS_EXTRA+=" ${dir%/inc/*}/inc"
+ fi
+ done
+ for dir in $(echo ${iwyu_INCLUDEDIRS_EXTRA} | sed -e "s/ /\n/g" | uniq) ${iwyu_INCLUDEDIRS}; do
+ echo "-I${SRCDIR}/${dir} \\";
+ done
+ # it fails to find stddef.h?
+ echo "-I/usr/lib/clang/$(llvm-config --version)/include \\"
+ echo "))"
+
+ echo '$(eval $(call gb_StaticLibrary__add_iwyu_headers,iwyudummy,\'
+ for hdr in ${iwyu_INCLUDES}; do
+ echo "${hdr} \\";
+ done
+ echo '))'
+} > "$iwyu_DIR"StaticLibrary_iwyudummy.mk