File tree Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Expand file tree Collapse file tree 1 file changed +20
-13
lines changed Original file line number Diff line number Diff line change 1
1
# Define variables
2
- TARGET_DIR =docs
3
- KATEX_HEADER =../docs/katex.html
4
- DOCS_DIR =bintensors
2
+ ROOT_DIR := $(shell pwd)
3
+ TARGET_DIR := $(ROOT_DIR ) /../docs
4
+ KATEX_HEADER := $(ROOT_DIR ) /docs/katex.html
5
+ DOCS_DIR := $(ROOT_DIR ) /bintensors
5
6
6
7
# Ensure the target directory exists
7
8
$(TARGET_DIR ) :
8
9
mkdir -p $(TARGET_DIR )
9
10
10
- # Generate documentation for bintensors with a custom header
11
- docs : $( TARGET_DIR )
12
- cd $( DOCS_DIR ) && \
13
- RUSTDOCFLAGS= " --html-in-header= $( KATEX_HEADER ) " cargo doc --no-deps --target-dir= $( TARGET_DIR )
11
+ # Make sure the KaTeX header exists before trying to use it
12
+ $( KATEX_HEADER ) :
13
+ @echo " Error: KaTeX header file not found at $( KATEX_HEADER ) "
14
+ @exit 1
14
15
15
- docs-open : $(TARGET_DIR )
16
+ # Base documentation command
17
+ define docs_command
16
18
cd $(DOCS_DIR ) && \
17
- RUSTDOCFLAGS=" --html-in-header=$( KATEX_HEADER) " cargo doc --no-deps --target-dir=$(TARGET_DIR ) --open
19
+ RUSTDOCFLAGS="--html-in-header=$(KATEX_HEADER ) " cargo doc --no-deps --target-dir=$(TARGET_DIR ) $(1 )
20
+ endef
21
+
22
+ # Generate documentation for bintensors with a custom header
23
+ docs : $(TARGET_DIR ) $(KATEX_HEADER )
24
+ $(call docs_command)
18
25
19
- # Clean docs
20
- clean :
21
- rm -rf $( TARGET_DIR )
26
+ # Generate and open documentation
27
+ docs-open : $( TARGET_DIR ) $( KATEX_HEADER )
28
+ $( call docs_command,--open )
22
29
23
- .PHONY : docs clean
30
+ .PHONY : docs docs-open
You can’t perform that action at this time.
0 commit comments