title: Duplicating stderr compilation output into separate file
body: <p>I have a project, which builds by using <strong>make</strong>, and I want to add possibility
  to analyze overall state of warning messages.</p>
  
  <p>My idea is change <strong>make</strong> rules in order to duplicate <strong>stderr</strong> compilation output into separate file during full rebuild. Means each time <strong>make all</strong> will be done, all output will be printed in console and in addition <strong>stderr</strong> output will be duplicating into separate file.</p>
  
  <p>This warning report file will be added into repository, so that I will have possibility to compare warnings existing in repository and local warnings.</p>
  
  <p>The question is how to DUPLICATE (not redirect) stderr output into separate file? Means how I should change <strong>all</strong> target in <strong>Makefile</strong>?</p>
  
  <p>I know how to redirect <strong>stderr</strong> output (<strong>make all 2>warning_report.txt</strong>), but it is not
  what I need. Warning messages should be both in main console output and in warning file.</p>
  
  <p>I use <em>Windows 7</em> as work environment but I had no any deal with <em>Windows</em> command line or batch files before.</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>Edited:</strong></p>
  
  <p>In my case final solution looks like below:</p>
  
  <p><code>make all 3&gt;&amp;1 1&gt;&amp;2- 2&gt;&amp;3- | tee.bat warning_report.txt</code></p>
  
  <p>In this case script <strong>tee.bat</strong>, which is written in <em>JScript</em> for <em>Windows</em>, I took from <a href="https://stackoverflow.com/questions/10711839/using-a-custom-tee-command-for-bat-file/10719322#10719322">link</a> specified by PA (thanks).</p>
  
  <p>What about swapping, I took it from <a href="https://stackoverflow.com/questions/1507816/with-bash-how-can-i-pipe-standard-error-into-another-process">here</a> and <a href="https://serverfault.com/questions/63705/how-to-pipe-stderr-without-piping-stdout">here</a>.</p>