Makefile.in | 4 +++- bin/gen-iwyu-dummy-lib | 15 ++++++++++++--- bin/gen-iwyu-dummy-lib.awk | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 4 deletions(-)
New commits: commit 460debad7968961084546e02eb2ac0750a63a7f4 Author: Noel Grandin <n...@peralex.com> Date: Thu Nov 20 09:47:17 2014 +0200 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 <mst...@redhat.com> Tested-by: Michael Stahl <mst...@redhat.com> diff --git a/Makefile.in b/Makefile.in index 2f8de5d..6c2957f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -63,9 +63,11 @@ PARALLELISM_OPTION := $(if $(filter-out 0,$(PARALLELISM)),-j $(PARALLELISM),) IWYU_OPTION := $(if $(IWYU_PATH),-k CC=$(IWYU_PATH) CXX=$(IWYU_PATH),) iwyudummy: bootstrap fetch - # $(SRCDIR)/bin/gen-iwyu-dummy-lib cd $(BUILDDIR)/iwyudummy && $(MAKE) $(IWYU_OPTION) $(GMAKE_OPTIONS) +iwyudummy.generate: + $(SRCDIR)/bin/gen-iwyu-dummy-lib + # # Partial Build # diff --git a/bin/gen-iwyu-dummy-lib b/bin/gen-iwyu-dummy-lib index ac117fe..62e7c7b 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 0000000..464d951 --- /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; + } + } +} + _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits