@@ -54,24 +54,33 @@ all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build an
54
54
. $(VENV ) /bin/activate; $(MAKE ) -C $(CPYTHON_CLONE ) /Doc/ SPHINXOPTS=' -j$(JOBS) -D locale_dirs=locales -D language=$(LANGUAGE) -D gettext_compact=0' $(MODE )
55
55
56
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" ; \
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" ; \
60
69
exit 1; \
61
70
fi
62
71
@mkdir -p $(LC_MESSAGES )
63
- @$(eval dir=`echo $* | xargs -n1 dirname`) # # Get dir
72
+ @$(eval dir=`echo $( target ) | xargs -n1 dirname`) # # Get dir
64
73
# If the build target is in under directory
65
74
# We should make direcotry in $(LC_MESSAGES) and link the file.
66
75
@if [ $(dir) != "." ]; then \
67
76
echo "mkdir -p $(LC_MESSAGES)/$(dir)"; \
68
77
mkdir -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) ; \
71
80
fi
72
81
# Build
73
82
@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
75
84
76
85
help :
77
86
@python3 -c " $$ PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST )
@@ -150,3 +159,7 @@ fuzzy: ## Find fuzzy strings
150
159
.PHONY : rm_cpython
151
160
rm_cpython : # # Remove cloned cpython repo
152
161
rm -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
+ @:
0 commit comments