aboutsummaryrefslogtreecommitdiff
path: root/db/makefile
diff options
context:
space:
mode:
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 'の下にて'
+