Fossil SCM
Only allow the default Makefile to build fossil on platforms where it's known to work. Update the build documentation to tell the user to use the GNUmakefile explicitly, to avoid accidently building using the default makefile on non-GNU platforms.
Commit
14d1e449571224f8bd2526cd295baaa6f7796ade
Parent
4adc11edb756c53…
6 files changed
+4
-1
+3
+3
+26
+4
-1
+4
-1
+4
-1
| --- BUILD.txt | ||
| +++ BUILD.txt | ||
| @@ -4,15 +4,18 @@ | ||
| 4 | 4 | |
| 5 | 5 | If you have an unusual unix system for which the standard Makefile |
| 6 | 6 | will not work, or if you want to do some non-standard options, you can |
| 7 | 7 | also run: |
| 8 | 8 | |
| 9 | - ./configure; make | |
| 9 | + ./configure; make -f GNUmakefile | |
| 10 | 10 | |
| 11 | 11 | The ./configure script builds GNUmakefile which will be used in place |
| 12 | 12 | of Makefile. Run "./configure --help" for a listing of the available |
| 13 | 13 | options. |
| 14 | + | |
| 15 | +You must explicitly specify that make should use GNUmakefile in case | |
| 16 | +your platform does not use GNU make. | |
| 14 | 17 | |
| 15 | 18 | On a windows box, use one of the Makefiles in the win/ subdirectory, |
| 16 | 19 | according to your compiler and environment. If you have GCC and MSYS |
| 17 | 20 | installed on your system, the consider: |
| 18 | 21 | |
| 19 | 22 |
| --- BUILD.txt | |
| +++ BUILD.txt | |
| @@ -4,15 +4,18 @@ | |
| 4 | |
| 5 | If you have an unusual unix system for which the standard Makefile |
| 6 | will not work, or if you want to do some non-standard options, you can |
| 7 | also run: |
| 8 | |
| 9 | ./configure; make |
| 10 | |
| 11 | The ./configure script builds GNUmakefile which will be used in place |
| 12 | of Makefile. Run "./configure --help" for a listing of the available |
| 13 | options. |
| 14 | |
| 15 | On a windows box, use one of the Makefiles in the win/ subdirectory, |
| 16 | according to your compiler and environment. If you have GCC and MSYS |
| 17 | installed on your system, the consider: |
| 18 | |
| 19 |
| --- BUILD.txt | |
| +++ BUILD.txt | |
| @@ -4,15 +4,18 @@ | |
| 4 | |
| 5 | If you have an unusual unix system for which the standard Makefile |
| 6 | will not work, or if you want to do some non-standard options, you can |
| 7 | also run: |
| 8 | |
| 9 | ./configure; make -f GNUmakefile |
| 10 | |
| 11 | The ./configure script builds GNUmakefile which will be used in place |
| 12 | of Makefile. Run "./configure --help" for a listing of the available |
| 13 | options. |
| 14 | |
| 15 | You must explicitly specify that make should use GNUmakefile in case |
| 16 | your platform does not use GNU make. |
| 17 | |
| 18 | On a windows box, use one of the Makefiles in the win/ subdirectory, |
| 19 | according to your compiler and environment. If you have GCC and MSYS |
| 20 | installed on your system, the consider: |
| 21 | |
| 22 |
+3
| --- GNUmakefile.in | ||
| +++ GNUmakefile.in | ||
| @@ -37,9 +37,12 @@ | ||
| 37 | 37 | LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@ |
| 38 | 38 | TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H |
| 39 | 39 | INSTALLDIR = $(DESTDIR)@prefix@/bin |
| 40 | 40 | USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@ |
| 41 | 41 | |
| 42 | +# Disable the platform check | |
| 43 | +PLATFORM_CHECK_KIND = disable | |
| 44 | + | |
| 42 | 45 | include $(SRCDIR)/main.mk |
| 43 | 46 | |
| 44 | 47 | distclean: clean |
| 45 | 48 | rm -f autoconfig.h config.log GNUmakefile |
| 46 | 49 |
| --- GNUmakefile.in | |
| +++ GNUmakefile.in | |
| @@ -37,9 +37,12 @@ | |
| 37 | LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@ |
| 38 | TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H |
| 39 | INSTALLDIR = $(DESTDIR)@prefix@/bin |
| 40 | USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@ |
| 41 | |
| 42 | include $(SRCDIR)/main.mk |
| 43 | |
| 44 | distclean: clean |
| 45 | rm -f autoconfig.h config.log GNUmakefile |
| 46 |
| --- GNUmakefile.in | |
| +++ GNUmakefile.in | |
| @@ -37,9 +37,12 @@ | |
| 37 | LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@ |
| 38 | TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H |
| 39 | INSTALLDIR = $(DESTDIR)@prefix@/bin |
| 40 | USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@ |
| 41 | |
| 42 | # Disable the platform check |
| 43 | PLATFORM_CHECK_KIND = disable |
| 44 | |
| 45 | include $(SRCDIR)/main.mk |
| 46 | |
| 47 | distclean: clean |
| 48 | rm -f autoconfig.h config.log GNUmakefile |
| 49 |
M
Makefile
+3
| --- Makefile | ||
| +++ Makefile | ||
| @@ -70,6 +70,9 @@ | ||
| 70 | 70 | TCC.FreeBSD += -DUSE_PREAD |
| 71 | 71 | TCC.NetBSD += -DUSE_PREAD |
| 72 | 72 | TCC.OpenBSD += -DUSE_PREAD |
| 73 | 73 | TCC += $(TCC.$(HOST_OS)) |
| 74 | 74 | |
| 75 | +# Platform check | |
| 76 | +PLATFORM_CHECK_KIND = Makefile | |
| 77 | + | |
| 75 | 78 | include $(SRCDIR)/main.mk |
| 76 | 79 | |
| 77 | 80 | ADDED src/check-platform.sh |
| --- Makefile | |
| +++ Makefile | |
| @@ -70,6 +70,9 @@ | |
| 70 | TCC.FreeBSD += -DUSE_PREAD |
| 71 | TCC.NetBSD += -DUSE_PREAD |
| 72 | TCC.OpenBSD += -DUSE_PREAD |
| 73 | TCC += $(TCC.$(HOST_OS)) |
| 74 | |
| 75 | include $(SRCDIR)/main.mk |
| 76 | |
| 77 | DDED src/check-platform.sh |
| --- Makefile | |
| +++ Makefile | |
| @@ -70,6 +70,9 @@ | |
| 70 | TCC.FreeBSD += -DUSE_PREAD |
| 71 | TCC.NetBSD += -DUSE_PREAD |
| 72 | TCC.OpenBSD += -DUSE_PREAD |
| 73 | TCC += $(TCC.$(HOST_OS)) |
| 74 | |
| 75 | # Platform check |
| 76 | PLATFORM_CHECK_KIND = Makefile |
| 77 | |
| 78 | include $(SRCDIR)/main.mk |
| 79 | |
| 80 | DDED src/check-platform.sh |
+26
| --- a/src/check-platform.sh | ||
| +++ b/src/check-platform.sh | ||
| @@ -0,0 +1,26 @@ | ||
| 1 | +#!/bin/sh | |
| 2 | + | |
| 3 | +# This script checks that the default makefile is only used on platforms where it is | |
| 4 | +# positively known to work. | |
| 5 | +# | |
| 6 | +# Building on other platforms can result in subtly broken binaries. | |
| 7 | + | |
| 8 | +HOST_OS=`uname -s` | |
| 9 | + | |
| 10 | +# Check host OS, or whether this check has been disabled because we're running through | |
| 11 | +# the autosetup GNUmakefile. | |
| 12 | +if [ $HOST_OS == Linux ] || [ $HOST_OS == Darwin ] || [ X$1 == Xdisable ] | |
| 13 | +then | |
| 14 | + touch bld/checked-platform.$1 | |
| 15 | +else | |
| 16 | + echo | |
| 17 | + echo The default Makefile cannot be used on this platform. | |
| 18 | + echo | |
| 19 | + echo Use | |
| 20 | + echo | |
| 21 | + echo " ./configure; make -f GNUmakefile" | |
| 22 | + echo | |
| 23 | + echo to build fossil. | |
| 24 | + echo | |
| 25 | + exit 1 | |
| 26 | +fi |
| --- a/src/check-platform.sh | |
| +++ b/src/check-platform.sh | |
| @@ -0,0 +1,26 @@ | |
| --- a/src/check-platform.sh | |
| +++ b/src/check-platform.sh | |
| @@ -0,0 +1,26 @@ | |
| 1 | #!/bin/sh |
| 2 | |
| 3 | # This script checks that the default makefile is only used on platforms where it is |
| 4 | # positively known to work. |
| 5 | # |
| 6 | # Building on other platforms can result in subtly broken binaries. |
| 7 | |
| 8 | HOST_OS=`uname -s` |
| 9 | |
| 10 | # Check host OS, or whether this check has been disabled because we're running through |
| 11 | # the autosetup GNUmakefile. |
| 12 | if [ $HOST_OS == Linux ] || [ $HOST_OS == Darwin ] || [ X$1 == Xdisable ] |
| 13 | then |
| 14 | touch bld/checked-platform.$1 |
| 15 | else |
| 16 | echo |
| 17 | echo The default Makefile cannot be used on this platform. |
| 18 | echo |
| 19 | echo Use |
| 20 | echo |
| 21 | echo " ./configure; make -f GNUmakefile" |
| 22 | echo |
| 23 | echo to build fossil. |
| 24 | echo |
| 25 | exit 1 |
| 26 | fi |
+4
-1
| --- src/main.mk | ||
| +++ src/main.mk | ||
| @@ -303,11 +303,14 @@ | ||
| 303 | 303 | SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o |
| 304 | 304 | SQLITE3_OBJ. = $(SQLITE3_OBJ.0) |
| 305 | 305 | |
| 306 | 306 | EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o |
| 307 | 307 | |
| 308 | -$(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) | |
| 308 | +$(OBJDIR)/checked-platform.$(PLATFORM_CHECK_KIND): $(SRCDIR)/check-platform.sh | |
| 309 | + sh $(SRCDIR)/check-platform.sh $(PLATFORM_CHECK_KIND) | |
| 310 | + | |
| 311 | +$(APPNAME): $(OBJDIR)/checked-platform.$(PLATFORM_CHECK_KIND) $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) | |
| 309 | 312 | $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) |
| 310 | 313 | |
| 311 | 314 | # This rule prevents make from using its default rules to try build |
| 312 | 315 | # an executable named "manifest" out of the file named "manifest.c" |
| 313 | 316 | # |
| 314 | 317 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -303,11 +303,14 @@ | |
| 303 | SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o |
| 304 | SQLITE3_OBJ. = $(SQLITE3_OBJ.0) |
| 305 | |
| 306 | EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o |
| 307 | |
| 308 | $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) |
| 309 | $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) |
| 310 | |
| 311 | # This rule prevents make from using its default rules to try build |
| 312 | # an executable named "manifest" out of the file named "manifest.c" |
| 313 | # |
| 314 |
| --- src/main.mk | |
| +++ src/main.mk | |
| @@ -303,11 +303,14 @@ | |
| 303 | SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o |
| 304 | SQLITE3_OBJ. = $(SQLITE3_OBJ.0) |
| 305 | |
| 306 | EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o |
| 307 | |
| 308 | $(OBJDIR)/checked-platform.$(PLATFORM_CHECK_KIND): $(SRCDIR)/check-platform.sh |
| 309 | sh $(SRCDIR)/check-platform.sh $(PLATFORM_CHECK_KIND) |
| 310 | |
| 311 | $(APPNAME): $(OBJDIR)/checked-platform.$(PLATFORM_CHECK_KIND) $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) |
| 312 | $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) |
| 313 | |
| 314 | # This rule prevents make from using its default rules to try build |
| 315 | # an executable named "manifest" out of the file named "manifest.c" |
| 316 | # |
| 317 |
+4
-1
| --- src/makemake.tcl | ||
| +++ src/makemake.tcl | ||
| @@ -204,11 +204,14 @@ | ||
| 204 | 204 | $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \ |
| 205 | 205 | $(OBJDIR)/shell.o \ |
| 206 | 206 | $(OBJDIR)/th.o \ |
| 207 | 207 | $(OBJDIR)/th_lang.o |
| 208 | 208 | |
| 209 | -$(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) | |
| 209 | +$(OBJDIR)/checked-platform.$(PLATFORM_CHECK_KIND): $(SRCDIR)/check-platform.sh | |
| 210 | + sh $(SRCDIR)/check-platform.sh $(PLATFORM_CHECK_KIND) | |
| 211 | + | |
| 212 | +$(APPNAME): $(OBJDIR)/checked-platform.$(PLATFORM_CHECK_KIND) $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) | |
| 210 | 213 | $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) |
| 211 | 214 | |
| 212 | 215 | # This rule prevents make from using its default rules to try build |
| 213 | 216 | # an executable named "manifest" out of the file named "manifest.c" |
| 214 | 217 | # |
| 215 | 218 |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -204,11 +204,14 @@ | |
| 204 | $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \ |
| 205 | $(OBJDIR)/shell.o \ |
| 206 | $(OBJDIR)/th.o \ |
| 207 | $(OBJDIR)/th_lang.o |
| 208 | |
| 209 | $(APPNAME): $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) |
| 210 | $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) |
| 211 | |
| 212 | # This rule prevents make from using its default rules to try build |
| 213 | # an executable named "manifest" out of the file named "manifest.c" |
| 214 | # |
| 215 |
| --- src/makemake.tcl | |
| +++ src/makemake.tcl | |
| @@ -204,11 +204,14 @@ | |
| 204 | $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \ |
| 205 | $(OBJDIR)/shell.o \ |
| 206 | $(OBJDIR)/th.o \ |
| 207 | $(OBJDIR)/th_lang.o |
| 208 | |
| 209 | $(OBJDIR)/checked-platform.$(PLATFORM_CHECK_KIND): $(SRCDIR)/check-platform.sh |
| 210 | sh $(SRCDIR)/check-platform.sh $(PLATFORM_CHECK_KIND) |
| 211 | |
| 212 | $(APPNAME): $(OBJDIR)/checked-platform.$(PLATFORM_CHECK_KIND) $(OBJDIR)/headers $(OBJ) $(EXTRAOBJ) |
| 213 | $(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB) |
| 214 | |
| 215 | # This rule prevents make from using its default rules to try build |
| 216 | # an executable named "manifest" out of the file named "manifest.c" |
| 217 | # |
| 218 |