Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c1af59e

Browse files
committed
refactor(make): handle mkdir in more compact way
1 parent 09f87af commit c1af59e

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

Makefile

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Here is what you can do:
44
#
55
# - make all # Automatically build an html local version
6-
# - make build # To build a single .po file
6+
# - make build <po-file> # To build a single .po file
77
# - make todo # To list remaining tasks
88
# - make merge # To merge pot from upstream
99
# - make fuzzy # To find fuzzy strings
@@ -37,7 +37,7 @@ print('\n'.join(output))
3737
endef
3838
export PRINT_HELP_PYSCRIPT # End of python section
3939

40-
CPYTHON_CLONE := ../cpython/
40+
CPYTHON_CLONE := ../cpython
4141
SPHINX_CONF := $(CPYTHON_CLONE)/Doc/conf.py
4242
LANGUAGE := zh_TW
4343
LC_MESSAGES := $(CPYTHON_CLONE)/Doc/locales/$(LANGUAGE)/LC_MESSAGES
@@ -55,7 +55,7 @@ all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build an
5555
. $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D locale_dirs=locales -D language=$(LANGUAGE) -D gettext_compact=0' $(MODE)
5656

5757
.PHONY: build
58-
build: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build an html local version
58+
build: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build an html local version for a single file
5959
@$(eval target=$(filter-out $@,$(MAKECMDGOALS)))
6060
@if [ -z $(target) ]; then \
6161
echo "\x1B[1;31m""Please provide a file argument.""\x1B[m"; \
@@ -69,19 +69,14 @@ build: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build a
6969
echo "\x1B[1;31m""ERROR: $(target) not exist.""\x1B[m"; \
7070
exit 1; \
7171
fi
72-
@mkdir -p $(LC_MESSAGES)
72+
7373
@$(eval dir=`echo $(target) | xargs -n1 dirname`) ## Get dir
74-
# If the build target is in under directory
75-
# We should make direcotry in $(LC_MESSAGES).
76-
@if [ $(dir) != "." ]; then \
77-
echo "mkdir -p $(LC_MESSAGES)/$(dir)"; \
78-
mkdir -p $(LC_MESSAGES)/$(dir); \
79-
fi
74+
@mkdir -p $(LC_MESSAGES)/$(dir)
8075
@ln -f ./$(target) $(LC_MESSAGES)/$(target)
81-
# Build
82-
@echo "----"
76+
8377
@. $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D language=$(LANGUAGE) -D locale_dirs=locales -D gettext_compact=0' SOURCES='$(basename $(target)).rst' html
8478

79+
8580
help:
8681
@python3 -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
8782

0 commit comments

Comments
 (0)