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