@@ -12,8 +12,11 @@ BUILDDIR = _build
1212PROJECT_CONFIGS = \
1313 _repos/verl/docs/ascend_tutorial:sources/verl \
1414 _repos/VeOmni/docs:sources/VeOmni \
15- _repos/LLaMA-Factory/docs:sources/LLaMA-Factory \
16- _repos/ms-swift/docs:sources/ms-swift
15+ _repos/LLaMA-Factory/docs:sources/LLaMA-Factory \
16+ _repos/ms-swift/docs:sources/ms-swift
17+
18+ # Configure all subprojects generated path
19+ GENERATED_DOCS := sources/_generated
1720
1821# Put it first so that "make" without argument is like "make help".
1922help :
@@ -25,19 +28,31 @@ help:
2528# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
2629% : Makefile
2730 @echo " Initializing submodules..."
28- @git submodule update --init
29-
31+ @git submodule update --init --remote
32+
33+ @echo "Preparing generated docs directory..."
34+ @mkdir -p $(GENERATED_DOCS)
35+
3036 @echo "Copying project documentation..."
3137 @for config in $(PROJECT_CONFIGS); do \
3238 src=$$(echo $$config | cut -d: -f1); \
33- dst=$$(echo $$config | cut -d: -f2 ) ; \
34- # Removing existing index files to avoid conflicts \
39+ rel_dst=$$(echo $$config | cut -d: -f2); \
40+ dst="$(GENERATED_DOCS)/$$rel_dst"; \
41+ echo "Copying $$src -> $$dst"; \
42+ \
43+ # Clean destination to avoid stale files \
44+ rm -rf $$dst; \
45+ mkdir -p $$dst; \
46+ \
47+ # Remove index files from source to avoid conflicts \
3548 find $$src -name 'index.*' -delete 2>/dev/null || true; \
49+ \
3650 echo "Copying $$src to $$dst"; \
37- cp -r $$ src/* $$ dst/ 2> /dev/null || echo " Source directory does not exist or is empty: $$ src" ; \
51+ cp -r "$$src"/* "$$dst"/ 2>/dev/null || \
52+ echo " [WARN] Source directory does not exist or is empty: $$src"; \
3853 done
39-
54+
4055 @echo "Cleaning up submodules..."
4156 @git submodule deinit -f _repos/*
42-
43- @$(SPHINXBUILD ) -M $@ " $( SOURCEDIR) " " $( BUILDDIR) " $(SPHINXOPTS ) $(O )
57+
58+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
0 commit comments