1 # The default target of this Makefile is...
7 # make V=1 # V=1 increases verbosity
8 # make test [flags=...] # run tests; flags=-x fails fast, --ff failed first
9 # make test V=2 # run tests; V=2 increases test verbosity
10 # make doc # build docs
11 # make pylint [color=1] # run pylint; color=1 colorizes output
12 # make fmt # run the code formatter
13 # make check [color=1] # run test, doc and pylint
14 # make check file=<filename> # run checks on <filename>
18 # make pot # update main translation template
19 # make po # merge translations
20 # make i18n # make pot + make po
24 # make prefix=<path> install
25 # DESTDIR is also supported.
27 # The external commands used by this Makefile are...
38 PYLINT
= $(PYTHON
) -B
-m pylint
39 PYTEST
= $(PYTHON
) -B
-m pytest
53 TEST_VERBOSE
= --verbose
62 PYTEST_FLAGS
= $(QUIET
) $(TEST_VERBOSE
)
63 uname_S
:= $(shell uname
-s
)
64 ifneq ($(uname_S
),Linux
)
65 PYTEST_FLAGS
+= --ignore
=cola
/inotify.py
68 PYLINT_SCORE_FLAG
:= $(shell $(PYLINT
) --score
=no
--help
>/dev
/null
2>&1 && echo
" --score=no" || true
)
69 PYLINT_FLAGS
= --rcfile
=.pylintrc
71 PYLINT_FLAGS
+= --output-format
=colorized
73 ifneq ($(PYLINT_SCORE_FLAGSCORE
),)
74 PYLINT_FLAGS
+= $(PYLINT_SCORE_FLAG
)
77 TOX_FLAGS
= $(VERBOSE_SHORT
)
79 # These values can be overridden on the command-line or via config.mak
81 python_version
:= $(shell $(PYTHON
) -c
'import sys; print("%s.%s" % sys.version_info[:2])')
82 python_lib
= python
$(python_version
)/site-packages
83 pythondir
= $(prefix)/lib
/$(python_lib
)
87 cola_app_base
= $(cola_base
).app
88 cola_app
= $(CURDIR
)/$(cola_app_base
)
89 cola_app_resources
= $(cola_app
)/Contents
/Resources
91 # Read $(VERSION) from cola/_version.py and strip quotes.
92 include cola
/_version.py
93 cola_version
:= $(subst ',,$(VERSION))
94 cola_dist := $(cola_base)-$(cola_version)
98 install_args += --root="$(DESTDIR)"
101 install_args += --prefix="$(prefix)"
102 install_args += --disable-pip-version-check
108 ALL_PYTHON_DIRS = $(PYTHON_DIRS)
110 # User customizations
117 $(PIP) $(QUIET) $(VERBOSE) install $(install_args) .
133 $(MAKE) -C docs install
137 $(MAKE) -C docs install-html
141 $(MAKE) -C docs install-man
145 $(RM) "$(DESTDIR)$(prefix)"/bin/cola
146 $(RM) "$(DESTDIR)$(prefix)"/bin/git-cola
147 $(RM) "$(DESTDIR)$(prefix)"/bin/git-cola-sequence-editor
148 $(RM) "$(DESTDIR)$(prefix)"/bin/git-dag
149 $(RM) "$(DESTDIR)$(prefix)"/share/applications/git-cola.desktop
150 $(RM) "$(DESTDIR)$(prefix)"/share/applications/git-cola-folder-handler.desktop
151 $(RM) "$(DESTDIR)$(prefix)"/share/applications/git-dag.desktop
152 $(RM) "$(DESTDIR)$(prefix)"/share/metainfo/git-dag.appdata.xml
153 $(RM) "$(DESTDIR)$(prefix)"/share/metainfo/git-cola.appdata.xml
154 $(RM) "$(DESTDIR)$(prefix)"/share/icons/hicolor/scalable/apps/git-cola.svg
155 $(RM_R) "$(DESTDIR)$(prefix)"/share/doc/git-cola
156 $(RM_R) "$(DESTDIR)$(pythondir)"/git_cola-*
157 $(RM_R) "$(DESTDIR)$(pythondir)"/cola
158 $(RMDIR) -p "$(DESTDIR)$(pythondir)" 2>/dev/null || true
159 $(RMDIR) "$(DESTDIR)$(prefix)"/share/applications 2>/dev/null || true
160 $(RMDIR) "$(DESTDIR)$(prefix)"/share/metainfo 2>/dev/null || true
161 $(RMDIR) "$(DESTDIR)$(prefix)"/share/doc 2>/dev/null || true
162 $(RMDIR) "$(DESTDIR)$(prefix)"/share/icons/hicolor/scalable/apps 2>/dev/null || true
163 $(RMDIR) "$(DESTDIR)$(prefix)"/share/icons/hicolor/scalable 2>/dev/null || true
164 $(RMDIR) "$(DESTDIR)$(prefix)"/share/icons/hicolor 2>/dev/null || true
165 $(RMDIR) "$(DESTDIR)$(prefix)"/share/icons 2>/dev/null || true
166 $(RMDIR) "$(DESTDIR)$(prefix)"/share 2>/dev/null || true
167 $(RMDIR) "$(DESTDIR)$(prefix)"/bin 2>/dev/null || true
168 $(RMDIR) "$(DESTDIR)$(prefix)" 2>/dev/null || true
172 $(PYTEST) $(PYTEST_FLAGS) $(flags) $(PYTHON_DIRS)
176 $(PYTEST) $(PYTEST_FLAGS) --cov=cola $(flags) $(PYTHON_DIRS)
180 $(FIND) $(ALL_PYTHON_DIRS) -name '*.py
[cod
]' -print0 | $(XARGS) -0 $(RM)
181 $(FIND) $(ALL_PYTHON_DIRS) -name __pycache__ -print0 | $(XARGS) -0 $(RM_R)
182 $(RM_R) build dist git-cola.app
183 $(MAKE) -C docs clean
190 # Regenerate git-cola.pot with new translations
199 --output-dir cola/i18n \
200 --output git-cola.pot \
204 # Update .po files with new translations from git-cola.pot
207 for po in cola/i18n/*.po; \
211 --no-fuzzy-matching \
213 --output-file $$po.new \
215 cola/i18n/git-cola.pot \
221 # Build a git-cola.app bundle.
224 cola_full_version := $(shell ./bin/git-cola version --brief)
227 $(MKDIR_P) $(cola_app)/Contents/MacOS
228 $(MKDIR_P) $(cola_app_resources)
229 $(PYTHON) -m venv $(cola_app_resources)
230 $(cola_app_resources)/bin/pip install '.
[docs
,extras
,pyqt6
]'
231 $(CP) contrib/darwin/Info.plist contrib/darwin/PkgInfo $(cola_app)/Contents
232 ifneq ($(cola_full_version),)
233 sed -i -e s/0.0.0.0/$(cola_full_version)/ $(cola_app)/Contents/Info.plist
235 sed -i -e s/0.0.0/$(cola_version)/ $(cola_app)/Contents/Info.plist
236 $(CP) contrib/darwin/git-cola $(cola_app)/Contents/MacOS
237 $(CP) contrib/darwin/git-cola.icns $(cola_app)/Contents/Resources
238 $(MAKE) PIP=$(cola_app_resources)/bin/pip \
239 prefix=$(cola_app_resources) install
240 $(MAKE) SPHINXBUILD=$(cola_app_resources)/bin/sphinx-build \
241 prefix=$(cola_app_resources) install-doc
244 app-tarball:: git-cola.app
245 $(TAR) czf $(cola_dist).app.tar.gz $(cola_app_base)
247 # Preview the markdown using "make README.html"
254 $(PYLINT) $(PYLINT_FLAGS) $(flags) \
261 $(PYLINT) $(PYLINT_FLAGS) --output-format=colorized $(flags) $(file)
271 $(GIT) ls-files -- '*.py
' | \
275 .PHONY: requirements-dev
277 $(PIP) install --editable '.
[build
,dev
]'
279 .PHONY: requirements-extras
280 requirements-extras::
281 $(PIP) install --editable '.
[extras
]'
285 $(TOX) run $(TOX_FLAGS) $(flags)
289 $(TOX) run -e check $(TOX_FLAGS) $(flags)