-
-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade Makefile, it can build single html now #643
Conversation
We still need to make all once, and then we can build single html.
b5b35e5
to
2b1bdc6
Compare
Remove redundant 'exit 1'
如果是用參數帶入想要 build 的文件如何?像是 build: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build an html local version
if [ -z $(filter-out $@,$(MAKECMDGOALS)) ]; then \
echo "Please provide a file argument."; \
exit 1; \
fi
if [ ! -f "$(filter-out $@,$(MAKECMDGOALS))" ]; then \
echo "File '$(filter-out $@,$(MAKECMDGOALS))' does not exist."; \
exit 1; \
fi
if [ "$(suffix $(filter-out $@,$(MAKECMDGOALS)))" != ".po" ]; then \
echo "Incorrect file extension. Only '.po' files are allowed."; \
exit 1; \
fi
@mkdir -p $(LC_MESSAGES)
@$(eval dir=`echo $* | xargs -n1 dirname`) ## Get dir
# If the build target is in under directory
# We should make direcotry in $(LC_MESSAGES) and link the file.
@if [ $(dir) != "." ]; then \
echo "mkdir -p $(LC_MESSAGES)/$(dir)"; \
mkdir -p $(LC_MESSAGES)/$(dir); \
echo "ln -f ./$*.po $(LC_MESSAGES)/$*.po"; \
ln -f ./$*.po $(LC_MESSAGES)/$*.po; \
fi
# Build
@echo "----"
@. $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D language=$(LANGUAGE) -D locale_dirs=locales -D gettext_compact=0' SOURCES="$(basename $(filter-out $@,$(MAKECMDGOALS))).rst" html |
看起來好像不錯,我來改改看 |
- Get argument as build target. - Check extension. - Prevent throwing error when no rule to make target.
已經採用 @josix 的方法並 push。 A: 目前是 A 方案 |
@mattwang44 你的意思是想要不管輸入 A 或 B 都可以嗎? 那我這樣子做你覺得如何 (重點是第 2 點):
|
我覺得可以,但想請你也一併考慮未來開發彈性:
|
@@ -53,6 +53,35 @@ all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build an | |||
for file in *.po */*.po; do ln -f $$file $(LC_MESSAGES)/$$file; done | |||
. $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D locale_dirs=locales -D language=$(LANGUAGE) -D gettext_compact=0' $(MODE) | |||
|
|||
.PHONY: build | |||
build: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build an html local version | |||
@$(eval target=$(filter-out $@,$(MAKECMDGOALS))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somebody say this might be harmful since the variable is global, maybe I should use some special prefix on the variable name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, how about naming this with underscore prefix
更新
Makefile
讓他可以只轉換單一 html 檔。指令為:
VERSION=3.12 make build/<path-to-file>
例如:
VERSION=3.12 make build/library/internet
,就是要 buildlibrary/internet.po
的檔案目前的版本需要大家至少有 make all 一次,之後才能夠使用
make build/<path-to-file>
來轉換單一 html 檔。如果 clone 後沒有 make all 過,會失敗;這個問題暫時還找不到解法,附上遇到的錯誤訊息如下:
需要討論:
現在暫時的語法為
make build/<path-to-file>
,會看起來很像是要 makebuild/
路徑下的檔案需要大家集思廣益,語法應該要怎麼訂比較好,謝謝。