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.

ben 2011-07-20 09:09 trunk
Commit 14d1e449571224f8bd2526cd295baaa6f7796ade
+4 -1
--- BUILD.txt
+++ BUILD.txt
@@ -4,15 +4,18 @@
44
55
If you have an unusual unix system for which the standard Makefile
66
will not work, or if you want to do some non-standard options, you can
77
also run:
88
9
- ./configure; make
9
+ ./configure; make -f GNUmakefile
1010
1111
The ./configure script builds GNUmakefile which will be used in place
1212
of Makefile. Run "./configure --help" for a listing of the available
1313
options.
14
+
15
+You must explicitly specify that make should use GNUmakefile in case
16
+your platform does not use GNU make.
1417
1518
On a windows box, use one of the Makefiles in the win/ subdirectory,
1619
according to your compiler and environment. If you have GCC and MSYS
1720
installed on your system, the consider:
1821
1922
--- 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
--- GNUmakefile.in
+++ GNUmakefile.in
@@ -37,9 +37,12 @@
3737
LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
3838
TCC += @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H
3939
INSTALLDIR = $(DESTDIR)@prefix@/bin
4040
USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
4141
42
+# Disable the platform check
43
+PLATFORM_CHECK_KIND = disable
44
+
4245
include $(SRCDIR)/main.mk
4346
4447
distclean: clean
4548
rm -f autoconfig.h config.log GNUmakefile
4649
--- 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
+3
--- Makefile
+++ Makefile
@@ -70,6 +70,9 @@
7070
TCC.FreeBSD += -DUSE_PREAD
7171
TCC.NetBSD += -DUSE_PREAD
7272
TCC.OpenBSD += -DUSE_PREAD
7373
TCC += $(TCC.$(HOST_OS))
7474
75
+# Platform check
76
+PLATFORM_CHECK_KIND = Makefile
77
+
7578
include $(SRCDIR)/main.mk
7679
7780
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
--- 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 @@
303303
SQLITE3_OBJ.0 = $(OBJDIR)/sqlite3.o
304304
SQLITE3_OBJ. = $(SQLITE3_OBJ.0)
305305
306306
EXTRAOBJ = $(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) $(OBJDIR)/shell.o $(OBJDIR)/th.o $(OBJDIR)/th_lang.o
307307
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)
309312
$(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
310313
311314
# This rule prevents make from using its default rules to try build
312315
# an executable named "manifest" out of the file named "manifest.c"
313316
#
314317
--- 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
--- src/makemake.tcl
+++ src/makemake.tcl
@@ -204,11 +204,14 @@
204204
$(SQLITE3_OBJ.$(USE_SYSTEM_SQLITE)) \
205205
$(OBJDIR)/shell.o \
206206
$(OBJDIR)/th.o \
207207
$(OBJDIR)/th_lang.o
208208
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)
210213
$(TCC) -o $(APPNAME) $(OBJ) $(EXTRAOBJ) $(LIB)
211214
212215
# This rule prevents make from using its default rules to try build
213216
# an executable named "manifest" out of the file named "manifest.c"
214217
#
215218
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button