########################################################################
# Looks for sqlite3.[ch] in $PWD. If found, it sets up some bits
# to build them and tell downstream make code about it so that it can
# link to the lib or the .o, as appropriate.
SQLITE3.H := $(wildcard src/sqlite3.h)
SQLITE3.C := $(wildcard src/sqlite3.c)
ifneq (,$(SQLITE3.C))
SQLITE3.O := sqlite3.o
SQLITE3_LDFLAGS :=
# These are the flags used by fossil's embedded sqlite3:
SQLITE3_CPPFLAGS := -DSQLITE_OMIT_LOAD_EXTENSION=1 \
	-DSQLITE_THREADSAFE=0 \
	-DSQLITE_DEFAULT_FILE_FORMAT=4 \
	-DSQLITE_ENABLE_STAT3 \
	-DSQLITE_ENABLE_LOCKING_STYLE=0 
# TODO? -Dlocaltime=fossil_localtime. See definition in v1's timeline.c.
$(SQLITE3.O): $(SQLITE3.C) $(SQLITE3.H)
	@$(call ShakeNMake.CALL.SETX,"CC [$@] ..."); \
	$(COMPILE.c) $(COMPILE.c.OPTIONS) $(SQLITE3_CPPFLAGS) $(OUTPUT_OPTION) $<
else
SQLITE3_LDFLAGS := -lsqlite3
endif
