Browse Source

Makefile: protect .po file and gen_db files with SHA256STAMP.

And rename them so they're not cleared by `make clean`.  We leave the
old rules in place so old files get cleaned still.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
bump-pyln-proto
Rusty Russell 4 years ago
committed by neil saitug
parent
commit
e9a435ce82
  1. 18
      wallet/Makefile
  2. 2
      wallet/db_postgres.c
  3. 2
      wallet/db_sqlite3.c

18
wallet/Makefile

@ -25,12 +25,12 @@ WALLET_OBJS := $(WALLET_SRC:.c=.o)
$(WALLET_OBJS): $(WALLET_HDRS) $(LIGHTNINGD_HEADERS)
# Make sure these depend on everything.
ALL_C_SOURCES += $(WALLET_SRC)
ALL_C_SOURCES += $(WALLET_SRC) wallet/db_sqlite3_sqlgen.c wallet/db_postgres_sqlgen.c
ALL_C_HEADERS += $(WALLET_HDRS)
# Each database driver depends on its rewritten statements.
wallet/db_sqlite3.o: wallet/gen_db_sqlite3.c
wallet/db_postgres.o: wallet/gen_db_postgres.c
wallet/db_sqlite3.o: wallet/db_sqlite3_sqlgen.c
wallet/db_postgres.o: wallet/db_postgres_sqlgen.c
# The following files contain SQL-annotated statements that we need to extact
SQL_FILES := \
@ -40,11 +40,11 @@ SQL_FILES := \
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/statements_gettextgen.po: $(SQL_FILES) FORCE
@if $(call SHA256STAMP_CHANGED,); then $(call VERBOSE,"xgettext $@",xgettext -kNAMED_SQL -kSQL --add-location --no-wrap --omit-header -o $@ $(SQL_FILES) && $(call SHA256STAMP,,# )); fi
wallet/gen_db_%.c: wallet/statements.po devtools/sql-rewrite.py
devtools/sql-rewrite.py wallet/statements.po $* > wallet/gen_db_$*.c
wallet/db_%_sqlgen.c: wallet/statements_gettextgen.po devtools/sql-rewrite.py FORCE
@if $(call SHA256STAMP_CHANGED,); then $(call VERBOSE,"sql-rewrite $@",devtools/sql-rewrite.py wallet/statements.po $* > $@ && $(call SHA256STAMP,,//)); fi
clean: wallet_clean
wallet-clean:
@ -52,4 +52,8 @@ wallet-clean:
$(RM) wallet/gen_db_sqlite3.c
$(RM) wallet/gen_db_postgres.c
maintainer-clean: wallet_maintainer-clean
wallet-maintainer-clean:
$(RM) wallet/statements_gettextgen.po
include wallet/test/Makefile

2
wallet/db_postgres.c

@ -1,5 +1,5 @@
#include <wallet/db_common.h>
#include "gen_db_postgres.c"
#include "db_postgres_sqlgen.c"
#include <ccan/ccan/tal/str/str.h>
#include <ccan/endian/endian.h>
#include <lightningd/log.h>

2
wallet/db_sqlite3.c

@ -1,5 +1,5 @@
#include <wallet/db_common.h>
#include "gen_db_sqlite3.c"
#include "db_sqlite3_sqlgen.c"
#include <ccan/ccan/tal/str/str.h>
#include <lightningd/log.h>
#include <stdio.h>

Loading…
Cancel
Save