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