Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi Bjoern, Tor, Fridrich,

The attached seems to generate nice dependency files for me - can you
please check for obvious mistakes / omissions?  I'd like put it to
libreoffice-3-4, to save us from the obsolete makedepend, and to speedup
the build on Windows.

Regards,
Kendy
From 430bbf6c6cde23b7b2c14e274ff33832c14a3763 Mon Sep 17 00:00:00 2001
From: Jan Holesovsky <kendy@suse.cz>
Date: Tue, 5 Apr 2011 22:37:12 +0200
Subject: [PATCH] Use cl.exe's -showIncludes to generate dependency files.

---
 solenv/gbuild/filter-showIncludes.pl |   57 +++++++++++++++++
 solenv/gbuild/platform/windows.mk    |  112 ++++++----------------------------
 2 files changed, 75 insertions(+), 94 deletions(-)
 create mode 100755 solenv/gbuild/filter-showIncludes.pl

diff --git a/solenv/gbuild/filter-showIncludes.pl b/solenv/gbuild/filter-showIncludes.pl
new file mode 100755
index 0000000..3079ba0
--- /dev/null
+++ b/solenv/gbuild/filter-showIncludes.pl
@@ -0,0 +1,57 @@
+#!/usr/bin/env perl
+#
+# filter-showIncludes.pl depfile.d objfile.o orginal.cxx
+#
+# Create dependency information from the output of cl.exe's showInclude.  It
+# needs additional information - the output name to which to write, objfile
+# that depends on the includes, and the original file name.
+#
+# It also consolidates the file names to a canonical form, and filters out
+# duplicates.
+#
+# LGPL v3 / GPL v3 / MPL 1.1
+#
+# Original author: Jan Holesovsky <kendy@suse.cz>
+
+my $outfile = $ARGV[0];
+my $objfile = $ARGV[1];
+my $srcfile = $ARGV[2];
+if ( !defined $outfile || !defined $objfile || !defined $srcfile ) {
+    die "Not enough parameters to create dependencies.";
+}
+
+open( OUT, "> $outfile" ) or die "Cannot open $outfile for writing.";
+print OUT "$objfile: \\\n $srcfile";
+
+my %seen;
+my $first_line = 1;
+while ( <STDIN> ) {
+    if ( /^Note: including file:/ ) {
+        s/^Note: including file:\s*//;
+        s/\r$//;
+
+        chomp;
+        s/\\/\//g;
+
+        # X: -> /cygdrive/x/
+        s/^(.):/\/cygdrive\/\l\1/;
+
+        s/ /\\ /g;
+
+        if ( !defined $seen{$_} ) {
+            $seen{$_} = 1;
+            print OUT " \\\n  $_";
+        }
+    }
+    else {
+        # skip the first line, it always just duplicates what is being
+        # compiled
+        print unless ( $first_line );
+    }
+    $first_line = 0;
+}
+
+print OUT "\n";
+close( OUT ) or die "Cannot close $outfile.";
+
+# vim: shiftwidth=4 softtabstop=4 expandtab:
diff --git a/solenv/gbuild/platform/windows.mk b/solenv/gbuild/platform/windows.mk
index d41a04a..1675861 100755
--- a/solenv/gbuild/platform/windows.mk
+++ b/solenv/gbuild/platform/windows.mk
@@ -213,6 +213,16 @@ endif
 
 gb_COMPILERNOOPTFLAGS := -Od
 
+ifeq ($(gb_FULLDEPS),$(true))
+gb_COMPILERDEPFLAGS := -showIncludes
+define gb_create_deps
+| $(GBUILDDIR)/filter-showIncludes.pl $(2) $(1) $(3)
+endef
+else
+gb_COMPILERDEPFLAGS :=
+define gb_create_deps
+endef
+endif
 
 # Helper class
 gb_Helper_SRCDIR_NATIVE := $(shell cygpath -m $(SRCDIR) | $(gb_AWK) -- '{ print 
tolower(substr($$0,1,1)) substr($$0,2) }')
@@ -241,27 +251,6 @@ endef
 
 # CObject class
 
