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
59 TEST_VERBOSE
= --verbose
65 PYTEST_FLAGS
= $(QUIET
) $(TEST_VERBOSE
)
66 PYTEST_FLAGS
+= --doctest-modules
68 FLAKE8_FLAGS
= $(VERBOSE
)
69 FLAKE8_FLAGS
+= --max-line-length
=80
70 FLAKE8_FLAGS
+= --format
=pylint
71 FLAKE8_FLAGS
+= --doctests
73 PYLINT_FLAGS
= --rcfile
=.pylintrc
74 PYLINT_FLAGS
+= --score
=no
76 PYLINT_FLAGS
+= --output-format
=colorized
79 # These values can be overridden on the command-line or via config.mak
81 bindir = $(prefix)/bin
82 datadir = $(prefix)/share
/git-cola
83 coladir
= $(datadir)/lib
84 hicolordir
= $(prefix)/share
/icons
/hicolor
/scalable
/apps
88 cola_app_base
= $(cola_base
).app
89 cola_app
= $(CURDIR
)/$(cola_app_base
)
90 cola_version
= $(shell $(PYTHON
) bin
/git-cola version
--brief
)
91 cola_dist
:= $(cola_base
)-$(cola_version
)
93 SETUP ?
= $(PYTHON
) setup.py
97 build_args
+= --use-env-python
100 install_args
+= install
101 install_args
+= --prefix="$(prefix)"
102 install_args
+= --force
103 install_args
+= --install-scripts
="$(bindir)"
104 install_args
+= --record
=build
/MANIFEST
105 install_args
+= --install-lib
="$(coladir)"
107 install_args
+= --root
="$(DESTDIR)"
112 # If NO_VENDOR_LIBS is specified on the command line then pass it to setup.py
114 install_args
+= --no-vendor-libs
120 ALL_PYTHON_DIRS
= $(PYTHON_DIRS
)
121 ALL_PYTHON_DIRS
+= extras
123 PYTHON_SOURCES
= bin
/git-cola
124 PYTHON_SOURCES
+= bin
/git-dag
125 PYTHON_SOURCES
+= share
/git-cola
/bin
/git-xbase
126 PYTHON_SOURCES
+= setup.py
128 # User customizations
135 @GIT
=$(GIT
) .
/extras
/generate-build-version.sh
2>/dev
/null || true
136 .PHONY
: build_version
139 $(SETUP
) $(QUIET
) $(VERBOSE
) $(build_args
)
143 $(SETUP
) $(QUIET
) $(VERBOSE
) $(install_args
)
144 $(MKDIR_P
) "$(DESTDIR)$(hicolordir)"
145 $(LN_S
) "$(datadir)/icons/git-cola.svg" \
146 "$(DESTDIR)$(hicolordir)/git-cola.svg"
147 $(LN_S
) git-cola
"$(DESTDIR)$(bindir)/cola"
148 $(RM_R
) "$(DESTDIR)$(coladir)/git_cola"*
149 $(RM_R
) git_cola.egg-info
151 # Maintainer's dist target
153 $(GIT
) archive
--format
=tar --prefix=$(cola_dist
)/ HEAD^
{tree
} | \
154 $(GZIP
) -f
-9 - >$(cola_dist
).
tar.gz
157 $(MAKE
) -C share
/doc
/git-cola
all
160 $(MAKE
) -C share
/doc
/git-cola html
163 $(MAKE
) -C share
/doc
/git-cola man
166 $(MAKE
) -C share
/doc
/git-cola
install
169 $(MAKE
) -C share
/doc
/git-cola install-html
172 $(MAKE
) -C share
/doc
/git-cola install-man
175 $(RM
) "$(DESTDIR)$(prefix)"/bin
/git-cola
176 $(RM
) "$(DESTDIR)$(prefix)"/bin
/git-dag
177 $(RM
) "$(DESTDIR)$(prefix)"/bin
/cola
178 $(RM
) "$(DESTDIR)$(prefix)"/share
/applications
/git-cola.desktop
179 $(RM
) "$(DESTDIR)$(prefix)"/share
/applications
/git-cola-folder-handler.desktop
180 $(RM
) "$(DESTDIR)$(prefix)"/share
/applications
/git-dag.desktop
181 $(RM
) "$(DESTDIR)$(prefix)"/share
/appdata
/git-dag.appdata.xml
182 $(RM
) "$(DESTDIR)$(prefix)"/share
/appdata
/git-cola.appdata.xml
183 $(RM
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
/scalable
/apps
/git-cola.svg
184 $(RM_R
) "$(DESTDIR)$(prefix)"/share
/doc
/git-cola
185 $(RM_R
) "$(DESTDIR)$(prefix)"/share
/git-cola
186 $(RM
) "$(DESTDIR)$(prefix)"/share
/locale
/*/LC_MESSAGES
/git-cola.mo
187 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/applications
2>/dev
/null
188 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/appdata
2>/dev
/null
189 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/doc
2>/dev
/null
190 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/locale
/*/LC_MESSAGES
2>/dev
/null
191 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/locale
/* 2>/dev
/null
192 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/locale
2>/dev
/null
193 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
/scalable
/apps
2>/dev
/null
194 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
/scalable
2>/dev
/null
195 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
2>/dev
/null
196 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
2>/dev
/null
197 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
2>/dev
/null
198 -$(RMDIR
) "$(DESTDIR)$(prefix)"/bin
2>/dev
/null
199 -$(RMDIR
) "$(DESTDIR)$(prefix)" 2>/dev
/null
202 $(PYTEST
) $(PYTEST_FLAGS
) $(flags
) $(PYTHON_DIRS
)
205 $(PYTEST
) $(PYTEST_FLAGS
) --cov
=cola
$(flags
) $(PYTHON_DIRS
)
208 $(FIND
) $(ALL_PYTHON_DIRS
) -name
'*.py[cod]' -print0 | xargs
-0 rm -f
209 $(FIND
) $(ALL_PYTHON_DIRS
) -name __pycache__
-print0 | xargs
-0 rm -rf
210 $(RM_R
) build
dist tags git-cola.app
212 $(MAKE
) -C share
/doc
/git-cola
clean
215 $(FIND
) $(ALL_PYTHON_DIRS
) -name
'*.py' -print0 | xargs
-0 $(CTAGS
) -f
tags
223 $(SETUP
) build_pot
--build-dir
=po
--no-lang
227 $(SETUP
) build_pot
--build-dir
=po
231 $(SETUP
) build_mo
--force
235 $(MKDIR_P
) $(cola_app
)/Contents
/MacOS
236 $(MKDIR_P
) $(cola_app
)/Contents
/Resources
237 $(CP
) contrib
/darwin
/Info.plist contrib
/darwin
/PkgInfo \
239 $(CP
) contrib
/darwin
/git-cola
$(cola_app
)/Contents
/MacOS
240 $(CP
) contrib
/darwin
/git-cola.icns
$(cola_app
)/Contents
/Resources
241 $(MAKE
) prefix=$(cola_app
)/Contents
/Resources
install 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"
252 $(FLAKE8
) $(FLAKE8_FLAGS
) $(PYTHON_SOURCES
) $(PYTHON_DIRS
)
255 $(PYLINT
) $(PYLINT_FLAGS
) --py3k
$(flags
) \
256 $(PYTHON_SOURCES
) $(ALL_PYTHON_DIRS
)
259 $(PYLINT
) $(PYLINT_FLAGS
) $(flags
) \
260 $(PYTHON_SOURCES
) $(ALL_PYTHON_DIRS
)
263 $(FLAKE8
) $(FLAKE8_FLAGS
) $(flags
) $(file
)
264 $(PYLINT
) $(PYLINT_FLAGS
) --output-format
=colorized
$(flags
) $(file
)
265 $(PYLINT
) $(PYLINT_FLAGS
) --output-format
=colorized
--py3k
$(flags
) $(file
)
276 $(YAPF
) --in-place
$(flags
) $(file
)
279 $(PIP
) install --requirement requirements
/requirements.txt
282 $(PIP
) install --requirement requirements
/requirements-dev.txt