-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakefile
More file actions
30 lines (24 loc) · 807 Bytes
/
makefile
File metadata and controls
30 lines (24 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Define variables
ROOT_DIR := $(shell pwd)
DOCS_DIR := $(ROOT_DIR)/bintensors
TARGET_DIR := $(DOCS_DIR)/docs
KATEX_HEADER := $(DOCS_DIR)/docs/katex.html
# Ensure the target directory exists
$(TARGET_DIR):
mkdir -p $(TARGET_DIR)
# Make sure the KaTeX header exists before trying to use it
$(KATEX_HEADER):
@echo "Error: KaTeX header file not found at $(KATEX_HEADER)"
@exit 1
# Base documentation command
define docs_command
cd $(DOCS_DIR) && \
RUSTDOCFLAGS="--html-in-header=$(KATEX_HEADER)" cargo doc --no-deps --target-dir=$(TARGET_DIR) $(1)
endef
# Generate documentation for bintensors with a custom header
docs: $(TARGET_DIR) $(KATEX_HEADER)
$(call docs_command)
# Generate and open documentation
docs-open: $(TARGET_DIR) $(KATEX_HEADER)
$(call docs_command,--open)
.PHONY: docs docs-open