-ifeq ($(gb_FULLDEPS),$(true))
-define gb_CObject__command_deponcompile
-$(call gb_Helper_abbreviate_dirs_native,\
-       $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
-               $(filter-out -DPRECOMPILED_HEADERS,$(4)) $(5) \
-               -I$(dir $(3)) \
-               $(filter-out -I$(COMPATH)% %/pch -I$(JAVA_HOME),$(6)) \
-               $(3) \
-               -f - \
-       | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
-               -v OBJECTFILE=$(1) \
-               -v OUTDIR=$(OUTDIR)/ \
-               -v WORKDIR=$(WORKDIR)/ \
-               -v SRCDIR=$(SRCDIR)/ \
-               -v REPODIR=$(REPODIR)/ \
-       > $(call gb_CObject_get_dep_target,$(2)))
-endef
-else
-CObject__command_deponcompile =
-endif
-
 define gb_CObject__command
 $(call gb_Output_announce,$(2),$(true),C  ,3)
 $(call gb_Helper_abbreviate_dirs_native,\
@@ -270,37 +259,16 @@ $(call gb_Helper_abbreviate_dirs_native,\
        $(gb_CC) \
                $(DEFS) $(CFLAGS)  -Fd$(PDBFILE) \
                $(PCHFLAGS) \
+               $(gb_COMPILERDEPFLAGS) \
                -I$(realpath $(dir $(3))) \
                $(INCLUDE) \
                -c $(realpath $(3)) \
-               -Fo$(1))
-$(call gb_CObject__command_deponcompile,$(1),$(2),$(3),$(DEFS),$(CFLAGS),$(INCLUDE))
+               -Fo$(1)) $(call gb_create_deps,$(1),$(call 
gb_CObject_get_dep_target,$(2)),$(realpath $(3)))
 endef
 
 
 # CxxObject class
 
-ifeq ($(gb_FULLDEPS),$(true))
-define gb_CxxObject__command_deponcompile
-$(call gb_Helper_abbreviate_dirs_native,\
-       $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
-               $(filter-out -DPRECOMPILED_HEADERS,$(4)) $(5) \
-               -I$(dir $(3)) \
-               $(filter-out -I$(COMPATH)% %/pch -I$(JAVA_HOME),$(6)) \
-               $(3) \
-               -f - \
-       | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
-                -v OBJECTFILE=$(1) \
-                -v OUTDIR=$(OUTDIR)/ \
-               -v WORKDIR=$(WORKDIR)/ \
-               -v SRCDIR=$(SRCDIR)/ \
-                -v REPODIR=$(REPODIR)/ \
-       > $(call gb_CxxObject_get_dep_target,$(2)))
- endef
-else
-gb_CxxObject__command_deponcompile =
-endif
-
 define gb_CxxObject__command
 $(call gb_Output_announce,$(2),$(true),CXX,3)
 $(call gb_Helper_abbreviate_dirs_native,\
@@ -309,11 +277,11 @@ $(call gb_Helper_abbreviate_dirs_native,\
        $(gb_CXX) \
                $(DEFS) $(CXXFLAGS) -Fd$(PDBFILE)\
                $(PCHFLAGS) \
+               $(gb_COMPILERDEPFLAGS) \
                -I$(realpath $(dir $(3))) \
                $(INCLUDE_STL) $(INCLUDE) \
                -c $(realpath $(3)) \
-               -Fo$(1))
-$(call gb_CxxObject__command_deponcompile,$(1),$(2),$(3),$(DEFS),$(CFLAGS),$(INCLUDE))
+               -Fo$(1))  $(call gb_create_deps,$(1),$(call 
gb_CxxObject_get_dep_target,$(2)),$(realpath $(3)))
 endef
 
 
@@ -322,28 +290,6 @@ endef
 gb_PrecompiledHeader_get_enableflags = -Yu$(1).hxx \
                                                                           -Fp$(call 
gb_PrecompiledHeader_get_target,$(1))
 
