make_filter 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #! /usr/bin/perl -w
  2. #
  3. # Copyright 1999, 2000, 2001 Patrik Stridvall
  4. #
  5. # This library is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU Lesser General Public
  7. # License as published by the Free Software Foundation; either
  8. # version 2.1 of the License, or (at your option) any later version.
  9. #
  10. # This library is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. # Lesser General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU Lesser General Public
  16. # License along with this library; if not, write to the Free Software
  17. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  18. #
  19. use strict;
  20. BEGIN {
  21. $0 =~ m%^(.*?/?tools)/winapi/make_filter$%;
  22. require "$1/winapi/setup.pm";
  23. }
  24. use config qw(
  25. file_absolutize file_normalize
  26. $current_dir $wine_dir
  27. );
  28. use output qw($output);
  29. use make_filter_options qw($options);
  30. use make_parser qw($directory $tool $file $line $message);
  31. if($options->progress) {
  32. $output->enable_progress;
  33. } else {
  34. $output->disable_progress;
  35. }
  36. ########################################################################
  37. # main
  38. ########################################################################
  39. my $command = $options->make . " " . join(" ", $options->arguments);
  40. open(IN, "($command) 2>&1 |") || die "Cannot execute command $command: $!";
  41. while(<IN>) {
  42. chomp;
  43. if(!make_parser::line($_)) {
  44. next;
  45. }
  46. if($message) {
  47. if($file && $line) {
  48. if($directory && $directory ne "." && $file !~ m%^/%) {
  49. $output->write(file_normalize("$directory/$file") . ":$line: $message\n");
  50. } else {
  51. $output->write("$file:$line: $message\n");
  52. }
  53. } elsif($file) {
  54. if($directory && $directory ne "." && $file !~ m%^/%) {
  55. $output->write(file_normalize("$directory/$file") . ": $message\n");
  56. } else {
  57. $output->write("$file: $message\n");
  58. }
  59. } else {
  60. if($directory && $directory ne ".") {
  61. $output->write("$directory: $tool: $message\n");
  62. } elsif($tool) {
  63. $output->write("$tool: $message\n");
  64. } else {
  65. $output->write("$message\n");
  66. }
  67. }
  68. } elsif($tool eq "make") {
  69. if($directory && $directory ne ".") {
  70. $output->progress("$directory: make");
  71. }
  72. }
  73. }
  74. close(IN);
  75. $output->hide_progress();