File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments