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