PageRenderTime 38ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/solenv/gbuild/processdeps.awk

https://bitbucket.org/markjenkins/libreoffice_ubuntu-debian-fixes
AWK | 73 lines | 26 code | 3 blank | 44 comment | 0 complexity | cf194ab8ce4c09d720fd882f3dc3ba3c MD5 | raw file
Possible License(s): GPL-3.0, LGPL-3.0, MPL-2.0-no-copyleft-exception, LGPL-2.1, BSD-3-Clause-No-Nuclear-License-2014
  1. #*************************************************************************
  2. #
  3. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4. #
  5. # Copyright 2000, 2010 Oracle and/or its affiliates.
  6. #
  7. # OpenOffice.org - a multi-platform office productivity suite
  8. #
  9. # This file is part of OpenOffice.org.
  10. #
  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.
  14. #
  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).
  20. #
  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.
  25. #
  26. #*************************************************************************
  27. # this awk script mangles makedepend output for a single object file
  28. # usage:
  29. # awk -f .../processdeps.awk \
  30. # -v OUTDIR=outdir \
  31. # -v SRCDIR=srcdir \
  32. # -v WORKDIR=workdir \
  33. # -v OBJECTFILE=objectfile
  34. # called like this the script will read from stdin
  35. # and write to stdout. It will:
  36. # - replace the objectfile with the one given on the commandline
  37. # - normalize paths to mixed paths (replacing all \ with /)
  38. # - replace the string given as WORKDIR with $(WORKDIR)/
  39. # - replace the string given as OUTDIR with $(OUTDIR)/
  40. # - replace the string given as SRCDIR with $(SRCDIR)/
  41. # - translates absolute mixed windows paths to cygwin paths by
  42. # substituting a path starting with X:... to /cygdrive/X/...
  43. function mangle_path(path) {
  44. gsub("\\\\", "/", path);
  45. if( path ~ /^[a-zA-Z]:/ )
  46. path = tolower(substr(path,0,1)) substr(path,2);
  47. gsub(WORKDIR, "$(WORKDIR)/", path);
  48. gsub(OUTDIR, "$(OUTDIR)/", path);
  49. gsub(SRCDIR, "$(SRCDIR)/", path);
  50. if( path ~ /^[a-zA-Z]:/ )
  51. path = "/cygdrive/" tolower(substr(path,0,1)) substr(path,3);
  52. return path;
  53. }
  54. BEGIN {
  55. WORKDIR = tolower(substr(WORKDIR,0,1)) substr(WORKDIR,2);
  56. OUTDIR = tolower(substr(OUTDIR,0,1)) substr(OUTDIR,2);
  57. SRCDIR = tolower(substr(SRCDIR,0,1)) substr(SRCDIR,2);
  58. # print "# WORKDIR=" WORKDIR;
  59. # print "# OUTDIR=" OUTDIR;
  60. # print "# SRCDIR=" SRCDIR;
  61. print mangle_path(OBJECTFILE) ": \\";
  62. }
  63. /^[^#]/ {
  64. print "\t" mangle_path($2) " \\";
  65. }
  66. END {
  67. print "\n";
  68. }