title: bazel rules for the protobuf C++ compiler
body: <p>I'm using Bazel and Google's protocol buffers. I want to add a Bazel rule so I can generate the C++ API from the <code>.proto</code> files. In GNU make, I would do (simplified example):</p>
  
  <pre><code>%.h: %.cc
  %.cc: %.proto
      protoc --cpp_out=. $&lt;
  </code></pre>
  
  <p>How can I accomplish the same (i.e. generate the API whenever <code>mymessage.proto</code> changes) using Bazel?</p>