Kaydet (Commit) 460debad authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

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/12980Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
Tested-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst 6796db4c
......@@ -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
#
......
......@@ -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}
......
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;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment