summarylogtreecommitdiffstats
path: root/Makefile.ext.in
diff options
context:
space:
mode:
authorIlya Basin2021-12-05 23:45:43 +0300
committerIlya Basin2021-12-05 23:45:43 +0300
commit87bb3f9d94a2ba19caa36232021d464b3aa463c4 (patch)
treeb382253444401f1724eb131425acaf3f879f0535 /Makefile.ext.in
downloadaur-mingw-w64-sqlite3.tar.gz
root
Diffstat (limited to 'Makefile.ext.in')
-rw-r--r--Makefile.ext.in51
1 files changed, 51 insertions, 0 deletions
diff --git a/Makefile.ext.in b/Makefile.ext.in
new file mode 100644
index 000000000000..88211e4277ce
--- /dev/null
+++ b/Makefile.ext.in
@@ -0,0 +1,51 @@
+# PLEASE KEEP IN SYNC WITH CORRESPONDING FILE IN MSYS2-SQLITE.
+#
+# Makefile template to generate sqlite extensions in sub-folder ext/misc
+
+DLL_PREFIX =
+DLL_SUFFIX =
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+top_builddir = @top_builddir@
+
+vpath %.c $(srcdir)
+vpath %.in ../$(top_srcdir)
+
+PACKAGE_VERSION = @PACKAGE_VERSION@
+prefix = @prefix@
+datadir = @datadir@
+extdir = $(datadir)/sqlite/extensions
+
+# c-source for each of which an extension is built
+CSRCS = $(filter-out $(addprefix $(srcdir)/,$(CSRCS_IGNORE)),$(wildcard $(srcdir)/*.c))
+# c-sources not to compile as standalone sqlite-extensions
+CSRCS_IGNORE = memtrace.c json1.c
+# c-source already compiled into sqlite3 client
+CSRCS_IGNORE += regexp.c
+# c-source to be ignored because of compilation errors
+CSRCS_IGNORE += fileio.c
+
+DLLS = $(patsubst %.c,$(DLL_PREFIX)%$(DLL_SUFFIX).dll,$(notdir $(CSRCS)))
+
+CC = @CC@
+CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)/src
+CFLAGS = -pedantic
+LIBS = -L$(top_builddir)/.libs -lsqlite3 -lz
+
+.PHONY : all
+all : $(DLLS)
+
+$(DLL_PREFIX)%$(DLL_SUFFIX).dll: %.c
+ $(CC) -shared $(CPPFLAGS) $(CFLAGS) -o $@ $< $(LIBS)
+
+%.i: %.c
+ $(CC) -E $(CPPFLAGS) -o $@ $<
+
+.PHONY: clean install
+clean:
+ -rm -f $(DLLS) 2> /dev/nul
+
+install: $(DLLS) $(CSRCS)
+ mkdir -p $(DESTDIR)$(extdir)
+ cp -vp $^ $(DESTDIR)$(extdir)