Skip to content

Commit b5b35e5

Browse files
committed
Upgrade Makefile, it can build single html now
We still need to make all once, and then we can build single html.
1 parent 9d1175c commit b5b35e5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Makefile

+20
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,26 @@ all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build an
5353
for file in *.po */*.po; do ln -f $$file $(LC_MESSAGES)/$$file; done
5454
. $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D locale_dirs=locales -D language=$(LANGUAGE) -D gettext_compact=0' $(MODE)
5555

56+
.PHONY: build
57+
build/%: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build an html local version
58+
@if [ ! -f "$*.po" ] ; then \
59+
echo "\x1B[1;31m""ERROR: $*.po not exist""\x1B[m"; exit 1; \
60+
exit 1; \
61+
fi
62+
@mkdir -p $(LC_MESSAGES)
63+
@$(eval dir=`echo $* | xargs -n1 dirname`) ## Get dir
64+
# If the build target is in under directory
65+
# We should make direcotry in $(LC_MESSAGES) and link the file.
66+
@if [ $(dir) != "." ]; then \
67+
echo "mkdir -p $(LC_MESSAGES)/$(dir)"; \
68+
mkdir -p $(LC_MESSAGES)/$(dir); \
69+
echo "ln -f ./$*.po $(LC_MESSAGES)/$*.po"; \
70+
ln -f ./$*.po $(LC_MESSAGES)/$*.po; \
71+
fi
72+
# Build
73+
@echo "----"
74+
@. $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D language=$(LANGUAGE) -D locale_dirs=locales -D gettext_compact=0 -T' SOURCES='$*.rst' html
75+
5676
help:
5777
@python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
5878

0 commit comments

Comments
 (0)