View Ticket
Not logged in
Ticket UUID: 5a96dd5f528606db7addd8156bb7b5d5fdda158f
Title: non-portable Makefile
Status: Fixed Type: Code_Defect
Severity: Important Priority:
Subsystem: Resolution: Fixed
Last Modified: 2011-05-31 13:00:45
Version Found In: 0448438c56d836a8a8261a
Description & Comments:
Tested and seemed to work with both BSD make and gnu make on NetBSD system.
--- 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


ben added on 2011-05-28 21:08:47 UTC:
That was changed recently for Solaris compatibility.

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


bharder added on 2011-05-29 18:21:17 UTC:

kamloops$ uname -a 
NetBSD kamloops 5.99.52 NetBSD 5.99.52 (kamloops) #80: Sat May 28 14:09:40 PDT 2011  root@kamloops:/usr/obj/sys/arch/amd64/compile/kamloops amd64
kamloops$ which make
/usr/bin/make
kamloops$ make
make: don't know how to make sh. Stop

make: stopped in /home/bch/work/fossil kamloops$

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.


ben added on 2011-05-30 07:21:37 UTC:
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?)


ben added on 2011-05-30 07:28:45 UTC:
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.


drh added on 2011-05-30 12:52:50 UTC:
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.


ben added on 2011-05-30 16:49:12 UTC:
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.


joerg added on 2011-05-30 16:51:59 UTC:
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...


ben added on 2011-05-30 17:10:40 UTC:
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.)


anonymous claiming to be mgagnon added on 2011-05-31 02:31:49 UTC:
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.