title: Build multiple packages in parallel
body: <p>how to build packages in Parallel to reduce the time taken by make command(Golang)</p>
  
  <p>my current directory is "thor"</p>
  
  <p>inside my <strong>Makefile</strong></p>
  
  <pre><code>build:
      go build -o thor
      go build thor/package1
      go build thor/scripts/package2
  </code></pre>
  
  <p>in the above case ,all the packages are stand alone processes which run independently . when i run <strong>make</strong> command each packages build one by one . so if each package build take 30 sec ,totally it takes 90 sec(30 sec * 3) . but if i can build these packages in parallel ,it will only take 30 sec.</p>
  
  <p>in case of shell scripts this kind of cases can be handled by running each scripts in background with <strong>&amp;</strong> and wait till the end of each scripts using <strong>wait</strong> </p>
  
  <p><strong>sample code</strong></p>
  
  <pre><code>#!/bin/bash
  echo "Starts"
  ./s1.sh &amp;
  ./s2.sh &amp;
  ./s3.sh &amp;
  wait
  echo "ends"
  </code></pre>
  
  <p>In the above cases all the scripts s1.sh ,s2.sh ,s3.sh will run concurrently and wait till all the process finished.</p>
  
  <p>So , can we do something like this in Makefile also :)</p>