@@ -9,6 +9,8 @@ DATE ?= 2025-03-31
99# Path to the code repo.
1010VALKEY_ROOT ?= ../valkey
1111VALKEY_BLOOM_ROOT ?= ../valkey-bloom
12+ VALKEY_JSON_ROOT ?= ../valkey-json
13+
1214# Where to install man pages
1315INSTALL_MAN_DIR ?= /usr/local/share/man
1416
@@ -34,6 +36,10 @@ ifeq ("$(wildcard $(VALKEY_BLOOM_ROOT))","")
3436 $(info Valkey bloom variable pointed to nothing, skipping bloom filter commands)
3537endif
3638
39+ ifeq ("$(wildcard $(VALKEY_JSON_ROOT ) ) ","")
40+ $(error Please provide the VALKEY_JSON_ROOT variable pointing to the valkey-json source code)
41+ endif
42+
3743ifeq ("$(shell which pandoc) ","")
3844 $(error Please install pandoc)
3945endif
5864
5965documented_commands = $(wildcard commands/* .md)
6066commands_json_files = $(wildcard $(VALKEY_ROOT ) /src/commands/* .json)
67+
6168bloom_commands_json_files = $(wildcard $(VALKEY_BLOOM_ROOT ) /src/commands/* .json)
69+ valkey_json_commands_json_files = $(wildcard $(VALKEY_JSON_ROOT ) /src/commands/* .json)
6270existing_commands = $(commands_json_files:$(VALKEY_ROOT ) /src/commands/%.json=commands/%.md ) \
63- $(bloom_commands_json_files:$(VALKEY_BLOOM_ROOT ) /src/commands/%.json=commands/%.md )
71+ $(bloom_commands_json_files:$(VALKEY_BLOOM_ROOT ) /src/commands/%.json=commands/%.md ) \
72+ $(valkey_json_commands_json_files:$(VALKEY_JSON_ROOT ) /src/commands/%.json=commands/%.md )
6473
6574topics = $(wildcard topics/* )
6675commands = $(filter $(existing_commands ) ,$(documented_commands ) )
@@ -73,7 +82,8 @@ topics_pics = $(filter-out %.md,$(topics))
7382# JSON files for the commands that have a .md file (excluding undocumented commands).
7483json_for_documented_commands = \
7584 $(patsubst commands/% .md,$(VALKEY_ROOT ) /src/commands/% .json,$(filter $(commands_json_files:$(VALKEY_ROOT ) /src/commands/%.json=commands/%.md ) ,$(commands ) ) ) \
76- $(patsubst commands/% .md,$(VALKEY_BLOOM_ROOT ) /src/commands/% .json,$(filter $(bloom_commands_json_files:$(VALKEY_BLOOM_ROOT ) /src/commands/%.json=commands/%.md ) ,$(commands ) ) )
85+ $(patsubst commands/% .md,$(VALKEY_BLOOM_ROOT ) /src/commands/% .json,$(filter $(bloom_commands_json_files:$(VALKEY_BLOOM_ROOT ) /src/commands/%.json=commands/%.md ) ,$(commands ) ) ) \
86+ $(patsubst commands/% .md,$(VALKEY_JSON_ROOT ) /src/commands/% .json,$(filter $(valkey_json_commands_json_files:$(VALKEY_JSON_ROOT ) /src/commands/%.json=commands/%.md ) ,$(commands ) ) )
7787
7888$(BUILD_DIR ) /.commands-per-group.json : $(VALKEY_ROOT ) /src/commands/. utils/build-command-groups.py | $(BUILD_DIR )
7989 utils/build-command-groups.py $(json_for_documented_commands ) > $@ ~~
@@ -187,13 +197,14 @@ $(MAN_DIR)/man1/valkey-%.1.gz: topics/%.md $(man_scripts)
187197 --version $(VERSION ) --date $(DATE ) \$ < \
188198 | utils/links-to-man.py - | $(to_man ) > $@
189199$(MAN_DIR ) /man3/% .3valkey.gz : commands/% .md $(BUILD_DIR ) /.commands-per-group.json $(man_scripts )
200+ $(eval VALKEY_ROOTS := $(VALKEY_ROOT ) $(VALKEY_JSON_ROOT ) )
190201 $(eval FINAL_ROOT := $(firstword $(foreach root,$(VALKEY_ROOTS ) ,$(if $(wildcard $(root ) /src/commands/$* .json) ,$(root ) ) ) ) )
191- $(if $(FINAL_ROOT ) , \
202+ $(if $(FINAL_ROOT ) ,, $( eval FINAL_ROOT := $( lastword $( VALKEY_ROOTS ) ) ) )
192203 utils/preprocess-markdown.py --man --page-type command \
193204 --version $(VERSION ) --date $(DATE ) \
194205 --commands-per-group-json $(BUILD_DIR ) /.commands-per-group.json \
195206 --valkey-root $(FINAL_ROOT ) $< \
196- | utils/links-to-man.py - | $(to_man ) > $@ )
207+ | utils/links-to-man.py - | $(to_man ) > $@
197208$(MAN_DIR ) /man5/% .5.gz : topics/% .md $(man_scripts )
198209 utils/preprocess-markdown.py --man --page-type config \
199210 --version $(VERSION ) --date $(DATE ) $< \
0 commit comments