| # 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 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) |