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>
This commit is contained in:
Rusty Russell
2020-08-31 10:51:16 +09:30
committed by neil saitug
parent bb250358ae
commit e9a435ce82
3 changed files with 13 additions and 9 deletions

View File

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

View File

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

View File

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