1 # The default target of this Makefile is...
6 # make V=1 # generate files; V=1 increases verbosity
7 # make test [flags=...] # run tests; flags=-x fails fast
8 # make test V=2 # V=2 increases test verbosity
9 # make doc # build docs
10 # make flake8 # python style checks
11 # make pylint [color=1] # run pylint; color=1 colorizes output
12 # make pylint3k [color=1] # run python2+3 compatibility checks
13 # make format # run the black python formatter
14 # make check [color=1] # run test, doc, flake8, pylint3k, and pylint
15 # make check file=<filename> # run checks on <filename>
19 # make pot # update main translation template
20 # make po # merge translations
21 # make mo # generate message files
22 # make i18n # all three of the above
26 # make prefix=<path> install
27 # DESTDIR is also supported.
29 # To disable distutil's replacement of "#!/usr/bin/env python" with
30 # the path to the build environment's python, pass USE_ENV_PYTHON=1
33 # The external commands used by this Makefile are...
49 PYTEST
= $(PYTHON
) -B
-m pytest
62 TEST_VERBOSE
= --verbose
71 FLAKE8_FLAGS
= $(VERBOSE
)
73 PYTEST_FLAGS
= $(QUIET
) $(TEST_VERBOSE
)
74 uname_S
:= $(shell uname
-s
)
75 ifneq ($(uname_S
),Linux
)
76 PYTEST_FLAGS
+= --ignore
=cola
/inotify.py
79 TOX_FLAGS
= $(VERBOSE_SHORT
) --develop
--skip-missing-interpreters
80 TOX_ENVS ?
= py
{27,36,37,38,39},pylint
{2,36,37}
82 PYLINT_FLAGS
= --rcfile
=.pylintrc
83 PYLINT_FLAGS
+= --score
=no
85 PYLINT_FLAGS
+= --output-format
=colorized
89 # These values can be overridden on the command-line or via config.mak
91 bindir = $(prefix)/bin
92 datadir = $(prefix)/share
/git-cola
93 python_lib
:= $(shell $(PYTHON
) -c \
94 'import distutils.sysconfig as sc; print(sc.get_python_lib(prefix=""))')
95 pythondir
= $(prefix)/$(python_lib
)
96 hicolordir
= $(prefix)/share
/icons
/hicolor
/scalable
/apps
100 cola_app_base
= $(cola_base
).app
101 cola_app
= $(CURDIR
)/$(cola_app_base
)
102 cola_version
= $(shell $(PYTHON
) bin
/git-cola version
--brief
)
103 cola_dist
:= $(cola_base
)-$(cola_version
)
105 SETUP ?
= $(PYTHON
) setup.py
109 build_args
+= --use-env-python
112 install_args
+= install
113 install_args
+= --prefix="$(prefix)"
114 install_args
+= --force
115 install_args
+= --install-scripts
="$(bindir)"
116 install_args
+= --record
=build
/MANIFEST
118 install_args
+= --root
="$(DESTDIR)"
123 ifdef NO_PRIVATE_LIBS
124 install_args
+= --no-private-libs
127 install_args
+= --no-vendor-libs
133 ALL_PYTHON_DIRS
= $(PYTHON_DIRS
)
134 ALL_PYTHON_DIRS
+= extras
136 PYTHON_SOURCES
= bin
/git-cola
137 PYTHON_SOURCES
+= bin
/git-cola-sequence-editor
138 PYTHON_SOURCES
+= bin
/git-dag
139 PYTHON_SOURCES
+= setup.py
141 # User customizations
147 .PHONY
: build_version
149 @GIT
=$(GIT
) .
/extras
/generate-build-version.sh
2>/dev
/null || true
153 $(SETUP
) $(QUIET
) $(VERBOSE
) $(build_args
)
157 $(SETUP
) $(QUIET
) $(VERBOSE
) $(install_args
)
158 $(MKDIR_P
) "$(DESTDIR)$(hicolordir)"
159 $(LN_S
) "$(datadir)/icons/git-cola.svg" \
160 "$(DESTDIR)$(hicolordir)/git-cola.svg"
161 $(LN_S
) git-cola
"$(DESTDIR)$(bindir)/cola"
163 # Maintainer's dist target
166 $(GIT
) archive
--format
=tar --prefix=$(cola_dist
)/ HEAD^
{tree
} | \
167 $(GZIP
) -f
-9 - >$(cola_dist
).
tar.gz
171 $(MAKE
) -C share
/doc
/git-cola
all
175 $(MAKE
) -C share
/doc
/git-cola html
179 $(MAKE
) -C share
/doc
/git-cola man
183 $(MAKE
) -C share
/doc
/git-cola
install
187 $(MAKE
) -C share
/doc
/git-cola install-html
191 $(MAKE
) -C share
/doc
/git-cola install-man
195 $(RM
) "$(DESTDIR)$(prefix)"/bin
/git-cola
196 $(RM
) "$(DESTDIR)$(prefix)"/bin
/git-cola-sequence-editor
197 $(RM
) "$(DESTDIR)$(prefix)"/bin
/git-dag
198 $(RM
) "$(DESTDIR)$(prefix)"/bin
/cola
199 $(RM
) "$(DESTDIR)$(prefix)"/share
/applications
/git-cola.desktop
200 $(RM
) "$(DESTDIR)$(prefix)"/share
/applications
/git-cola-folder-handler.desktop
201 $(RM
) "$(DESTDIR)$(prefix)"/share
/applications
/git-dag.desktop
202 $(RM
) "$(DESTDIR)$(prefix)"/share
/metainfo
/git-dag.appdata.xml
203 $(RM
) "$(DESTDIR)$(prefix)"/share
/metainfo
/git-cola.appdata.xml
204 $(RM
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
/scalable
/apps
/git-cola.svg
205 $(RM_R
) "$(DESTDIR)$(prefix)"/share
/doc
/git-cola
206 $(RM_R
) "$(DESTDIR)$(prefix)"/share
/git-cola
207 $(RM
) "$(DESTDIR)$(prefix)"/share
/locale
/*/LC_MESSAGES
/git-cola.mo
208 $(RM_R
) "$(DESTDIR)$(pythondir)"/git_cola-
*
209 $(RM_R
) "$(DESTDIR)$(pythondir)"/cola
210 $(RMDIR
) -p
"$(DESTDIR)$(pythondir)" 2>/dev
/null || true
211 $(RMDIR
) "$(DESTDIR)$(prefix)"/share
/applications
2>/dev
/null || true
212 $(RMDIR
) "$(DESTDIR)$(prefix)"/share
/metainfo
2>/dev
/null || true
213 $(RMDIR
) "$(DESTDIR)$(prefix)"/share
/doc
2>/dev
/null || true
214 $(RMDIR
) "$(DESTDIR)$(prefix)"/share
/locale
/*/LC_MESSAGES
2>/dev
/null || true
215 $(RMDIR
) "$(DESTDIR)$(prefix)"/share
/locale
/* 2>/dev
/null || true
216 $(RMDIR
) "$(DESTDIR)$(prefix)"/share
/locale
2>/dev
/null || true
217 $(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
/scalable
/apps
2>/dev
/null || true
218 $(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
/scalable
2>/dev
/null || true
219 $(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
2>/dev
/null || true
220 $(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
2>/dev
/null || true
221 $(RMDIR
) "$(DESTDIR)$(prefix)"/share
2>/dev
/null || true
222 $(RMDIR
) "$(DESTDIR)$(prefix)"/bin
2>/dev
/null || true
223 $(RMDIR
) "$(DESTDIR)$(prefix)" 2>/dev
/null || true
227 $(PYTEST
) $(PYTEST_FLAGS
) $(flags
) $(PYTHON_DIRS
)
231 $(PYTEST
) $(PYTEST_FLAGS
) --cov
=cola
$(flags
) $(PYTHON_DIRS
)
235 $(FIND
) $(ALL_PYTHON_DIRS
) -name
'*.py[cod]' -print0 |
$(XARGS
) -0 $(RM
)
236 $(FIND
) $(ALL_PYTHON_DIRS
) -name __pycache__
-print0 |
$(XARGS
) -0 $(RM_R
)
237 $(RM_R
) build
dist tags git-cola.app
239 $(MAKE
) -C share
/doc
/git-cola
clean
243 $(FIND
) $(ALL_PYTHON_DIRS
) -name
'*.py' -print0 |
$($XARGS) -0 $(CTAGS
) -f
tags
253 $(SETUP
) build_pot
--build-dir
=po
--no-lang
257 $(SETUP
) build_pot
--build-dir
=po
261 $(SETUP
) build_mo
--force
265 $(MKDIR_P
) $(cola_app
)/Contents
/MacOS
266 $(MKDIR_P
) $(cola_app
)/Contents
/Resources
267 $(CP
) contrib
/darwin
/Info.plist contrib
/darwin
/PkgInfo \
269 $(CP
) contrib
/darwin
/git-cola
$(cola_app
)/Contents
/MacOS
270 $(CP
) contrib
/darwin
/git-cola.icns
$(cola_app
)/Contents
/Resources
271 $(MAKE
) prefix=$(cola_app
)/Contents
/Resources
install install-doc
274 app-tarball
: git-cola.app
275 $(TAR
) czf
$(cola_dist
).app.
tar.gz
$(cola_app_base
)
277 # Preview the markdown using "make README.html"
284 $(FLAKE8
) $(FLAKE8_FLAGS
) $(flags
) \
285 $(PYTHON_SOURCES
) $(ALL_PYTHON_DIRS
) contrib
290 $(PYLINT
) $(PYLINT_FLAGS
) --py3k
$(flags
) \
291 $(PYTHON_SOURCES
) $(ALL_PYTHON_DIRS
)
296 $(PYLINT
) $(PYLINT_FLAGS
) $(flags
) \
297 $(PYTHON_SOURCES
) $(ALL_PYTHON_DIRS
)
303 $(FLAKE8
) $(FLAKE8_FLAGS
) $(flags
) $(file
)
304 $(PYLINT
) $(PYLINT_FLAGS
) --output-format
=colorized
$(flags
) $(file
)
305 $(PYLINT
) $(PYLINT_FLAGS
) --output-format
=colorized
--py3k
$(flags
) $(file
)
317 $(GIT
) ls-files
-- '*.py' | \
319 $(XARGS
) $(BLACK
) --skip-string-normalization
--target-version
=py27
320 $(BLACK
) --skip-string-normalization
--target-version
=py27
$(PYTHON_SOURCES
)
324 $(PIP
) install --requirement requirements
/requirements.txt
326 .PHONY
: requirements-dev
328 $(PIP
) install --requirement requirements
/requirements-dev.txt
332 $(TOX
) $(TOX_FLAGS
) $(flags
)
336 $(TOX
) $(TOX_FLAGS
) --parallel auto
-e
"$(TOX_ENVS)" $(flags
)