make_filter 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #!/usr/bin/perl
  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. use warnings 'all';
  21. BEGIN {
  22. $0 =~ m%^(.*?/?tools)/winapi/make_filter$%;
  23. require "$1/winapi/setup.pm";
  24. }
  25. use config qw(
  26. file_absolutize file_normalize
  27. $current_dir $wine_dir
  28. );
  29. use output qw($output);
  30. use make_filter_options qw($options);
  31. use make_parser qw($directory $tool $file $line $message);
  32. if($options->progress) {
  33. $output->enable_progress;
  34. } else {
  35. $output->disable_progress;
  36. }
  37. ########################################################################
  38. # main
  39. ########################################################################
  40. my $command = $options->make . " " . join(" ", $options->arguments);
  41. open(IN, "($command) 2>&1 |") || die "Cannot execute command $command: $!";
  42. while(<IN>) {
  43. chomp;
  44. if(!make_parser::line($_)) {
  45. next;
  46. }
  47. if($message) {
  48. if($file && $line) {
  49. if($directory && $directory ne "." && $file !~ m%^/%) {
  50. $output->write(file_normalize("$directory/$file") . ":$line: $message\n");
  51. } else {
  52. $output->write("$file:$line: $message\n");
  53. }
  54. } elsif($file) {
  55. if($directory && $directory ne "." && $file !~ m%^/%) {
  56. $output->write(file_normalize("$directory/$file") . ": $message\n");
  57. } else {
  58. $output->write("$file: $message\n");
  59. }
  60. } else {
  61. if($directory && $directory ne ".") {
  62. $output->write("$directory: $tool: $message\n");
  63. } elsif($tool) {
  64. $output->write("$tool: $message\n");
  65. } else {
  66. $output->write("$message\n");
  67. }
  68. }
  69. } elsif($tool eq "make") {
  70. if($directory && $directory ne ".") {
  71. $output->progress("$directory: make");
  72. }
  73. }
  74. }
  75. close(IN);
  76. $output->hide_progress();