@@ -54,24 +54,33 @@ all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build an
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
5656.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" ; \
57+ build :$(VENV ) /bin/sphinx-build$(VENV ) /bin/blurb clone# # Automatically build an html local version
58+ @$(eval target=$(filter-out $@ ,$(MAKECMDGOALS ) ) )
59+ @if [-z $( target) ]; then \
60+ echo " \x1B[1;31m" " Please provide a file argument." " \x1B[m" ; \
61+ exit 1; \
62+ fi
63+ @if [" $( suffix$( target) ) " != " .po" ]; then \
64+ echo " \x1B[1;31m" " Incorrect file extension. Only '.po' files are allowed." " \x1B[m" ; \
65+ exit 1; \
66+ fi
67+ @if [[! -f " $( target) " ]]; then \
68+ echo " \x1B[1;31m" " ERROR:$( target) not exist." " \x1B[m" ; \
6069exit 1; \
6170fi
6271@mkdir -p$(LC_MESSAGES )
63- @$(eval dir=`echo$* | xargs -n1 dirname`) # # Get dir
72+ @$(eval dir=`echo$( target ) | xargs -n1 dirname`) # # Get dir
6473# If the build target is in under directory
6574# We should make direcotry in $(LC_MESSAGES) and link the file.
6675@if [ $(dir) != "." ]; then \
6776echo "mkdir -p $(LC_MESSAGES)/$(dir)"; \
6877mkdir -p $(LC_MESSAGES)/$(dir); \
69- echo "ln -f ./$*.po $(LC_MESSAGES)/$*.po "; \
70- ln -f ./$*.po $(LC_MESSAGES)/$*.po ; \
78+ echo "ln -f ./$(target) $(LC_MESSAGES)/$(target) "; \
79+ ln -f ./$(target) $(LC_MESSAGES)/$(target) ; \
7180fi
7281# Build
7382@echo "----"
74- @. $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D language=$(LANGUAGE) -D locale_dirs=locales -D gettext_compact=0' SOURCES='$* .rst' html
83+ @. $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D language=$(LANGUAGE) -D locale_dirs=locales -D gettext_compact=0' SOURCES='$(target) .rst' html
7584
7685help :
7786@python3 -c" $$ PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST )
@@ -150,3 +159,7 @@ fuzzy: ## Find fuzzy strings
150159.PHONY : rm_cpython
151160rm_cpython :# # Remove cloned cpython repo
152161rm -rf$(CPYTHON_CLONE )
162+
163+ # This allows us to accept extra arguments (by doing nothing when we get a job that doesn't match, rather than throwing an error)
164+ % :
165+ @: