Skip to content

Commit c51f72f

Browse files
committed
Improve docs migration robustness and add fallback
1 parent 58ad2d4 commit c51f72f

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

wolfHSM/Makefile

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
-include ../common/common.am
22

3-
# Override SRC AFTER including common.am so it points to cloned repo
3+
# Override SRC to point to cloned wolfHSM repo's docs directory.
4+
# Use new location (wolfhsm/docs/src) if it exists, otherwise fallback to local
5+
# src/ for backwards compatibility during transition period.
46
ifeq ($(DOC_LANG),JA)
5-
SRC = wolfhsm/docs/src-ja
7+
SRC_NEW = wolfhsm/docs/src-ja
8+
SRC_OLD = src-ja
69
else
7-
SRC = wolfhsm/docs/src
10+
SRC_NEW = wolfhsm/docs/src
11+
SRC_OLD = src
812
endif
13+
SRC = $(shell if [ -d "$(SRC_NEW)" ]; then echo "$(SRC_NEW)"; else echo "$(SRC_OLD)"; fi)
14+
915
.DEFAULT_GOAL := all
1016

1117
all: pdf html
@@ -36,7 +42,11 @@ wolfhsm:
3642

3743
.PHONY: wolfhsm-update
3844
wolfhsm-update: wolfhsm
39-
-$(Q)cd wolfhsm && git pull --ff-only
45+
$(Q)if [ -L wolfhsm ]; then \
46+
echo "Skipping git pull for symlink (local testing)"; \
47+
else \
48+
cd wolfhsm && git pull --ff-only; \
49+
fi
4050

4151
.PHONY: api
4252
api: wolfhsm-update
@@ -45,6 +55,11 @@ api: wolfhsm-update
4555
$(Q)cd ..
4656
$(Q)doxybook2 --input docs/xml --output api/md --config doxybook.cfg
4757

58+
# NOTE: html-setup and pdf-setup are overridden from common/common.am to inject
59+
# the wolfhsm-update dependency. If common.am changes these targets, the changes
60+
# will need to be manually synchronized here. This duplication is intentional to
61+
# ensure the wolfHSM repo is cloned before attempting to copy docs from it.
62+
4863
# Override html-setup to ensure wolfhsm repo is cloned first
4964
.PHONY: html-setup
5065
html-setup: wolfhsm-update
@@ -72,7 +87,6 @@ pdf-setup: wolfhsm-update builddir
7287
# 3. Fix the titles of the header files markdown
7388
.PHONY: html-prep
7489
html-prep: api
75-
$(Q)cp $(SRC)/*.png build/html/
7690
$(Q)cp -a api/md/*8h* build/html/
7791

7892
$(Q)perl -i -pe "s/\/group_/group_/g" build/html/group* build/html/*8h*
@@ -88,7 +102,6 @@ html-prep: api
88102
# 6. Two regexes to handle bad Doxygen that didn't convert and the LaTeX processor thinks is LaTeX commands
89103
.PHONY: pdf-prep
90104
pdf-prep: api
91-
$(Q)cp $(SRC)/*.png build/pdf/
92105
$(Q)cp -a api/md/*8h* build/pdf/
93106

94107
$(Q)perl -i -pe "s/# /## /g" build/pdf/*.md

0 commit comments

Comments
 (0)