core-lightning/wallet/Makefile
Christian Decker e4ab98459c wallet: Add tooling to extract SQL queries and generate driver info
This is the counterpart of the annotations we did in the last few commits. It
extracts queries, passes them through a driver-specific query rewriter and
dumps them into a driver-specific query-list, along with some metadata to
facilitate processing later on. The generated query list is then registered as
a `db_config` and will be loaded by the driver upon instantiation.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-09-05 23:41:05 +00:00

54 lines
1.5 KiB
Makefile

#! /usr/bin/make
# Designed to be run one level up
wallet-wrongdir:
$(MAKE) -C .. lightningd-all
WALLET_LIB_SRC := \
wallet/db.c \
wallet/invoices.c \
wallet/txfilter.c \
wallet/wallet.c \
wallet/walletrpc.c
WALLET_DB_DRIVERS := \
wallet/db_sqlite3.c
WALLET_LIB_OBJS := $(WALLET_LIB_SRC:.c=.o) $(WALLET_DB_DRIVERS:.c=.o)
WALLET_LIB_HEADERS := $(WALLET_LIB_SRC:.c=.h)
# Make sure these depend on everything.
ALL_OBJS += $(WALLET_LIB_OBJS)
$(WALLET_LIB_OBJS): $(LIGHTNINGD_HEADERS_NOGEN) $(WALLET_LIB_HEADERS)
check-whitespace: $(WALLET_LIB_SRC:%=check-whitespace/%) $(WALLET_LIB_HEADERS:%=check-whitespace/%)
check-source: $(WALLET_LIB_SRC:%=check-src-include-order/%)
check-source: $(WALLET_LIB_HEADERS:%=check-hdr-include-order/%)
check-source-bolt: $(WALLET_LIB_SRC:%=bolt-check/%) $(WALLET_LIB_HEADERS:%=bolt-check/%)
clean: wallet-clean
wallet/db_sqlite3.c: wallet/gen_db_sqlite3.c
# The following files contain SQL-annotated statements that we need to extact
SQL_FILES := \
wallet/db.c \
wallet/invoices.c \
wallet/wallet.c \
wallet/test/run-db.c \
wallet/test/run-wallet.c \
wallet/statements.po: $(SQL_FILES)
xgettext -kNAMED_SQL -kSQL --add-location --no-wrap --omit-header -o $@ $(SQL_FILES)
wallet/gen_db_sqlite3.c: wallet/statements.po devtools/sql-rewrite.py
devtools/sql-rewrite.py wallet/statements.po sqlite3 > wallet/gen_db_sqlite3.c
wallet-clean:
$(RM) $(WALLET_LIB_OBJS)
$(RM) wallet/statements.po
$(RM) wallet/gen_db_sqlite3.c
include wallet/test/Makefile