11-include ../common/common.am
2+
3+ ifeq ($(DOC_LANG ) ,JA)
4+ SRC = wolfhsm/docs/src-ja
5+ else
6+ SRC = wolfhsm/docs/src
7+ endif
8+
29.DEFAULT_GOAL := all
310
411all : pdf html
@@ -29,7 +36,11 @@ wolfhsm:
2936
3037.PHONY : wolfhsm-update
3138wolfhsm-update : wolfhsm
32- $(Q ) cd wolfhsm && git pull --ff-only
39+ $(Q ) if [ -L wolfhsm ]; then \
40+ echo " Skipping git pull for symlink (local testing)" ; \
41+ else \
42+ cd wolfhsm && git pull --ff-only; \
43+ fi
3344
3445.PHONY : api
3546api : wolfhsm-update
@@ -38,14 +49,38 @@ api: wolfhsm-update
3849 $(Q ) cd ..
3950 $(Q ) doxybook2 --input docs/xml --output api/md --config doxybook.cfg
4051
52+ # NOTE: html-setup and pdf-setup are overridden from common/common.am to inject
53+ # the wolfhsm-update dependency. If common.am changes these targets, the changes
54+ # will need to be manually synchronized here. This duplication is intentional to
55+ # ensure the wolfHSM repo is cloned before attempting to copy docs from it.
56+
57+ # Override html-setup to ensure wolfhsm repo is cloned first
58+ .PHONY : html-setup
59+ html-setup : wolfhsm-update
60+ $(Q ) git submodule update --init
61+ -cd ../mkdocs-material; patch -p1 < $(PATCH ) --ignore-whitespace -N
62+ $(Q ) cp -a $(SRC ) /* build/html/
63+ $(Q ) cp ../common/* .png build/html/
64+ $(Q ) cp ../common/* .css build/html/
65+ $(Q ) perl -i -pe ' s/ ```/```/g' build/html/* .md
66+ $(Q ) perl -i -pe " s/\#--/\#-/g" build/html/* .md
67+ $(Q ) mv build/html/$(word 1,$(SOURCES ) ) build/html/index.md
68+
69+ # Override pdf-setup to ensure wolfhsm repo is cloned first
70+ .PHONY : pdf-setup
71+ pdf-setup : wolfhsm-update builddir
72+ $(Q ) cp -a $(SRC ) /* build/pdf/
73+ $(Q ) cp ../common/* .png build/pdf/
74+ $(Q ) perl -i -pe " s/chapter[0-9][0-9].md|appendix[0-9][0-9].md//g" build/pdf/* .md
75+ $(Q ) perl -i -pe " s/\#--/\#/g" build/pdf/* .md
76+
4177# Need an index.md, so let's make it chapter01.
4278# Perl regex to fix two things:
4379# 1. Doxybook2 replaces underscores with dashes in anchor tags (which breaks them)
4480# 2. Remove leading slash on links so that mkdocs can parse them
4581# 3. Fix the titles of the header files markdown
4682.PHONY : html-prep
4783html-prep : api
48- $(Q ) cp src/* .png build/html/
4984 $(Q ) cp -a api/md/* 8h* build/html/
5085
5186 $(Q)perl -i -pe "s/\/group_/group_/g" build/html/group* build/html/*8h*
@@ -61,7 +96,6 @@ html-prep: api
6196# 6. Two regexes to handle bad Doxygen that didn't convert and the LaTeX processor thinks is LaTeX commands
6297.PHONY : pdf-prep
6398pdf-prep : api
64- $(Q ) cp src/* .png build/pdf/
6599 $(Q ) cp -a api/md/* 8h* build/pdf/
66100
67101 $(Q)perl -i -pe "s/# /## /g" build/pdf/*.md
0 commit comments