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 file=<filename> # run the yapf python formatter on <filename>
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...
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
76 uname_S
:= $(shell uname
-s
)
77 ifneq ($(uname_S
),Linux
)
78 PYTEST_FLAGS
+= --ignore
=cola
/inotify.py
81 TOX_FLAGS
= $(VERBOSE_SHORT
) --develop
--skip-missing-interpreters
82 TOX_ENVS ?
= py
{27,34,35,36,37},pylint
{2,36,37}
84 PYLINT_FLAGS
= --rcfile
=.pylintrc
85 PYLINT_FLAGS
+= --score
=no
87 PYLINT_FLAGS
+= --output-format
=colorized
91 # These values can be overridden on the command-line or via config.mak
93 bindir = $(prefix)/bin
94 datadir = $(prefix)/share
/git-cola
95 coladir
= $(datadir)/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
117 install_args
+= --install-lib
="$(coladir)"
119 install_args
+= --root
="$(DESTDIR)"
124 # If NO_VENDOR_LIBS is specified on the command line then pass it to setup.py
126 install_args
+= --no-vendor-libs
132 ALL_PYTHON_DIRS
= $(PYTHON_DIRS
)
133 ALL_PYTHON_DIRS
+= extras
135 PYTHON_SOURCES
= bin
/git-cola
136 PYTHON_SOURCES
+= bin
/git-dag
137 PYTHON_SOURCES
+= share
/git-cola
/bin
/git-xbase
138 PYTHON_SOURCES
+= setup.py
140 # User customizations
147 @GIT
=$(GIT
) .
/extras
/generate-build-version.sh
2>/dev
/null || true
148 .PHONY
: build_version
151 $(SETUP
) $(QUIET
) $(VERBOSE
) $(build_args
)
155 $(SETUP
) $(QUIET
) $(VERBOSE
) $(install_args
)
156 $(MKDIR_P
) "$(DESTDIR)$(hicolordir)"
157 $(LN_S
) "$(datadir)/icons/git-cola.svg" \
158 "$(DESTDIR)$(hicolordir)/git-cola.svg"
159 $(LN_S
) git-cola
"$(DESTDIR)$(bindir)/cola"
160 $(RM_R
) "$(DESTDIR)$(coladir)/git_cola"*
161 $(RM_R
) git_cola.egg-info
164 # 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-dag
197 $(RM
) "$(DESTDIR)$(prefix)"/bin
/cola
198 $(RM
) "$(DESTDIR)$(prefix)"/share
/applications
/git-cola.desktop
199 $(RM
) "$(DESTDIR)$(prefix)"/share
/applications
/git-cola-folder-handler.desktop
200 $(RM
) "$(DESTDIR)$(prefix)"/share
/applications
/git-dag.desktop
201 $(RM
) "$(DESTDIR)$(prefix)"/share
/appdata
/git-dag.appdata.xml
202 $(RM
) "$(DESTDIR)$(prefix)"/share
/appdata
/git-cola.appdata.xml
203 $(RM
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
/scalable
/apps
/git-cola.svg
204 $(RM_R
) "$(DESTDIR)$(prefix)"/share
/doc
/git-cola
205 $(RM_R
) "$(DESTDIR)$(prefix)"/share
/git-cola
206 $(RM
) "$(DESTDIR)$(prefix)"/share
/locale
/*/LC_MESSAGES
/git-cola.mo
207 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/applications
2>/dev
/null
208 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/appdata
2>/dev
/null
209 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/doc
2>/dev
/null
210 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/locale
/*/LC_MESSAGES
2>/dev
/null
211 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/locale
/* 2>/dev
/null
212 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/locale
2>/dev
/null
213 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
/scalable
/apps
2>/dev
/null
214 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
/scalable
2>/dev
/null
215 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
2>/dev
/null
216 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
2>/dev
/null
217 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
2>/dev
/null
218 -$(RMDIR
) "$(DESTDIR)$(prefix)"/bin
2>/dev
/null
219 -$(RMDIR
) "$(DESTDIR)$(prefix)" 2>/dev
/null
223 $(PYTEST
) $(PYTEST_FLAGS
) $(flags
) $(PYTHON_DIRS
)
227 $(PYTEST
) $(PYTEST_FLAGS
) --cov
=cola
$(flags
) $(PYTHON_DIRS
)
231 $(FIND
) $(ALL_PYTHON_DIRS
) -name
'*.py[cod]' -print0 | xargs
-0 rm -f
232 $(FIND
) $(ALL_PYTHON_DIRS
) -name __pycache__
-print0 | xargs
-0 rm -rf
233 $(RM_R
) build
dist tags git-cola.app
235 $(MAKE
) -C share
/doc
/git-cola
clean
239 $(FIND
) $(ALL_PYTHON_DIRS
) -name
'*.py' -print0 | xargs
-0 $(CTAGS
) -f
tags
249 $(SETUP
) build_pot
--build-dir
=po
--no-lang
253 $(SETUP
) build_pot
--build-dir
=po
257 $(SETUP
) build_mo
--force
261 $(MKDIR_P
) $(cola_app
)/Contents
/MacOS
262 $(MKDIR_P
) $(cola_app
)/Contents
/Resources
263 $(CP
) contrib
/darwin
/Info.plist contrib
/darwin
/PkgInfo \
265 $(CP
) contrib
/darwin
/git-cola
$(cola_app
)/Contents
/MacOS
266 $(CP
) contrib
/darwin
/git-cola.icns
$(cola_app
)/Contents
/Resources
267 $(MAKE
) prefix=$(cola_app
)/Contents
/Resources
install install-doc
270 app-tarball
: git-cola.app
271 $(TAR
) czf
$(cola_dist
).app.
tar.gz
$(cola_app_base
)
274 # Preview the markdown using "make README.html"
280 $(FLAKE8
) $(FLAKE8_FLAGS
) $(flags
) \
281 $(PYTHON_SOURCES
) $(ALL_PYTHON_DIRS
) contrib
286 .PHONY
: pylint-version
288 pylint3k
: pylint-version
289 $(PYLINT
) $(PYLINT_FLAGS
) --py3k
$(flags
) \
290 $(PYTHON_SOURCES
) $(ALL_PYTHON_DIRS
)
293 pylint
: pylint-version
294 $(PYLINT
) $(PYLINT_FLAGS
) $(flags
) \
295 $(PYTHON_SOURCES
) $(ALL_PYTHON_DIRS
)
301 $(FLAKE8
) $(FLAKE8_FLAGS
) $(flags
) $(file
)
302 $(PYLINT
) $(PYLINT_FLAGS
) --output-format
=colorized
$(flags
) $(file
)
303 $(PYLINT
) $(PYLINT_FLAGS
) --output-format
=colorized
--py3k
$(flags
) $(file
)
315 $(YAPF
) --in-place
$(flags
) $(file
)
319 $(PIP
) install --requirement requirements
/requirements.txt
323 $(PIP
) install --requirement requirements
/requirements-dev.txt
324 .PHONY
: requirements-dev
327 $(TOX
) $(TOX_FLAGS
) $(flags
)
331 $(TOX
) $(TOX_FLAGS
) -e
"$(TOX_ENVS)" $(flags
)