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 check file=<filename> # run precommit checks on <filename>
14 # make format file=<filename> # run the yapf python formatter on <filename>
15 # make precommit [color=1] # run test, doc, flake8, pylint3k, and pylint
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...
47 PYTEST ?
= $(PYTHON
) -m pytest
60 TEST_VERBOSE
= --verbose
69 FLAKE8_FLAGS
= $(VERBOSE
)
70 FLAKE8_FLAGS
+= --max-line-length
=80
71 FLAKE8_FLAGS
+= --format
=pylint
72 FLAKE8_FLAGS
+= --doctests
74 PYTEST_FLAGS
= $(QUIET
) $(TEST_VERBOSE
)
75 PYTEST_FLAGS
+= --doctest-modules
77 TOX_FLAGS
= $(VERBOSE_SHORT
) --develop
--skip-missing-interpreters
79 PYLINT_FLAGS
= --rcfile
=.pylintrc
80 PYLINT_FLAGS
+= --score
=no
82 PYLINT_FLAGS
+= --output-format
=colorized
86 # These values can be overridden on the command-line or via config.mak
88 bindir = $(prefix)/bin
89 datadir = $(prefix)/share
/git-cola
90 coladir
= $(datadir)/lib
91 hicolordir
= $(prefix)/share
/icons
/hicolor
/scalable
/apps
95 cola_app_base
= $(cola_base
).app
96 cola_app
= $(CURDIR
)/$(cola_app_base
)
97 cola_version
= $(shell $(PYTHON
) bin
/git-cola version
--brief
)
98 cola_dist
:= $(cola_base
)-$(cola_version
)
100 SETUP ?
= $(PYTHON
) setup.py
104 build_args
+= --use-env-python
107 install_args
+= install
108 install_args
+= --prefix="$(prefix)"
109 install_args
+= --force
110 install_args
+= --install-scripts
="$(bindir)"
111 install_args
+= --record
=build
/MANIFEST
112 install_args
+= --install-lib
="$(coladir)"
114 install_args
+= --root
="$(DESTDIR)"
119 # If NO_VENDOR_LIBS is specified on the command line then pass it to setup.py
121 install_args
+= --no-vendor-libs
127 ALL_PYTHON_DIRS
= $(PYTHON_DIRS
)
128 ALL_PYTHON_DIRS
+= extras
130 PYTHON_SOURCES
= bin
/git-cola
131 PYTHON_SOURCES
+= bin
/git-dag
132 PYTHON_SOURCES
+= share
/git-cola
/bin
/git-xbase
133 PYTHON_SOURCES
+= setup.py
135 # User customizations
142 @GIT
=$(GIT
) .
/extras
/generate-build-version.sh
2>/dev
/null || true
143 .PHONY
: build_version
146 $(SETUP
) $(QUIET
) $(VERBOSE
) $(build_args
)
150 $(SETUP
) $(QUIET
) $(VERBOSE
) $(install_args
)
151 $(MKDIR_P
) "$(DESTDIR)$(hicolordir)"
152 $(LN_S
) "$(datadir)/icons/git-cola.svg" \
153 "$(DESTDIR)$(hicolordir)/git-cola.svg"
154 $(LN_S
) git-cola
"$(DESTDIR)$(bindir)/cola"
155 $(RM_R
) "$(DESTDIR)$(coladir)/git_cola"*
156 $(RM_R
) git_cola.egg-info
159 # Maintainer's dist target
161 $(GIT
) archive
--format
=tar --prefix=$(cola_dist
)/ HEAD^
{tree
} | \
162 $(GZIP
) -f
-9 - >$(cola_dist
).
tar.gz
166 $(MAKE
) -C share
/doc
/git-cola
all
170 $(MAKE
) -C share
/doc
/git-cola html
174 $(MAKE
) -C share
/doc
/git-cola man
178 $(MAKE
) -C share
/doc
/git-cola
install
182 $(MAKE
) -C share
/doc
/git-cola install-html
186 $(MAKE
) -C share
/doc
/git-cola install-man
190 $(RM
) "$(DESTDIR)$(prefix)"/bin
/git-cola
191 $(RM
) "$(DESTDIR)$(prefix)"/bin
/git-dag
192 $(RM
) "$(DESTDIR)$(prefix)"/bin
/cola
193 $(RM
) "$(DESTDIR)$(prefix)"/share
/applications
/git-cola.desktop
194 $(RM
) "$(DESTDIR)$(prefix)"/share
/applications
/git-cola-folder-handler.desktop
195 $(RM
) "$(DESTDIR)$(prefix)"/share
/applications
/git-dag.desktop
196 $(RM
) "$(DESTDIR)$(prefix)"/share
/appdata
/git-dag.appdata.xml
197 $(RM
) "$(DESTDIR)$(prefix)"/share
/appdata
/git-cola.appdata.xml
198 $(RM
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
/scalable
/apps
/git-cola.svg
199 $(RM_R
) "$(DESTDIR)$(prefix)"/share
/doc
/git-cola
200 $(RM_R
) "$(DESTDIR)$(prefix)"/share
/git-cola
201 $(RM
) "$(DESTDIR)$(prefix)"/share
/locale
/*/LC_MESSAGES
/git-cola.mo
202 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/applications
2>/dev
/null
203 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/appdata
2>/dev
/null
204 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/doc
2>/dev
/null
205 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/locale
/*/LC_MESSAGES
2>/dev
/null
206 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/locale
/* 2>/dev
/null
207 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/locale
2>/dev
/null
208 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
/scalable
/apps
2>/dev
/null
209 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
/scalable
2>/dev
/null
210 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
2>/dev
/null
211 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
2>/dev
/null
212 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
2>/dev
/null
213 -$(RMDIR
) "$(DESTDIR)$(prefix)"/bin
2>/dev
/null
214 -$(RMDIR
) "$(DESTDIR)$(prefix)" 2>/dev
/null
218 $(PYTEST
) $(PYTEST_FLAGS
) $(flags
) $(PYTHON_DIRS
)
222 $(PYTEST
) $(PYTEST_FLAGS
) --cov
=cola
$(flags
) $(PYTHON_DIRS
)
226 $(FIND
) $(ALL_PYTHON_DIRS
) -name
'*.py[cod]' -print0 | xargs
-0 rm -f
227 $(FIND
) $(ALL_PYTHON_DIRS
) -name __pycache__
-print0 | xargs
-0 rm -rf
228 $(RM_R
) build
dist tags git-cola.app
230 $(MAKE
) -C share
/doc
/git-cola
clean
234 $(FIND
) $(ALL_PYTHON_DIRS
) -name
'*.py' -print0 | xargs
-0 $(CTAGS
) -f
tags
244 $(SETUP
) build_pot
--build-dir
=po
--no-lang
248 $(SETUP
) build_pot
--build-dir
=po
252 $(SETUP
) build_mo
--force
256 $(MKDIR_P
) $(cola_app
)/Contents
/MacOS
257 $(MKDIR_P
) $(cola_app
)/Contents
/Resources
258 $(CP
) contrib
/darwin
/Info.plist contrib
/darwin
/PkgInfo \
260 $(CP
) contrib
/darwin
/git-cola
$(cola_app
)/Contents
/MacOS
261 $(CP
) contrib
/darwin
/git-cola.icns
$(cola_app
)/Contents
/Resources
262 $(MAKE
) prefix=$(cola_app
)/Contents
/Resources
install install-doc
265 app-tarball
: git-cola.app
266 $(TAR
) czf
$(cola_dist
).app.
tar.gz
$(cola_app_base
)
269 # Preview the markdown using "make README.html"
274 $(FLAKE8
) $(FLAKE8_FLAGS
) $(flags
) \
275 $(PYTHON_SOURCES
) $(ALL_PYTHON_DIRS
) contrib
279 $(PYLINT
) $(PYLINT_FLAGS
) --py3k
$(flags
) \
280 $(PYTHON_SOURCES
) $(ALL_PYTHON_DIRS
)
284 $(PYLINT
) $(PYLINT_FLAGS
) $(flags
) \
285 $(PYTHON_SOURCES
) $(ALL_PYTHON_DIRS
)
289 $(FLAKE8
) $(FLAKE8_FLAGS
) $(flags
) $(file
)
290 $(PYLINT
) $(PYLINT_FLAGS
) --output-format
=colorized
$(flags
) $(file
)
291 $(PYLINT
) $(PYLINT_FLAGS
) --output-format
=colorized
--py3k
$(flags
) $(file
)
304 $(YAPF
) --in-place
$(flags
) $(file
)
308 $(PIP
) install --requirement requirements
/requirements.txt
312 $(PIP
) install --requirement requirements
/requirements-dev.txt
313 .PHONY
: requirements-dev
316 $(TOX
) $(TOX_FLAGS
) $(flags
)