-ifeq ($(gb_FULLDEPS),$(true))
-define gb_PrecompiledHeader__command_deponcompile
-$(call gb_Helper_abbreviate_dirs_native,\
-       $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
-               $(4) $(5) \
-               -I$(dir $(3)) \
-               $(filter-out -I$(COMPATH)% -I$(JAVA_HOME),$(6)) \
-               $(3) \
-               -f - \
-       | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
-               -v OBJECTFILE=$(1) \
-               -v OUTDIR=$(OUTDIR)/ \
-               -v WORKDIR=$(WORKDIR)/ \
-               -v SRCDIR=$(SRCDIR)/ \
-               -v REPODIR=$(REPODIR)/ \
-       > $(call gb_PrecompiledHeader_get_dep_target,$(2)))
-endef
-else
-gb_PrecompiledHeader__command_deponcompile =
-endif
-
-
 define gb_PrecompiledHeader__command
 $(call gb_Output_announce,$(2),$(true),PCH,1)
 $(call gb_Helper_abbreviate_dirs_native,\
@@ -351,11 +297,11 @@ $(call gb_Helper_abbreviate_dirs_native,\
        unset INCLUDE && \
        $(gb_CXX) \
                $(4) $(5) -Fd$(PDBFILE) \
+               $(gb_COMPILERDEPFLAGS) \
                -I$(realpath $(dir $(3))) \
                $(6) \
                -c $(realpath $(3)) \
-               -Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj)
-$(call gb_PrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6))
+               -Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj) $(call 
gb_create_deps,$(1),$(call gb_PrecompiledHeader_get_dep_target,$(2)),$(realpath $(3)))
 endef
 
 # NoexPrecompiledHeader class
@@ -363,28 +309,6 @@ endef
 gb_NoexPrecompiledHeader_get_enableflags = -Yu$(1).hxx \
                                                                                   -Fp$(call 
gb_NoexPrecompiledHeader_get_target,$(1))
 
-ifeq ($(gb_FULLDEPS),$(true))
-define gb_NoexPrecompiledHeader__command_deponcompile
-$(call gb_Helper_abbreviate_dirs_native,\
-       $(OUTDIR)/bin/makedepend$(gb_Executable_EXT) \
-               $(4) $(5) \
-               -I$(dir $(3)) \
-               $(filter-out -I$(COMPATH)% -I$(JAVA_HOME),$(6)) \
-               $(3) \
-               -f - \
-       | $(gb_AWK) -f $(GBUILDDIR)/processdeps.awk \
-               -v OBJECTFILE=$(1) \
-               -v OUTDIR=$(OUTDIR)/ \
-               -v WORKDIR=$(WORKDIR)/ \
-               -v SRCDIR=$(SRCDIR)/ \
-               -v REPODIR=$(REPODIR)/ \
-       > $(call gb_NoexPrecompiledHeader_get_dep_target,$(2)))
-endef
-else
-gb_NoexPrecompiledHeader__command_deponcompile =
-endif
-
-
 define gb_NoexPrecompiledHeader__command
 $(call gb_Output_announce,$(2),$(true),PCH,1)
 $(call gb_Helper_abbreviate_dirs_native,\
@@ -392,11 +316,11 @@ $(call gb_Helper_abbreviate_dirs_native,\
        unset INCLUDE && \
        $(gb_CXX) \
                $(4) $(5) -Fd$(PDBFILE) \
+               $(gb_COMPILERDEPFLAGS) \
                -I$(realpath $(dir $(3))) \
                $(6) \
                -c $(realpath $(3)) \
-               -Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj)
-$(call gb_NoexPrecompiledHeader__command_deponcompile,$(1),$(2),$(3),$(4),$(5),$(6))
+               -Yc$(notdir $(patsubst %.cxx,%.hxx,$(3))) -Fp$(1) -Fo$(1).obj) $(call 
gb_create_deps,$(1),$(call gb_NoexPrecompiledHeader,$(2)),$(realpath $(3)))
 endef
 
 
-- 
1.7.2.3


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.