Link correctly against a non-installed libcurl.
Have the makefile include local.mk if it exists.

This is to allow setting local variables in a persistent way.
Various build fixes.

[skip ci]