|
90b692b…
|
drh
|
1 |
#!/usr/bin/make |
|
90b692b…
|
drh
|
2 |
# |
|
90b692b…
|
drh
|
3 |
# This is the top-level makefile for Fossil when the build is occurring |
|
90b692b…
|
drh
|
4 |
# on a unix platform. This works out-of-the-box on most unix platforms. |
|
90b692b…
|
drh
|
5 |
# But you are free to vary some of the definitions if desired. |
|
90b692b…
|
drh
|
6 |
# |
|
90b692b…
|
drh
|
7 |
#### The toplevel directory of the source tree. Fossil can be built |
|
90b692b…
|
drh
|
8 |
# in a directory that is separate from the source tree. Just change |
|
90b692b…
|
drh
|
9 |
# the following to point from the build directory to the src/ folder. |
|
90b692b…
|
drh
|
10 |
# |
|
90b692b…
|
drh
|
11 |
SRCDIR = @srcdir@/src |
|
91f0f00…
|
mark
|
12 |
TOPDIR = @srcdir@ |
|
b62f651…
|
stephan
|
13 |
#### Upstream source files included directly in this repository. |
|
b62f651…
|
stephan
|
14 |
# |
|
b62f651…
|
stephan
|
15 |
SRCDIR_extsrc = @srcdir@/extsrc |
|
b62f651…
|
stephan
|
16 |
#### In-tree tools such as code generators and translators: |
|
b62f651…
|
stephan
|
17 |
# |
|
b62f651…
|
stephan
|
18 |
SRCDIR_tools = @srcdir@/tools |
|
90b692b…
|
drh
|
19 |
|
|
90b692b…
|
drh
|
20 |
#### The directory into which object code files should be written. |
|
d8ed5a0…
|
drh
|
21 |
# Having a "./" prefix in the value of this variable breaks our use of the |
|
d8ed5a0…
|
drh
|
22 |
# "makeheaders" tool when running make on the MinGW platform, apparently |
|
d8ed5a0…
|
drh
|
23 |
# due to some command line argument manipulation performed automatically |
|
d8ed5a0…
|
drh
|
24 |
# by the shell. |
|
90b692b…
|
drh
|
25 |
# |
|
90b692b…
|
drh
|
26 |
# |
|
d8ed5a0…
|
drh
|
27 |
OBJDIR = bld |
|
90b692b…
|
drh
|
28 |
|
|
90b692b…
|
drh
|
29 |
#### C Compiler and options for use in building executables that |
|
90b692b…
|
drh
|
30 |
# will run on the platform that is doing the build. This is used |
|
90b692b…
|
drh
|
31 |
# to compile code-generator programs as part of the build process. |
|
90b692b…
|
drh
|
32 |
# See TCC below for the C compiler for building the finished binary. |
|
90b692b…
|
drh
|
33 |
# |
|
90b692b…
|
drh
|
34 |
BCC = @CC_FOR_BUILD@ |
|
90b692b…
|
drh
|
35 |
|
|
90b692b…
|
drh
|
36 |
#### The suffix to add to final executable file. When cross-compiling |
|
90b692b…
|
drh
|
37 |
# to windows, make this ".exe". Otherwise leave it blank. |
|
90b692b…
|
drh
|
38 |
# |
|
90b692b…
|
drh
|
39 |
E = @EXEEXT@ |
|
90b692b…
|
drh
|
40 |
|
|
90b692b…
|
drh
|
41 |
TCC = @CC@ |
|
90b692b…
|
drh
|
42 |
|
|
90b692b…
|
drh
|
43 |
#### Tcl shell for use in running the fossil testsuite. If you do not |
|
90b692b…
|
drh
|
44 |
# care about testing the end result, this can be blank. |
|
90b692b…
|
drh
|
45 |
# |
|
ee2ffe3…
|
wyoung
|
46 |
TCLSH = @TCLSH@ |
|
90b692b…
|
drh
|
47 |
|
|
64def88…
|
drh
|
48 |
CFLAGS = @CFLAGS@ |
|
31d431e…
|
stephan
|
49 |
CFLAGS_INCLUDE = @CFLAGS_INCLUDE@ |
|
90b692b…
|
drh
|
50 |
LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@ |
|
09f4188…
|
ashepilko
|
51 |
BCCFLAGS = @CPPFLAGS@ $(CFLAGS) |
|
4aa7837…
|
drh
|
52 |
TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ $(CFLAGS) -DHAVE_AUTOCONFIG_H |
|
3990518…
|
george
|
53 |
# |
|
3990518…
|
george
|
54 |
# Fuzzing may be enable by appending -fsanitize=fuzzer -DFOSSIL_FUZZ |
|
3990518…
|
george
|
55 |
# to the TCCFLAGS variable. |
|
a186d8b…
|
drh
|
56 |
# For more thorough (but also slower) investigation |
|
3990518…
|
george
|
57 |
# -fsanitize=fuzzer,undefined,address |
|
3990518…
|
george
|
58 |
# might be more useful. |
|
3990518…
|
george
|
59 |
|
|
90b692b…
|
drh
|
60 |
INSTALLDIR = $(DESTDIR)@prefix@/bin |
|
90b692b…
|
drh
|
61 |
USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@ |
|
31d431e…
|
stephan
|
62 |
SQLITE3_SRC.2 = @SQLITE3_SRC.2@ |
|
31d431e…
|
stephan
|
63 |
SQLITE3_OBJ.2 = @SQLITE3_OBJ.2@ |
|
31d431e…
|
stephan
|
64 |
SQLITE3_SHELL_SRC.2 = @SQLITE3_SHELL_SRC.2@ |
|
31d431e…
|
stephan
|
65 |
SQLITE3_ORIGIN = @SQLITE3_ORIGIN@ |
|
31d431e…
|
stephan
|
66 |
# SQLITE3_ORIGIN changes... |
|
31d431e…
|
stephan
|
67 |
# SQLITE3_SRC: |
|
31d431e…
|
stephan
|
68 |
# 0=src/sqlite3.c, 1=src/sqlite3-see.c, 2=$(SQLITE3_SRC.2) |
|
31d431e…
|
stephan
|
69 |
# SQLITE3_SHELL_SRC: |
|
31d431e…
|
stephan
|
70 |
# 0=src/shell.c, 1=src/shell-see.c, 2=$(SQLITE3_SHELL_SRC.2) |
|
a0061bb…
|
mistachkin
|
71 |
USE_LINENOISE = @USE_LINENOISE@ |
|
d5ca538…
|
mistachkin
|
72 |
USE_MMAN_H = @USE_MMAN_H@ |
|
ed871fb…
|
drh
|
73 |
USE_SEE = @USE_SEE@ |
|
3a71292…
|
drh
|
74 |
APPNAME = fossil |
|
3990518…
|
george
|
75 |
# |
|
3990518…
|
george
|
76 |
# APPNAME = fossil-fuzz |
|
3990518…
|
george
|
77 |
# may be more appropriate for fuzzing. |
|
3990518…
|
george
|
78 |
|
|
7fcb462…
|
stephan
|
79 |
#### Emscripten stuff for optionally doing in-tree builds |
|
86787ea…
|
brickviking
|
80 |
# of any WASM components. We store precompiled WASM in the SCM, so |
|
7fcb462…
|
stephan
|
81 |
# this is only useful for people who actively work on WASM |
|
7fcb462…
|
stephan
|
82 |
# components. EMSDK_ENV refers to the "environment" script which comes |
|
7fcb462…
|
stephan
|
83 |
# with the Emscripten SDK package: |
|
7fcb462…
|
stephan
|
84 |
# https://emscripten.org/docs/getting_started/downloads.html |
|
7fcb462…
|
stephan
|
85 |
EMSDK_HOME = @EMSDK_HOME@ |
|
7fcb462…
|
stephan
|
86 |
EMSDK_ENV = @EMSDK_ENV@ |
|
7fcb462…
|
stephan
|
87 |
EMCC_OPT = @EMCC_OPT@ |
|
7fcb462…
|
stephan
|
88 |
EMCC_WRAPPER = $(SRCDIR_tools)/emcc.sh |
|
7fcb462…
|
stephan
|
89 |
|
|
91f0f00…
|
mark
|
90 |
# MAKE_COMPILATION_DB (yes/no) determines whether or not the |
|
91f0f00…
|
mark
|
91 |
# compile_commands.json file will be generated. |
|
91f0f00…
|
mark
|
92 |
MAKE_COMPILATION_DB = @MAKE_COMPILATION_DB@ |
|
91f0f00…
|
mark
|
93 |
|
|
ebb67be…
|
wyoung
|
94 |
.PHONY: all tags |
|
90b692b…
|
drh
|
95 |
|
|
90b692b…
|
drh
|
96 |
include $(SRCDIR)/main.mk |
|
ac3e326…
|
stephan
|
97 |
SQLITE_OPTIONS += @SQLITE_OPTIONS_EXT@ |
|
ac3e326…
|
stephan
|
98 |
SHELL_OPTIONS += @SQLITE_OPTIONS_EXT@ |
|
ac3e326…
|
stephan
|
99 |
# ^^^ must come after main.mk is included |
|
90b692b…
|
drh
|
100 |
|
|
90b692b…
|
drh
|
101 |
distclean: clean |
|
27c7a49…
|
ashepilko
|
102 |
-rm -f autoconfig.h config.log Makefile |
|
ebb67be…
|
wyoung
|
103 |
-rm -f cscope.out tags |
|
67a9088…
|
drh
|
104 |
|
|
67a9088…
|
drh
|
105 |
reconfig: |
|
67a9088…
|
drh
|
106 |
@AUTOREMAKE@ |
|
ebb67be…
|
wyoung
|
107 |
|
|
ebb67be…
|
wyoung
|
108 |
tags: |
|
ebb67be…
|
wyoung
|
109 |
ctags -R @srcdir@/src |
|
4211165…
|
wyoung
|
110 |
@COLLECT_CSCOPE_DATA@ |
|
50844e5…
|
wyoung
|
111 |
|
|
50844e5…
|
wyoung
|
112 |
# Automatically reconfigure whenever an autosetup file or one of the |
|
50844e5…
|
wyoung
|
113 |
# make source files change. |
|
67a9088…
|
drh
|
114 |
# |
|
67a9088…
|
drh
|
115 |
# The "touch" is necessary to avoid a make loop due to a new upstream |
|
50844e5…
|
wyoung
|
116 |
# feature in autosetup (GH 0a71e3c3b7) which rewrites *.in outputs only |
|
50844e5…
|
wyoung
|
117 |
# if doing so will write different contents; otherwise, it leaves them |
|
50844e5…
|
wyoung
|
118 |
# alone so the mtime doesn't change. This means that if you change one |
|
86787ea…
|
brickviking
|
119 |
# of our dependencies besides Makefile.in, we'll reconfigure but Makefile |
|
50844e5…
|
wyoung
|
120 |
# won't change, so this rule will remain out of date, so we'll reconfig |
|
50844e5…
|
wyoung
|
121 |
# but Makefile won't change, so we'll reconfig but... endlessly. |
|
50844e5…
|
wyoung
|
122 |
# |
|
50844e5…
|
wyoung
|
123 |
# This is also why we repeat the reconfig target's command here instead |
|
50844e5…
|
wyoung
|
124 |
# of delegating to it with "$(MAKE) reconfig": having children running |
|
50844e5…
|
wyoung
|
125 |
# around interfering makes this failure mode even worse. |
|
b9f57f5…
|
drh
|
126 |
Makefile: @srcdir@/Makefile.in $(SRCDIR)/main.mk @AUTODEPS@ |
|
67a9088…
|
drh
|
127 |
@AUTOREMAKE@ |
|
b9f57f5…
|
drh
|
128 |
touch @builddir@/Makefile |
|
67386c7…
|
wyoung
|
129 |
|
|
67386c7…
|
wyoung
|
130 |
# Container stuff |
|
1da464e…
|
wyoung
|
131 |
SRCTB := src-@[email protected] |
|
b7edb5f…
|
wyoung
|
132 |
IMGVER := fossil:@FOSSIL_CI_PFX@ |
|
b7edb5f…
|
wyoung
|
133 |
CNTVER := fossil-@FOSSIL_CI_PFX@ |
|
72d8240…
|
wyoung
|
134 |
CENGINE := docker |
|
b7edb5f…
|
wyoung
|
135 |
container: |
|
72d8240…
|
wyoung
|
136 |
$(CENGINE) image inspect $(IMGVER) > /dev/null 2>&1 || \ |
|
b7edb5f…
|
wyoung
|
137 |
$(MAKE) container-image |
|
72d8240…
|
wyoung
|
138 |
$(CENGINE) container inspect $(CNTVER) > /dev/null 2>&1 || \ |
|
72d8240…
|
wyoung
|
139 |
$(CENGINE) create \ |
|
b7edb5f…
|
wyoung
|
140 |
--name $(CNTVER) \ |
|
b7edb5f…
|
wyoung
|
141 |
--cap-drop AUDIT_WRITE \ |
|
b7edb5f…
|
wyoung
|
142 |
--cap-drop CHOWN \ |
|
b7edb5f…
|
wyoung
|
143 |
--cap-drop FSETID \ |
|
b7edb5f…
|
wyoung
|
144 |
--cap-drop KILL \ |
|
b7edb5f…
|
wyoung
|
145 |
--cap-drop MKNOD \ |
|
b7edb5f…
|
wyoung
|
146 |
--cap-drop NET_BIND_SERVICE \ |
|
b7edb5f…
|
wyoung
|
147 |
--cap-drop NET_RAW \ |
|
b7edb5f…
|
wyoung
|
148 |
--cap-drop SETFCAP \ |
|
b7edb5f…
|
wyoung
|
149 |
--cap-drop SETPCAP \ |
|
b7edb5f…
|
wyoung
|
150 |
--publish 8080:8080 \ |
|
79ac06a…
|
wyoung
|
151 |
$(DCFLAGS) $(IMGVER) $(DCCMD) |
|
b7edb5f…
|
wyoung
|
152 |
|
|
b7edb5f…
|
wyoung
|
153 |
container-clean: |
|
72d8240…
|
wyoung
|
154 |
-$(CENGINE) container kill $(CNTVER) |
|
72d8240…
|
wyoung
|
155 |
-$(CENGINE) container rm $(CNTVER) |
|
72d8240…
|
wyoung
|
156 |
-$(CENGINE) image rm $(IMGVER) |
|
b7edb5f…
|
wyoung
|
157 |
|
|
b0c9c26…
|
wyoung
|
158 |
container-image: |
|
1da464e…
|
wyoung
|
159 |
$(APPNAME) tarball --name src @FOSSIL_CI_PFX@ $(SRCTB) |
|
72d8240…
|
wyoung
|
160 |
$(CENGINE) buildx build \ |
|
b7edb5f…
|
wyoung
|
161 |
--load \ |
|
b7edb5f…
|
wyoung
|
162 |
--tag $(IMGVER) \ |
|
1da464e…
|
wyoung
|
163 |
--build-arg FSLURL=$(SRCTB) \ |
|
b0c9c26…
|
wyoung
|
164 |
$(DBFLAGS) @srcdir@ |
|
1da464e…
|
wyoung
|
165 |
rm -f $(SRCTB) |
|
1da464e…
|
wyoung
|
166 |
|
|
b7edb5f…
|
wyoung
|
167 |
container-run container-start: container |
|
72d8240…
|
wyoung
|
168 |
$(CENGINE) start $(DSFLAGS) $(CNTVER) |
|
b7edb5f…
|
wyoung
|
169 |
@sleep 1 # decrease likelihood of logging race condition |
|
72d8240…
|
wyoung
|
170 |
$(CENGINE) container logs $(CNTVER) |
|
b7edb5f…
|
wyoung
|
171 |
|
|
b7edb5f…
|
wyoung
|
172 |
container-stop: |
|
72d8240…
|
wyoung
|
173 |
$(CENGINE) stop $(CNTVER) |
|
b7edb5f…
|
wyoung
|
174 |
|
|
b7edb5f…
|
wyoung
|
175 |
container-version: |
|
b7edb5f…
|
wyoung
|
176 |
@echo $(CNTVER) |