Skip to content

Commit 257153a

Browse files
committed
chore: add doc build \w in makefile
1 parent f1760a8 commit 257153a

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Define variables
2+
DOCS_DIR := $(shell pwd)
3+
TARGET_DIR := $(DOCS_DIR)/docs
4+
KATEX_HEADER := $(DOCS_DIR)/docs/katex.html
5+
6+
# Ensure the target directory exists
7+
$(TARGET_DIR):
8+
mkdir -p $(TARGET_DIR)
9+
10+
# Make sure the KaTeX header exists before trying to use it
11+
$(KATEX_HEADER):
12+
@echo "Error: KaTeX header file not found at $(KATEX_HEADER)"
13+
@exit 1
14+
15+
# Base documentation command
16+
define docs_command
17+
cd $(DOCS_DIR) && \
18+
RUSTDOCFLAGS="--html-in-header=$(KATEX_HEADER)" cargo doc --no-deps --target-dir=$(TARGET_DIR) $(1)
19+
endef
20+
21+
# Generate documentation for bintensors with a custom header
22+
docs: $(TARGET_DIR) $(KATEX_HEADER)
23+
$(call docs_command)
24+
25+
# Generate and open documentation
26+
docs-open: $(TARGET_DIR) $(KATEX_HEADER)
27+
$(call docs_command,--open)
28+
29+
.PHONY: docs docs-open

0 commit comments

Comments
 (0)