The test for macOS (aka as darwin) fails, resulting in the wrong link libraries being included:
ifeq ($(OSTYPE),darwin)
is not correct. On my systtem OSTYPE is darwin16 but changing to that does not seem to do the trick. I finally just commented out the test and it compiled and linked correctly. Lots of warnings but it works.
Tried to fix the statement but couldn't make if work; simpler to delete the ifeq/endif.
Please fix.
Please use this workaround (too hard to fix as Apple keep changing their UI).
% setenv OSTYPE darwin
% make -e all
Ray