|
| 1 | +######################################################################## |
| 2 | +# This is a main makefile for the "autoconf" bundle of SQLite. This is |
| 3 | +# a trimmed-down version of the canonical makefile, devoid of most |
| 4 | +# documentation. For the full docs, see /main.mk in the canonical |
| 5 | +# source tree. |
| 6 | +# |
| 7 | +# Maintenance reminders: |
| 8 | +# |
| 9 | +# - To keep this working with an out-of-tree build, be sure to prefix |
| 10 | +# input file names with $(TOP)/ where appropriate (which is most |
| 11 | +# places). |
| 12 | +# |
| 13 | +# - The original/canonical recipes can be found in /main.mk in the |
| 14 | +# canonical source tree. |
| 15 | +all: |
| 16 | + |
| 17 | +TOP = @abs_top_srcdir@ |
| 18 | + |
| 19 | +PACKAGE_VERSION = @PACKAGE_VERSION@ |
| 20 | + |
| 21 | +# |
| 22 | +# Filename extensions for binaries and libraries |
| 23 | +# |
| 24 | +B.exe = @BUILD_EXEEXT@ |
| 25 | +T.exe = @TARGET_EXEEXT@ |
| 26 | +B.dll = @BUILD_DLLEXT@ |
| 27 | +T.dll = @TARGET_DLLEXT@ |
| 28 | +B.lib = @BUILD_LIBEXT@ |
| 29 | +T.lib = @TARGET_LIBEXT@ |
| 30 | + |
| 31 | +# |
| 32 | +# Autotools-compatibility dirs |
| 33 | +# |
| 34 | +prefix = @prefix@ |
| 35 | +datadir = @datadir@ |
| 36 | +mandir = @mandir@ |
| 37 | +includedir = @includedir@ |
| 38 | +exec_prefix = @exec_prefix@ |
| 39 | +bindir = @bindir@ |
| 40 | +libdir = @libdir@ |
| 41 | + |
| 42 | +# |
| 43 | +# Required binaries |
| 44 | +# |
| 45 | +INSTALL = @BIN_INSTALL@ |
| 46 | +AR = @AR@ |
| 47 | +AR.flags = cr |
| 48 | +CC = @CC@ |
| 49 | + |
| 50 | + |
| 51 | +ENABLE_LIB_SHARED = @ENABLE_LIB_SHARED@ |
| 52 | +ENABLE_LIB_STATIC = @ENABLE_LIB_STATIC@ |
| 53 | +HAVE_WASI_SDK = @HAVE_WASI_SDK@ |
| 54 | + |
| 55 | +CFLAGS = @CFLAGS@ @CPPFLAGS@ |
| 56 | +# |
| 57 | +# $(LDFLAGS.configure) represents any LDFLAGS=... the client passes to |
| 58 | +# configure. See main.mk. |
| 59 | +# |
| 60 | +LDFLAGS.configure = @LDFLAGS@ |
| 61 | + |
| 62 | +CFLAGS.core = @SH_CFLAGS@ |
| 63 | +LDFLAGS.shlib = @SH_LDFLAGS@ |
| 64 | +LDFLAGS.zlib = @LDFLAGS_ZLIB@ |
| 65 | +LDFLAGS.math = @LDFLAGS_MATH@ |
| 66 | +LDFLAGS.rpath = @LDFLAGS_RPATH@ |
| 67 | +LDFLAGS.pthread = @LDFLAGS_PTHREAD@ |
| 68 | +LDFLAGS.dlopen = @LDFLAGS_DLOPEN@ |
| 69 | +LDFLAGS.readline = @LDFLAGS_READLINE@ |
| 70 | +CFLAGS.readline = @CFLAGS_READLINE@ |
| 71 | +LDFLAGS.rt = @LDFLAGS_RT@ |
| 72 | +LDFLAGS.icu = @LDFLAGS_ICU@ |
| 73 | +CFLAGS.icu = @CFLAGS_ICU@ |
| 74 | + |
| 75 | +# INSTALL reminder: we specifically do not strip binaries, |
| 76 | +# as discussed in https://sqlite.org/forum/forumpost/9a67df63eda9925c. |
| 77 | +INSTALL.noexec = $(INSTALL) -m 0644 |
| 78 | + |
| 79 | +install-dir.bin = $(DESTDIR)$(bindir) |
| 80 | +install-dir.lib = $(DESTDIR)$(libdir) |
| 81 | +install-dir.include = $(DESTDIR)$(includedir) |
| 82 | +install-dir.pkgconfig = $(DESTDIR)$(libdir)/pkgconfig |
| 83 | +install-dir.man1 = $(DESTDIR)$(mandir)/man1 |
| 84 | +install-dir.all = $(install-dir.bin) $(install-dir.include) \ |
| 85 | + $(install-dir.lib) $(install-dir.man1) \ |
| 86 | + $(install-dir.pkgconfig) |
| 87 | +$(install-dir.all): |
| 88 | + @if [ ! -d "$@" ]; then set -x; $(INSTALL) -d "$@"; fi |
| 89 | +# ^^^^ on some platforms, install -d fails if the target already exists. |
| 90 | + |
| 91 | + |
| 92 | +# |
| 93 | +# Vars with the AS_ prefix are specifically related to AutoSetup. |
| 94 | +# |
| 95 | +# AS_AUTO_DEF is the main configure script. |
| 96 | +# |
| 97 | +AS_AUTO_DEF = $(TOP)/auto.def |
| 98 | + |
| 99 | +# |
| 100 | +# Shell commands to re-run $(TOP)/configure with the same args it was |
| 101 | +# invoked with to produce this makefile. |
| 102 | +# |
| 103 | +AS_AUTORECONFIG = @SQLITE_AUTORECONFIG@ |
| 104 | +Makefile: $(TOP)/Makefile.in $(AS_AUTO_DEF) |
| 105 | + $(AS_AUTORECONFIG) |
| 106 | + @touch $@ |
| 107 | + |
| 108 | +sqlite3mc.pc: $(TOP)/sqlite3mc.pc.in $(AS_AUTO_DEF) |
| 109 | + $(AS_AUTORECONFIG) |
| 110 | + @touch $@ |
| 111 | + |
| 112 | +sqlite_cfg.h: $(AS_AUTO_DEF) |
| 113 | + $(AS_AUTORECONFIG) |
| 114 | + @touch $@ |
| 115 | + |
| 116 | +# |
| 117 | +# CFLAGS for sqlite3$(T.exe) |
| 118 | +# |
| 119 | +SHELL_OPT ?= @OPT_SHELL@ |
| 120 | + |
| 121 | +# |
| 122 | +# Library-level feature flags |
| 123 | +# |
| 124 | +OPT_FEATURE_FLAGS = @OPT_FEATURE_FLAGS@ |
| 125 | + |
| 126 | +LDFLAGS.libsqlite3.soname = @LDFLAGS_LIBSQLITE3_SONAME@ |
| 127 | +# soname: see https://sqlite.org/src/forumpost/5a3b44f510df8ded |
| 128 | +LDFLAGS.libsqlite3.os-specific = \ |
| 129 | + @LDFLAGS_MAC_CVERSION@ @LDFLAGS_MAC_INSTALL_NAME@ @LDFLAGS_OUT_IMPLIB@ |
| 130 | + |
| 131 | +LDFLAGS.libsqlite3 = \ |
| 132 | + $(LDFLAGS.rpath) $(LDFLAGS.pthread) \ |
| 133 | + $(LDFLAGS.math) $(LDFLAGS.dlopen) \ |
| 134 | + $(LDFLAGS.zlib) $(LDFLAGS.icu) \ |
| 135 | + $(LDFLAGS.rt) $(LDFLAGS.configure) |
| 136 | +CFLAGS.libsqlite3 = -I. $(CFLAGS.core) $(CFLAGS.icu) $(OPT_FEATURE_FLAGS) |
| 137 | + |
| 138 | +sqlite3.o: $(TOP)/sqlite3.h $(TOP)/sqlite3.c |
| 139 | + $(CC) -c $(TOP)/sqlite3.c -o $@ $(CFLAGS) $(CFLAGS.libsqlite3) |
| 140 | + |
| 141 | +libsqlite3.LIB = libsqlite3mc$(T.lib) |
| 142 | +libsqlite3.DLL.basename = @SQLITE_DLL_BASENAME@ |
| 143 | +libsqlite3.out.implib = @SQLITE_OUT_IMPLIB@ |
| 144 | +libsqlite3.DLL = $(libsqlite3.DLL.basename)$(T.dll) |
| 145 | +libsqlite3.DLL.install-rules = @SQLITE_DLL_INSTALL_RULES@ |
| 146 | + |
| 147 | +$(libsqlite3.DLL): sqlite3.o |
| 148 | + $(CC) -o $@ sqlite3.o $(LDFLAGS.shlib) \ |
| 149 | + $(LDFLAGS) $(LDFLAGS.libsqlite3) \ |
| 150 | + $(LDFLAGS.libsqlite3.os-specific) $(LDFLAGS.libsqlite3.soname) |
| 151 | +$(libsqlite3.DLL)-1: $(libsqlite3.DLL) |
| 152 | +$(libsqlite3.DLL)-0: |
| 153 | +all: $(libsqlite3.DLL)-$(ENABLE_LIB_SHARED) |
| 154 | + |
| 155 | +$(libsqlite3.LIB): sqlite3.o |
| 156 | + $(AR) $(AR.flags) $@ sqlite3.o |
| 157 | +$(libsqlite3.LIB)-1: $(libsqlite3.LIB) |
| 158 | +$(libsqlite3.LIB)-0: |
| 159 | +all: $(libsqlite3.LIB)-$(ENABLE_LIB_STATIC) |
| 160 | + |
| 161 | +# |
| 162 | +# Maintenance reminder: the install-dll-... rules must be kept in sync |
| 163 | +# with the main copies rom /main.mk. |
| 164 | +# |
| 165 | +install-dll-out-implib: $(install-dir.lib) $(libsqlite3.DLL) |
| 166 | + if [ x != "x$(libsqlite3.out.implib)" ] && [ -f "$(libsqlite3.out.implib)" ]; then \ |
| 167 | + $(INSTALL) $(libsqlite3.out.implib) "$(install-dir.lib)"; \ |
| 168 | + fi |
| 169 | + |
| 170 | +install-dll-unix-generic: install-dll-out-implib |
| 171 | + $(INSTALL) $(libsqlite3.DLL) "$(install-dir.lib)" |
| 172 | + @echo "Setting up $(libsqlite3.DLL) version symlinks..."; \ |
| 173 | + cd "$(install-dir.lib)" || exit $$?; \ |
| 174 | + rm -f $(libsqlite3.DLL).0 $(libsqlite3.DLL).$(PACKAGE_VERSION) || exit $$?; \ |
| 175 | + mv $(libsqlite3.DLL) $(libsqlite3.DLL).$(PACKAGE_VERSION) || exit $$?; \ |
| 176 | + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL) || exit $$?; \ |
| 177 | + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0 || exit $$?; \ |
| 178 | + ls -la $(libsqlite3.DLL) $(libsqlite3.DLL).[a03]*; \ |
| 179 | + if [ -e $(libsqlite3.DLL).0.8.6 ]; then \ |
| 180 | + echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \ |
| 181 | + rm -f libsqlite3mc.la $(libsqlite3.DLL).0.8.6 || exit $$?; \ |
| 182 | + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0.8.6 || exit $$?; \ |
| 183 | + ls -la $(libsqlite3.DLL).0.8.6; \ |
| 184 | + elif [ x1 = "x$(INSTALL_SO_086_LINK)" ]; then \ |
| 185 | + echo "ACHTUNG: installing legacy libtool-style links because INSTALL_SO_086_LINK=1"; \ |
| 186 | + rm -f libsqlite3mc.la $(libsqlite3.DLL).0.8.6 || exit $$?; \ |
| 187 | + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0.8.6 || exit $$?; \ |
| 188 | + ls -la $(libsqlite3.DLL).0.8.6; \ |
| 189 | + fi |
| 190 | + |
| 191 | +install-dll-msys: install-dll-out-implib $(install-dir.bin) |
| 192 | + $(INSTALL) $(libsqlite3.DLL) "$(install-dir.bin)" |
| 193 | +# ----------------------------------------------^^^ yes, bin |
| 194 | +# Each of {msys,mingw,cygwin} uses a different name for the DLL, but |
| 195 | +# that is already accounted for via $(libsqlite3.DLL). |
| 196 | +install-dll-mingw: install-dll-msys |
| 197 | +install-dll-cygwin: install-dll-msys |
| 198 | + |
| 199 | +install-dll-darwin: $(install-dir.lib) $(libsqlite3.DLL) |
| 200 | + $(INSTALL) $(libsqlite3.DLL) "$(install-dir.lib)" |
| 201 | + @echo "Setting up $(libsqlite3.DLL) version symlinks..."; \ |
| 202 | + cd "$(install-dir.lib)" || exit $$?; \ |
| 203 | + rm -f libsqlite3mc.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \ |
| 204 | + dllname=libsqlite3mc.$(PACKAGE_VERSION)$(T.dll); \ |
| 205 | + mv $(libsqlite3.DLL) $$dllname || exit $$?; \ |
| 206 | + ln -s $$dllname $(libsqlite3.DLL) || exit $$?; \ |
| 207 | + ln -s $$dllname libsqlite3mc.0$(T.dll) || exit $$?; \ |
| 208 | + ls -la $$dllname $(libsqlite3.DLL) libsqlite3mc.0$(T.dll) |
| 209 | + |
| 210 | +install-dll-1: install-dll-$(libsqlite3.DLL.install-rules) |
| 211 | +install-dll-0 install-dll-: |
| 212 | +install-dll: install-dll-$(ENABLE_LIB_SHARED) |
| 213 | +install: install-dll |
| 214 | + |
| 215 | +install-lib-1: $(install-dir.lib) $(libsqlite3.LIB) |
| 216 | + $(INSTALL.noexec) $(libsqlite3.LIB) "$(install-dir.lib)" |
| 217 | +install-lib-0 install-lib-: |
| 218 | +install-lib: install-lib-$(ENABLE_LIB_STATIC) |
| 219 | +install: install-lib |
| 220 | + |
| 221 | +# |
| 222 | +# Flags to link the shell app either directly against sqlite3.c |
| 223 | +# (ENABLE_STATIC_SHELL==1) or libsqlite3.so (ENABLE_STATIC_SHELL==0). |
| 224 | +# |
| 225 | +ENABLE_STATIC_SHELL = @ENABLE_STATIC_SHELL@ |
| 226 | +sqlite3-shell-link-flags.1 = $(TOP)/sqlite3.c $(LDFLAGS.libsqlite3) |
| 227 | +sqlite3-shell-link-flags.0 = -L. -lsqlite3mc $(LDFLAGS.zlib) $(LDFLAGS.math) |
| 228 | +sqlite3-shell-deps.1 = $(TOP)/sqlite3.c |
| 229 | +sqlite3-shell-deps.0 = $(libsqlite3.DLL) |
| 230 | +# |
| 231 | +# STATIC_CLI_SHELL = 1 to statically link sqlite3$(T.exe), else |
| 232 | +# 0. Requires static versions of all requisite libraries. Primarily |
| 233 | +# intended for use with static-friendly environments like Alpine |
| 234 | +# Linux. |
| 235 | +# |
| 236 | +STATIC_CLI_SHELL = @STATIC_CLI_SHELL@ |
| 237 | +# |
| 238 | +# sqlite3-shell-static.flags.N = N is $(STATIC_CLI_SHELL) |
| 239 | +# |
| 240 | +sqlite3-shell-static.flags.1 = -static |
| 241 | +sqlite3-shell-static.flags.0 = |
| 242 | +sqlite3mc$(T.exe): $(TOP)/shell.c $(sqlite3-shell-deps.$(ENABLE_STATIC_SHELL)) |
| 243 | + $(CC) -o $@ \ |
| 244 | + $(TOP)/shell.c $(sqlite3-shell-link-flags.$(ENABLE_STATIC_SHELL)) \ |
| 245 | + $(sqlite3-shell-static.flags.$(STATIC_CLI_SHELL)) \ |
| 246 | + -I. $(OPT_FEATURE_FLAGS) $(SHELL_OPT) \ |
| 247 | + $(CFLAGS) $(CFLAGS.readline) $(CFLAGS.icu) \ |
| 248 | + $(LDFLAGS) $(LDFLAGS.readline) |
| 249 | + |
| 250 | +sqlite3mc$(T.exe)-1: |
| 251 | +sqlite3mc$(T.exe)-0: sqlite3mc$(T.exe) |
| 252 | +all: sqlite3mc$(T.exe)-$(HAVE_WASI_SDK) |
| 253 | + |
| 254 | +install-shell-0: sqlite3mc$(T.exe) $(install-dir.bin) |
| 255 | + $(INSTALL) sqlitemc3$(T.exe) "$(install-dir.bin)" |
| 256 | +install-shell-1: |
| 257 | +install: install-shell-$(HAVE_WASI_SDK) |
| 258 | + |
| 259 | +install-headers: $(TOP)/sqlite3.h $(install-dir.include) |
| 260 | + $(INSTALL.noexec) $(TOP)/sqlite3.h $(TOP)/sqlite3ext.h "$(install-dir.include)" |
| 261 | +install: install-headers |
| 262 | + |
| 263 | +install-pc: sqlite3mc.pc $(install-dir.pkgconfig) |
| 264 | + $(INSTALL.noexec) sqlite3mc.pc "$(install-dir.pkgconfig)" |
| 265 | +install: install-pc |
| 266 | + |
| 267 | +install-man1: $(TOP)/sqlite3.1 $(install-dir.man1) |
| 268 | + $(INSTALL.noexec) $(TOP)/sqlite3.1 "$(install-dir.man1)" |
| 269 | +install: install-man1 |
| 270 | + |
| 271 | +clean: |
| 272 | + rm -f *.o sqlite3mc$(T.exe) |
| 273 | + rm -f $(libsqlite3.LIB) $(libsqlite3.DLL) libsqlite3mc$(T.dll).a |
| 274 | + |
| 275 | +distclean: clean |
| 276 | + rm -f jimsh0$(T.exe) config.* sqlite3mc.pc sqlite_cfg.h Makefile |
| 277 | + |
| 278 | +DIST_FILES := \ |
| 279 | + README.txt VERSION \ |
| 280 | + auto.def autosetup configure tea \ |
| 281 | + sqlite3.h sqlite3.c shell.c sqlite3ext.h \ |
| 282 | + Makefile.in Makefile.msc Makefile.fallback \ |
| 283 | + sqlite3.rc sqlite3rc.h Replace.cs \ |
| 284 | + sqlite3mc.pc.in sqlite3.1 |
| 285 | + |
| 286 | +# |
| 287 | +# Maintenance note: dist_name must be sqlite-$(PACKAGE_VERSION) so |
| 288 | +# that tool/mkautoconfamal.sh knows how to find it. |
| 289 | +# |
| 290 | +dist_name = sqlite3mc-$(PACKAGE_VERSION) |
| 291 | +dist_tarball = $(dist_name).tar.gz |
| 292 | +dist: |
| 293 | + rm -fr $(dist_name) |
| 294 | + mkdir -p $(dist_name) |
| 295 | + cp -rp $(DIST_FILES) $(dist_name)/. |
| 296 | + tar czf $(dist_tarball) $(dist_name) |
| 297 | + rm -fr $(dist_name) |
| 298 | + ls -l $(dist_tarball) |
0 commit comments