aboutsummaryrefslogtreecommitdiff
path: root/db/makefile
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-06-28 23:59:50 +0200
committerlonkaars <loek@pipeframe.xyz>2023-06-28 23:59:50 +0200
commit67dbb6421976254658c5e38045513129dd18187a (patch)
tree288b599d1097b26bdbcad3b6749b38e133017cf2 /db/makefile
initial public commit
Diffstat (limited to 'db/makefile')
-rw-r--r--db/makefile45
1 files changed, 45 insertions, 0 deletions
diff --git a/db/makefile b/db/makefile
new file mode 100644
index 0000000..c1e527e
--- /dev/null
+++ b/db/makefile
@@ -0,0 +1,45 @@
+SQL = sqlite3
+DICT_DB = dict.db
+USER_DB = user.db
+
+DICT_TEMPLATE = dict/template.sql.m4
+
+.PHONY: clean test
+
+all: $(DICT_DB) $(USER_DB)
+
+$(DICT_DB): dict/full.sql
+ $(SQL) $@ < $<
+
+$(USER_DB): user/full.sql
+ $(SQL) $@ < $<
+
+dict/base.sql: dict/reset.sql dict/init.sql dict/deinflections.sql dict/tags.sql
+ cat $^ > $@
+
+dict/full.sql: dict/base.sql dict/dict.sql
+ cat $^ > $@
+
+dict/dict.sql: dict/test_a.sql dict/test_b.sql dict/test_pitch_accent.sql dict/jmdict.sql
+ cat $^ > $@
+
+user/base.sql: user/reset.sql user/init.sql
+ cat $^ > $@
+
+user/full.sql: user/base.sql user/root.sql
+ cat $^ > $@
+
+%.sql: %.dict.sql $(DICT_TEMPLATE)
+ m4 $(DICT_TEMPLATE) < $< > $@
+
+# delete generated sql files and database
+clean:
+ $(RM) $(DICT_DB) $(USER_DB) dict/base.sql dict/full.sql dict/dict.sql dict/test_a.sql dict/test_b.sql dict/test_pitch_accent.sql user/base.sql user/full.sql
+
+test: $(DICT_DB) find.sql
+ ./test/find '浮上しました'
+ ./test/find 'ならない'
+ ./test/find '浮上した'
+ ./test/find 'なって'
+ ./test/find 'の下にて'
+