Tested and seemed to work with both BSD make and gnu make on NetBSD system.

<pre>
--- Makefile
+++ Makefile
@@ -58,11 +58,11 @@

 # You should not need to change anything below this line
 ###############################################################################
 #
 # Automatic platform-specific options.
-HOST_OS :sh = uname -s
+HOST_OS= $(uname -s)

 LIB.SunOS= -lsocket -lnsl
 LIB += $(LIB.$(HOST_OS))

 TCC.DragonFly += -DUSE_PREAD
</pre>

That was changed recently for Solaris compatibility.

According to the NetBSD man pages it should work on that system. Did you encounter a problem?

<pre>
kamloops$ uname -a
NetBSD kamloops 5.99.52 NetBSD 5.99.52 (kamloops) #80: Sat May 28 14:09:40 PDT 2011  amd64
kamloops$ which make

kamloops$ make
make: don't know how to make sh. Stop

make: stopped in
kamloops$
</pre>

With gnu make (gmake on my system), builds fine. The patch I submitted was tested on my system with both BSD make and GNU make and both built fine.

I've created a configure-make branch which adds a ./configure step to building, and removes the non-cross-platform requirement for the Makefile to set a variable to the output of a shell command.

This will break any packaging scripts, which is unfortunate. I'm not sure there's an alternative other than choosing a platform which requires patching to build -- which may be completely acceptable if that platform is a minority platform. (revert [9ef38b6b6d] and break Solaris?)

BTW, I tried the alternative synax suggested in the ticket. While it works on Solaris, it doesn't work on FreeBSD. No error, but it doesn't include the extra -DUSE_PREAD for the compiler.

No configure scripts, please.  If no makefile can be devised that works for
Solaris and NetBSD, then we'll create separate Makefile.solaris and Makefile.netbsd files for those platforms.

I've committed a Makefile which works on (at least) Mac OS X, Linux, FreeBSD, NetBSD and Solaris.

For the *BSDs and Solaris, it won't work if GNU make is used. However, this is no worse than it was before I messed with it to get it to work under Solaris.

Well, the original syntax was working with all modern make implementations. Only the broken make on Solaris has issues with it. I'm quite more in favour of just accepting that Solaris userland is broken...

The original syntax wasn't working with a 'modern' GNU make, but that didn't matter as it's only the non-GNU platforms which need these tweaks. (You'd only get a build as intended on those platforms if you used the normal make, not gmake.)

I confirm, on version [3abab7e177] makefile tested and work with no problem on:

  - OpenBSD 4.9 using bsd make and gnu make

  - QNX 6.4.1 (which use gnu make)

So, it seems to be the way to go.