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
7 # Maintenance reminders:
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
13 # - The original/canonical recipes can be found in /main.mk in the
14 # canonical source tree.
17 TOP
= @abs_top_srcdir@
19 PACKAGE_VERSION
= @PACKAGE_VERSION@
22 # Filename extensions for binaries and libraries
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@
32 # Autotools-compatibility dirs
37 includedir = @
includedir@
38 exec_prefix = @
exec_prefix@
45 INSTALL
= @BIN_INSTALL@
51 ENABLE_LIB_SHARED
= @ENABLE_LIB_SHARED@
52 ENABLE_LIB_STATIC
= @ENABLE_LIB_STATIC@
54 CFLAGS
= @CFLAGS@ @CPPFLAGS@
56 # $(LDFLAGS.configure) represents any LDFLAGS=... the client passes to
57 # configure. See main.mk.
59 LDFLAGS.configure
= @LDFLAGS@
61 CFLAGS.core
= @SH_CFLAGS@
62 LDFLAGS.shlib
= @SH_LDFLAGS@
63 LDFLAGS.zlib
= @LDFLAGS_ZLIB@
64 LDFLAGS.math
= @LDFLAGS_MATH@
65 LDFLAGS.rpath
= @LDFLAGS_RPATH@
66 LDFLAGS.pthread
= @LDFLAGS_PTHREAD@
67 LDFLAGS.dlopen
= @LDFLAGS_DLOPEN@
68 LDFLAGS.readline
= @LDFLAGS_READLINE@
69 CFLAGS.readline
= @CFLAGS_READLINE@
70 LDFLAGS.icu
= @LDFLAGS_ICU@
71 CFLAGS.icu
= @CFLAGS_ICU@
73 # When cross-compiling, we need to avoid the -s flag because it only
74 # works on the build host's platform.
75 INSTALL.
strip.1 = $(INSTALL
)
76 INSTALL.
strip.0 = $(INSTALL
) -s
77 INSTALL.
strip = $(INSTALL.
strip.@IS_CROSS_COMPILING@
)
78 INSTALL.noexec
= $(INSTALL
) -m
0644
80 install-dir.bin
= $(DESTDIR
)$(bindir)
81 install-dir.lib
= $(DESTDIR
)$(libdir)
82 install-dir.
include = $(DESTDIR
)$(includedir)
83 install-dir.pkgconfig
= $(DESTDIR
)$(libdir)/pkgconfig
84 install-dir.man1
= $(DESTDIR
)$(mandir)/man1
85 install-dir.
all = $(install-dir.bin
) $(install-dir.
include) \
86 $(install-dir.lib
) $(install-dir.man1
) \
87 $(install-dir.pkgconfig
)
89 if
[ ! -d
"$@" ]; then
$(INSTALL
) -d
"$@"; fi
90 # ^^^^ on some platforms, install -d fails if the target already exists.
94 # Vars with the AS_ prefix are specifically related to AutoSetup.
96 # AS_AUTO_DEF is the main configure script.
98 AS_AUTO_DEF
= $(TOP
)/auto.def
101 # Shell commands to re-run $(TOP)/configure with the same args it was
102 # invoked with to produce this makefile.
104 AS_AUTORECONFIG
= @SQLITE_AUTORECONFIG@
105 Makefile
: $(TOP
)/Makefile.in
$(AS_AUTO_DEF
)
109 sqlite3.
pc: $(TOP
)/sqlite3.
pc.in
$(AS_AUTO_DEF
)
113 sqlite_cfg.h
: $(AS_AUTO_DEF
)
118 # CFLAGS for sqlite3$(T.exe)
120 SHELL_OPT ?
= @OPT_SHELL@
123 # Library-level feature flags
125 OPT_FEATURE_FLAGS
= @OPT_FEATURE_FLAGS@
127 LDFLAGS.libsqlite3.soname
= @LDFLAGS_LIBSQLITE3_SONAME@
128 # soname: see https://sqlite.org/src/forumpost/5a3b44f510df8ded
129 LDFLAGS.libsqlite3.os-specific
= @LDFLAGS_MAC_CVERSION@
130 # os-specific: see https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7
132 LDFLAGS.libsqlite3
= \
133 $(LDFLAGS.rpath
) $(LDFLAGS.pthread
) \
134 $(LDFLAGS.math
) $(LDFLAGS.dlopen
) \
135 $(LDFLAGS.zlib
) $(LDFLAGS.icu
) \
137 CFLAGS.libsqlite3
= -I.
$(CFLAGS.core
) $(CFLAGS.icu
) $(OPT_FEATURE_FLAGS
)
139 sqlite3.o
: $(TOP
)/sqlite3.h
$(TOP
)/sqlite3.c
140 $(CC
) -c
$(TOP
)/sqlite3.c
-o
$@
$(CFLAGS
) $(CFLAGS.libsqlite3
)
142 libsqlite3.LIB
= libsqlite3
$(T.lib
)
143 libsqlite3.SO
= libsqlite3
$(T.dll
)
145 $(libsqlite3.SO
): sqlite3.o
146 $(CC
) -o
$@ sqlite3.o
$(LDFLAGS.shlib
) \
147 $(LDFLAGS
) $(LDFLAGS.libsqlite3
) \
148 $(LDFLAGS.libsqlite3.os-specific
) $(LDFLAGS.libsqlite3.soname
)
149 all: $(libsqlite3.SO
)
151 $(libsqlite3.LIB
): sqlite3.o
152 $(AR
) $(AR.flags
) $@ sqlite3.o
153 all: $(libsqlite3.LIB
)
155 install-so-1
: $(install-dir.lib
) $(libsqlite3.SO
)
156 $(INSTALL
) $(libsqlite3.SO
) "$(install-dir.lib)"
157 @echo
"Setting up $(libsqlite3.SO) version symlinks..."; \
158 cd
"$(install-dir.lib)" || exit
$$?
; \
159 if
[ x.dylib
= x
$(T.dll
) ]; then \
160 rm -f libsqlite3.0
$(T.dll
) libsqlite3.
$(PACKAGE_VERSION
)$(T.dll
) || exit
$$?
; \
161 dllname
=libsqlite3.
$(PACKAGE_VERSION
)$(T.dll
); \
162 mv
$(libsqlite3.SO
) $$dllname || exit
$$?
; \
163 ln
-s
$$dllname $(libsqlite3.SO
) || exit
$$?
; \
164 ln
-s
$$dllname libsqlite3.0
$(T.dll
) || exit
$$?
; \
165 ls
-la
$$dllname $(libsqlite3.SO
) libsqlite3.0
$(T.dll
); \
167 rm -f
$(libsqlite3.SO
).0 $(libsqlite3.SO
).
$(PACKAGE_VERSION
) || exit
$$?
; \
168 mv
$(libsqlite3.SO
) $(libsqlite3.SO
).
$(PACKAGE_VERSION
) || exit
$$?
; \
169 ln
-s
$(libsqlite3.SO
).
$(PACKAGE_VERSION
) $(libsqlite3.SO
) || exit
$$?
; \
170 ln
-s
$(libsqlite3.SO
).
$(PACKAGE_VERSION
) $(libsqlite3.SO
).0 || exit
$$?
; \
171 ls
-la
$(libsqlite3.SO
) $(libsqlite3.SO
).
[03]*; \
172 if
[ -e
$(libsqlite3.SO
).0.8.6 ]; then \
173 echo
"ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \
174 rm -f libsqlite3.la
$(libsqlite3.SO
).0.8.6 || exit
$$?
; \
175 ln
-s
$(libsqlite3.SO
).
$(PACKAGE_VERSION
) $(libsqlite3.SO
).0.8.6 || exit
$$?
; \
176 ls
-la
$(libsqlite3.SO
).0.8.6; \
177 elif
[ x1
= "x$(INSTALL_SO_086_LINK)" ]; then \
178 echo
"ACHTUNG: installing legacy libtool-style links because INSTALL_SO_086_LINK=1"; \
179 rm -f libsqlite3.la
$(libsqlite3.SO
).0.8.6 || exit
$$?
; \
180 ln
-s
$(libsqlite3.SO
).
$(PACKAGE_VERSION
) $(libsqlite3.SO
).0.8.6 || exit
$$?
; \
181 ls
-la
$(libsqlite3.SO
).0.8.6; \
185 install-so-0 install-so-
:
186 install-so
: install-so-
$(ENABLE_LIB_SHARED
)
189 install-lib-1
: $(install-dir.lib
) $(libsqlite3.LIB
)
190 $(INSTALL.noexec
) $(libsqlite3.LIB
) "$(install-dir.lib)"
191 install-lib-0 install-lib-
:
192 install-lib
: install-lib-
$(ENABLE_LIB_STATIC
)
196 sqlite3
$(T.exe
): $(TOP
)/shell.c
$(TOP
)/sqlite3.c
198 $(TOP
)/shell.c
$(TOP
)/sqlite3.c \
199 -I.
$(OPT_FEATURE_FLAGS
) $(SHELL_OPT
) \
200 $(CFLAGS
) $(CFLAGS.readline
) $(CFLAGS.icu
) \
201 $(LDFLAGS
) $(LDFLAGS.libsqlite3
) $(LDFLAGS.readline
)
204 install-shell
: sqlite3
$(T.exe
) $(install-dir.bin
)
205 $(INSTALL.
strip) sqlite3
$(T.exe
) "$(install-dir.bin)"
206 install: install-shell
208 install-headers
: $(TOP
)/sqlite3.h
$(install-dir.
include)
209 $(INSTALL.noexec
) $(TOP
)/sqlite3.h
$(TOP
)/sqlite3ext.h
"$(install-dir.include)"
210 install: install-headers
212 install-pc
: sqlite3.
pc $(install-dir.pkgconfig
)
213 $(INSTALL.noexec
) sqlite3.
pc "$(install-dir.pkgconfig)"
216 install-man1
: $(TOP
)/sqlite3.1
$(install-dir.man1
)
217 $(INSTALL.noexec
) $(TOP
)/sqlite3.1
"$(install-dir.man1)"
218 install: install-man1
221 rm -f
*.o sqlite3
$(T.exe
)
222 rm -f
$(libsqlite3.LIB
) $(libsqlite3.SO
)
225 rm -f jimsh0
$(T.exe
) config.
* sqlite3.
pc
229 auto.def autosetup configure tea \
230 sqlite3.h sqlite3.c
shell.c sqlite3ext.h \
231 Makefile.in Makefile.msc Makefile.fallback \
232 sqlite3.rc sqlite3rc.h Replace.cs \
233 sqlite3.
pc.in sqlite3.1
235 # Maintenance note: dist_name must be sqlite-$(PACKAGE_VERSION) so
236 # that tool/mkautoconfamal.sh knows how to find it.
237 dist_name
= sqlite-
$(PACKAGE_VERSION
)
238 dist_tarball
= $(dist_name
).
tar.gz
241 mkdir
-p
$(dist_name
)
242 cp
-rp
$(DIST_FILES
) $(dist_name
)/.
243 tar czf
$(dist_tarball
) $(dist_name
)
245 ls
-l
$(dist_tarball
)