1 # The default target of this Makefile is...
6 # make test # unit tests
7 # make doc # build docs
8 # make flake8 # style check
9 # make pyint3k # python2/3 compatibility checks
10 # make pylint # full pylint check
11 # # TODO pylint config, tox, yapf, others?
14 # make pot # update main translation template
15 # make po # merge translations
19 # make prefix=<path> install
20 # DESTDIR is also supported.
22 # To disable distutil's replacement of "#!/usr/bin/env python" with
23 # the path to the build environment's python, pass USE_ENV_PYTHON=1
26 # The external commands used by this Makefile are...
40 PYTEST ?
= $(PYTHON
) -m pytest
49 # "make V=1" increases verbosity
50 # "make test V=2" increases test verbosity
51 # "make pylint color=1" enables colorized pylint output
52 # "make test flags={-x,--exitfirst}" exits on the first test failure
56 TEST_VERBOSE
= --verbose
62 PYTEST_FLAGS
= $(QUIET
) $(TEST_VERBOSE
)
63 PYTEST_FLAGS
+= --doctest-modules
65 FLAKE8_FLAGS
= $(VERBOSE
)
66 FLAKE8_FLAGS
+= --max-line-length
=80
67 FLAKE8_FLAGS
+= --format
=pylint
68 FLAKE8_FLAGS
+= --doctests
69 FLAKE8_FLAGS
+= --statistics
71 PYLINT_FLAGS
= --rcfile
=.pylintrc
73 PYLINT_FLAGS
+= --output-format
=colorized
76 # These values can be overridden on the command-line or via config.mak
78 bindir = $(prefix)/bin
79 datadir = $(prefix)/share
/git-cola
80 coladir
= $(datadir)/lib
81 hicolordir
= $(prefix)/share
/icons
/hicolor
/scalable
/apps
85 cola_app_base
= $(cola_base
).app
86 cola_app
= $(CURDIR
)/$(cola_app_base
)
87 cola_version
= $(shell $(PYTHON
) bin
/git-cola version
--brief
)
88 cola_dist
:= $(cola_base
)-$(cola_version
)
90 SETUP ?
= $(PYTHON
) setup.py
94 build_args
+= --use-env-python
97 install_args
+= install
98 install_args
+= --prefix="$(prefix)"
99 install_args
+= --force
100 install_args
+= --install-scripts
="$(bindir)"
101 install_args
+= --record
=build
/MANIFEST
102 install_args
+= --install-lib
="$(coladir)"
104 install_args
+= --root
="$(DESTDIR)"
109 # If NO_VENDOR_LIBS is specified on the command line then pass it to setup.py
111 install_args
+= --no-vendor-libs
117 ALL_PYTHON_DIRS
= $(PYTHON_DIRS
)
118 ALL_PYTHON_DIRS
+= extras
120 PYTHON_SOURCES
= bin
/git-cola
121 PYTHON_SOURCES
+= bin
/git-dag
122 PYTHON_SOURCES
+= share
/git-cola
/bin
/git-xbase
123 PYTHON_SOURCES
+= setup.py
125 # User customizations
132 @GIT
=$(GIT
) .
/extras
/generate-build-version.sh
2>/dev
/null || true
133 .PHONY
: build_version
136 $(SETUP
) $(QUIET
) $(VERBOSE
) $(build_args
)
140 $(SETUP
) $(QUIET
) $(VERBOSE
) $(install_args
)
141 $(MKDIR_P
) "$(DESTDIR)$(hicolordir)"
142 $(LN_S
) "$(datadir)/icons/git-cola.svg" \
143 "$(DESTDIR)$(hicolordir)/git-cola.svg"
144 $(LN_S
) git-cola
"$(DESTDIR)$(bindir)/cola"
145 $(RM_R
) "$(DESTDIR)$(coladir)/git_cola"*
146 $(RM_R
) git_cola.egg-info
148 # Maintainer's dist target
150 $(GIT
) archive
--format
=tar --prefix=$(cola_dist
)/ HEAD^
{tree
} | \
151 $(GZIP
) -f
-9 - >$(cola_dist
).
tar.gz
154 $(MAKE
) -C share
/doc
/git-cola
all
157 $(MAKE
) -C share
/doc
/git-cola html
160 $(MAKE
) -C share
/doc
/git-cola man
163 $(MAKE
) -C share
/doc
/git-cola
install
166 $(MAKE
) -C share
/doc
/git-cola install-html
169 $(MAKE
) -C share
/doc
/git-cola install-man
172 $(RM
) "$(DESTDIR)$(prefix)"/bin
/git-cola
173 $(RM
) "$(DESTDIR)$(prefix)"/bin
/git-dag
174 $(RM
) "$(DESTDIR)$(prefix)"/bin
/cola
175 $(RM
) "$(DESTDIR)$(prefix)"/share
/applications
/git-cola.desktop
176 $(RM
) "$(DESTDIR)$(prefix)"/share
/applications
/git-cola-folder-handler.desktop
177 $(RM
) "$(DESTDIR)$(prefix)"/share
/applications
/git-dag.desktop
178 $(RM
) "$(DESTDIR)$(prefix)"/share
/appdata
/git-dag.appdata.xml
179 $(RM
) "$(DESTDIR)$(prefix)"/share
/appdata
/git-cola.appdata.xml
180 $(RM
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
/scalable
/apps
/git-cola.svg
181 $(RM_R
) "$(DESTDIR)$(prefix)"/share
/doc
/git-cola
182 $(RM_R
) "$(DESTDIR)$(prefix)"/share
/git-cola
183 $(RM
) "$(DESTDIR)$(prefix)"/share
/locale
/*/LC_MESSAGES
/git-cola.mo
184 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/applications
2>/dev
/null
185 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/appdata
2>/dev
/null
186 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/doc
2>/dev
/null
187 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/locale
/*/LC_MESSAGES
2>/dev
/null
188 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/locale
/* 2>/dev
/null
189 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/locale
2>/dev
/null
190 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
/scalable
/apps
2>/dev
/null
191 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
/scalable
2>/dev
/null
192 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
/hicolor
2>/dev
/null
193 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
/icons
2>/dev
/null
194 -$(RMDIR
) "$(DESTDIR)$(prefix)"/share
2>/dev
/null
195 -$(RMDIR
) "$(DESTDIR)$(prefix)"/bin
2>/dev
/null
196 -$(RMDIR
) "$(DESTDIR)$(prefix)" 2>/dev
/null
199 $(PYTEST
) $(PYTEST_FLAGS
) $(flags
) $(PYTHON_DIRS
)
202 $(PYTEST
) $(PYTEST_FLAGS
) --cov
=cola
$(flags
) $(PYTHON_DIRS
)
205 $(FIND
) $(ALL_PYTHON_DIRS
) -name
'*.py[cod]' -print0 | xargs
-0 rm -f
206 $(FIND
) $(ALL_PYTHON_DIRS
) -name __pycache__
-print0 | xargs
-0 rm -rf
207 $(RM_R
) build
dist tags git-cola.app
209 $(MAKE
) -C share
/doc
/git-cola
clean
212 $(FIND
) $(ALL_PYTHON_DIRS
) -name
'*.py' -print0 | xargs
-0 $(CTAGS
) -f
tags
220 $(SETUP
) build_pot
--build-dir
=po
--no-lang
224 $(SETUP
) build_pot
--build-dir
=po
228 $(SETUP
) build_mo
--force
232 $(MKDIR_P
) $(cola_app
)/Contents
/MacOS
233 $(MKDIR_P
) $(cola_app
)/Contents
/Resources
234 $(CP
) contrib
/darwin
/Info.plist contrib
/darwin
/PkgInfo \
236 $(CP
) contrib
/darwin
/git-cola
$(cola_app
)/Contents
/MacOS
237 $(CP
) contrib
/darwin
/git-cola.icns
$(cola_app
)/Contents
/Resources
238 $(MAKE
) prefix=$(cola_app
)/Contents
/Resources
install install-doc
241 app-tarball
: git-cola.app
242 $(TAR
) czf
$(cola_dist
).app.
tar.gz
$(cola_app_base
)
244 # Preview the markdown using "make README.html"
249 $(FLAKE8
) $(FLAKE8_FLAGS
) $(PYTHON_SOURCES
) $(PYTHON_DIRS
)
252 $(PYLINT
) $(PYLINT_FLAGS
) --py3k
$(flags
) \
253 $(PYTHON_SOURCES
) $(ALL_PYTHON_DIRS
)
256 $(PYLINT
) $(PYLINT_FLAGS
) $(flags
) \
257 $(PYTHON_SOURCES
) $(ALL_PYTHON_DIRS
)
260 $(FLAKE8
) $(FLAKE8_FLAGS
) $(flags
) $(file
)
261 $(PYLINT
) $(PYLINT_FLAGS
) $(flags
) $(file
)
262 $(PYLINT
) $(PYLINT_FLAGS
) --py3k
$(flags
) $(file
)
265 $(YAPF
) --in-place
$(flags
) $(file
)
268 $(PIP
) install --requirement requirements
/requirements.txt
271 $(PIP
) install --requirement requirements
/requirements-dev.txt