Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ _build/*
.vscode
.DS_Store
sources/pytorch/api_doc.rst
sources/_generated
sources/_generated_static/ascend_config.json
sources/_generated/
.tasks/
venv/
_repos/
39 changes: 27 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,31 @@ PROJECT_CONFIGS = \
# Configure all subprojects generated path
GENERATED_DOCS := sources/_generated

# Ascend config file path
ASCEND_CONFIG := _static/ascend_config.json

# Fetch script
FETCH_SCRIPT := scripts/fetch_ascend_data.py

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile
.PHONY: help Makefile copy-docs clean-submodules fetch-config

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
# Fetch ascend config (always run to ensure freshness)
.PHONY: $(ASCEND_CONFIG)
fetch-config:
@echo "Fetching ascend configuration data..."
@python3 $(FETCH_SCRIPT)

# Initialize submodules if not exists (use pinned commits for reproducibility)
_repos/verl _repos/VeOmni _repos/LLaMA-Factory _repos/ms-swift:
@echo "Initializing submodules..."
@git submodule update --init --remote
@git submodule update --init

# Copy documentation from submodules
copy-docs: _repos/verl _repos/VeOmni _repos/LLaMA-Factory _repos/ms-swift
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase this part of the code so we can verify the documentation builds successfully during review.

Image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, should we also provide a jump link for "More Versions" so that users can access other CANN versions?

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

@echo "Preparing generated docs directory..."
@mkdir -p $(GENERATED_DOCS)

Expand All @@ -39,20 +52,22 @@ help:
rel_dst=$$(echo $$config | cut -d: -f2); \
dst="$(GENERATED_DOCS)/$$rel_dst"; \
echo "Copying $$src -> $$dst"; \
\
# Clean destination to avoid stale files \
rm -rf $$dst; \
mkdir -p $$dst; \
\
# Remove index files from source to avoid conflicts \
find $$src -name 'index.*' -delete 2>/dev/null || true; \
\
echo "Copying $$src to $$dst"; \
cp -r "$$src"/* "$$dst"/ 2>/dev/null || \
echo " [WARN] Source directory does not exist or is empty: $$src"; \
cp -r "$$src"/* "$$dst"/ 2>/dev/null || echo " [WARN] Source directory does not exist or is empty: $$src"; \
done

# Clean up submodules
clean-submodules:
@echo "Cleaning up submodules..."
@git submodule deinit -f _repos/*

# Explicit build targets with prerequisites
html dirhtml singlehtml latex pdf: fetch-config copy-docs
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

# Catch-all target for other Sphinx targets (clean, help, etc.)
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Loading
Loading