Bump for 3.6-28
[LibreOffice.git] / solenv / gbuild / processdeps.awk
blobe564b0babd7629e831b50507de9986c76cb11c74
1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # Copyright 2000, 2010 Oracle and/or its affiliates.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # This file is part of OpenOffice.org.
11 # OpenOffice.org is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU Lesser General Public License version 3
13 # only, as published by the Free Software Foundation.
15 # OpenOffice.org is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU Lesser General Public License version 3 for more details
19 # (a copy is included in the LICENSE file that accompanied this code).
21 # You should have received a copy of the GNU Lesser General Public License
22 # version 3 along with OpenOffice.org. If not, see
23 # <http://www.openoffice.org/license.html>
24 # for a copy of the LGPLv3 License.
26 #*************************************************************************
28 # this awk script mangles makedepend output for a single object file
29 # usage:
30 # awk -f .../processdeps.awk \
31 # -v OUTDIR=outdir \
32 # -v SRCDIR=srcdir \
33 # -v WORKDIR=workdir \
34 # -v OBJECTFILE=objectfile
35 # called like this the script will read from stdin
36 # and write to stdout. It will:
37 # - replace the objectfile with the one given on the commandline
38 # - normalize paths to mixed paths (replacing all \ with /)
39 # - replace the string given as WORKDIR with $(WORKDIR)/
40 # - replace the string given as OUTDIR with $(OUTDIR)/
41 # - replace the string given as SRCDIR with $(SRCDIR)/
42 # - translates absolute mixed windows paths to cygwin paths by
43 # substituting a path starting with X:... to /cygdrive/X/...
45 function mangle_path(path) {
46 gsub("\\\\", "/", path);
47 if( path ~ /^[a-zA-Z]:/ )
48 path = tolower(substr(path,0,1)) substr(path,2);
49 gsub(WORKDIR, "$(WORKDIR)/", path);
50 gsub(OUTDIR, "$(OUTDIR)/", path);
51 gsub(SRCDIR, "$(SRCDIR)/", path);
52 if( path ~ /^[a-zA-Z]:/ )
53 path = "/cygdrive/" tolower(substr(path,0,1)) substr(path,3);
54 return path;
57 BEGIN {
58 WORKDIR = tolower(substr(WORKDIR,0,1)) substr(WORKDIR,2);
59 OUTDIR = tolower(substr(OUTDIR,0,1)) substr(OUTDIR,2);
60 SRCDIR = tolower(substr(SRCDIR,0,1)) substr(SRCDIR,2);
61 # print "# WORKDIR=" WORKDIR;
62 # print "# OUTDIR=" OUTDIR;
63 # print "# SRCDIR=" SRCDIR;
64 print mangle_path(OBJECTFILE) ": \\";
67 /^[^#]/ {
68 print "\t" mangle_path($2) " \\";
71 END {
72 print "\n";