diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-20 09:47:17 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-11-24 14:12:51 +0000 |
commit | 460debad7968961084546e02eb2ac0750a63a7f4 (patch) | |
tree | be794fb18dd87c53be69c1e4ef7127212e83b97f /bin | |
parent | 6796db4cc6c1b8d32a655de5343b9883b07d0aa8 (diff) |
improvements to iwyudummy target
- split awk script into separate file
- make awk work on older awk version
- create new target in main Makefile.in to generate
iwyudummy Makefile so we don't have to manually uncomment
stuff
- exclude /usr includes from the generated makefile
- disable unused macros warnings to reduce noise
- add some sanity checking - prevent using the generated
makefile with compiler-plugins enabled
- add new target for generating iwyu Makefile so we don't
need to edit the Makefile when using it
Change-Id: I4af8eb7d1aa5419e546acb9ef905a0fe623db57d
Reviewed-on: https://gerrit.libreoffice.org/12980
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/gen-iwyu-dummy-lib | 15 | ||||
-rw-r--r-- | bin/gen-iwyu-dummy-lib.awk | 34 |
2 files changed, 46 insertions, 3 deletions
diff --git a/bin/gen-iwyu-dummy-lib b/bin/gen-iwyu-dummy-lib index ac117fe1f7db..62e7c7bc2fd8 100755 --- a/bin/gen-iwyu-dummy-lib +++ b/bin/gen-iwyu-dummy-lib @@ -16,11 +16,15 @@ set -e -iwyu_INCLUDES=$(grep -h -r ":$" ${BUILDDIR}/workdir/Dep/*Object* | grep -v 'workdir\|config_host' | sed -e "s,^${SRCDIR}/,," | sed -e "s/:$//" | sort -u) +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_EXTERNALS=$(ls ${SRCDIR}/*/*Library*mk ${SRCDIR}/*/*Executable*mk | xargs awk 'BEGIN {domatch=0;} /))/ {domatch=0;} domatch { if (!($1 in exts)) {exts[$1]; print $1;} } /use_external(s)?,/ { if (index($0, "))")) { gsub(/.*,/, ""); gsub(/)+/, ""); if (!($0 in exts)) {exts[$0]; print $0; } } else { domatch=1;} }' | grep -v '$(\|)\|tde\|expat_x64\|zlib_x64\|mozilla\|apr\|serf') +iwyu_EXTERNALS=$(ls ${SRCDIR}/*/*Library*mk ${SRCDIR}/*/*Executable*mk \ + | xargs awk -f 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 @@ -31,9 +35,14 @@ echo "include ${SRCDIR}/solenv/gbuild/partial_build.mk" >> ${BUILDDIR}/iwyudummy echo '$(eval $(call gb_Module_Module,iwyudummy))' > ${iwyu_MOD} echo '$(eval $(call gb_Module_add_targets,iwyudummy,StaticLibrary_iwyudummy))' >> ${iwyu_MOD} +# 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_StaticLibrary_StaticLibrary,iwyudummy))' > ${iwyu_LIB} # clang will "compile" headers to .gch by default -echo '$(eval $(call gb_StaticLibrary_add_cxxflags,iwyudummy,-x c++))' >> ${iwyu_LIB} +echo '$(eval $(call gb_StaticLibrary_add_cxxflags,iwyudummy,-x c++ -Wno-unused-macros))' >> ${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} diff --git a/bin/gen-iwyu-dummy-lib.awk b/bin/gen-iwyu-dummy-lib.awk new file mode 100644 index 000000000000..464d9515c7ef --- /dev/null +++ b/bin/gen-iwyu-dummy-lib.awk @@ -0,0 +1,34 @@ +BEGIN { domatch = 0; } + +{ + if ($0 ~ /use_external(s)?,/ ) + { + if (index($0, "))")) + { + gsub(/.*,/, ""); + gsub(/\)+/, ""); + if (!($0 in exts)) + { + exts[$0]; + print $0; + } + } + else + { + domatch = 1; + } + } + else if ($0 ~ /\)\)/ ) + { + domatch = 0; + } + else if (domatch == 1) + { + if (!($1 in exts)) + { + exts[$1]; + print $1; + } + } +} + |