Index: BUILD.txt ================================================================== --- BUILD.txt +++ BUILD.txt @@ -4,15 +4,18 @@ If you have an unusual unix system for which the standard Makefile will not work, or if you want to do some non-standard options, you can also run: - ./configure; make + ./configure; make -f GNUmakefile The ./configure script builds GNUmakefile which will be used in place of Makefile. Run "./configure --help" for a listing of the available options. + +You must explicitly specify that make should use GNUmakefile in case +your platform does not use GNU make. On a windows box, use one of the Makefiles in the win/ subdirectory, according to your compiler and environment. If you have GCC and MSYS installed on your system, the consider: Index: GNUmakefile.in ================================================================== --- GNUmakefile.in +++ GNUmakefile.in @@ -37,9 +37,12 @@ LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@ TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H INSTALLDIR = $(DESTDIR)@prefix@/bin USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@ +# Disable the platform check +PLATFORM_CHECK_KIND = disable + include $(SRCDIR)/main.mk distclean: clean rm -f autoconfig.h config.log GNUmakefile Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -70,6 +70,9 @@ TCC.FreeBSD += -DUSE_PREAD TCC.NetBSD += -DUSE_PREAD TCC.OpenBSD += -DUSE_PREAD TCC += $(TCC.$(HOST_OS)) +# Platform check +PLATFORM_CHECK_KIND = Makefile + include $(SRCDIR)/main.mk ADDED src/check-platform.sh Index: src/check-platform.sh ================================================================== --- /dev/null +++ src/check-platform.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +# This script checks that the default makefile is only used on platforms where it is +# positively known to work. +# +# Building on other platforms can result in subtly broken binaries. + +HOST_OS=`uname -s` + +# Check host OS, or whether this check has been disabled because we're running through +# the autosetup GNUmakefile. +if [ $HOST_OS == Linux ] || [ $HOST_OS == Darwin ] || [ X$1 == Xdisable ] +then + touch bld/checked-platform.$1 +else + echo + echo The default Makefile cannot be used on this platform. + echo + echo Use + echo + echo " ./configure; make -f GNUmakefile" + echo + echo to build fossil. + echo + exit 1 +fi Index: src/main.mk ================================================================== --- src/main.mk +++ src/main.mk @@ -303,11 +303,14 @@ SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o SQLITE3_OBJ. = $(SQLITE3_OBJ.0) EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o -$(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) +$(OBJDIR)/checked-platform.$(PLATFORM_CHECK_KIND): $(SRCDIR)/check-platform.sh + sh $(SRCDIR)/check-platform.sh $(PLATFORM_CHECK_KIND) + +$(APPNAME): $(OBJDIR)/checked-platform.$(PLATFORM_CHECK_KIND) $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) # This rule prevents make from using its default rules to try build # an executable named "manifest" out of the file named "manifest.c" # Index: src/makemake.tcl ================================================================== --- src/makemake.tcl +++ src/makemake.tcl @@ -204,11 +204,14 @@ $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \ $(OBJDIR)/shell.o \ $(OBJDIR)/th.o \ $(OBJDIR)/th_lang.o -$(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) +$(OBJDIR)/checked-platform.$(PLATFORM_CHECK_KIND): $(SRCDIR)/check-platform.sh + sh $(SRCDIR)/check-platform.sh $(PLATFORM_CHECK_KIND) + +$(APPNAME): $(OBJDIR)/checked-platform.$(PLATFORM_CHECK_KIND) $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) # This rule prevents make from using its default rules to try build # an executable named "manifest" out of the file named "manifest.c" #