title: How do I split a string in make?
body: <p>I need to take a parameter in my Makefile that consists of a host identifier in the form</p>
  
  <pre><code>host[:port]
  </code></pre>
  
  <p>where the colon and port are optional.  So all of the following are valid:</p>
  
  <pre><code>foo.example.com
  ssl.example.com:443
  localhost:5000
  </code></pre>
  
  <p>etc.</p>
  
  <p>I want to split the string on the optional colon and assign the values to variables, so that <code>HOST</code> contains <code>foo.example.com</code>, <code>ssl.example.com</code>, <code>localhost</code>, etc., and <code>PORT</code> contains 80 (the default port), 443, and 500 respectively.</p>