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 # The external commands used by this Makefile are...
36 PYTEST ?
= $(PYTHON
) -m pytest
44 # "make V=1" increases verbosity
45 # "make test V=2" increases test verbosity
46 # "make pylint color=1" enables colorized pylint output
47 # "make test flags={-x,--exitfirst}" exits on the first test failure
51 TEST_VERBOSE
= --verbose
56 PYTEST_FLAGS
= $(QUIET
) $(TEST_VERBOSE
) --doctest-modules
57 FLAKE8_FLAGS
= --max-line-length
=80 --statistics
--doctests
--format
=pylint
58 PYLINT_FLAGS
= --rcfile
=.pylintrc
60 PYLINT_FLAGS
+= --output-format
=colorized
63 PYTEST_FLAGS
+= $(flags
)
66 # These values can be overridden on the command-line or via config.mak
68 bindir = "$(prefix)"/bin
69 datadir = "$(prefix)"/share
/git-cola
70 coladir
= $(datadir)/lib
71 hicolordir
= "$(prefix)"/share
/icons
/hicolor
/scalable
/apps
75 cola_app_base
= $(cola_base
).app
76 cola_app
= $(CURDIR
)/$(cola_app_base
)
77 cola_version
= $(shell $(PYTHON
) bin
/git-cola version
--brief
)
78 cola_dist
:= $(cola_base
)-$(cola_version
)
79 SETUP ?
= $(PYTHON
) setup.py
80 setup_args
+= --prefix="$(prefix)"
82 setup_args
+= --install-scripts
=$(bindir)
83 setup_args
+= --record
=build
/MANIFEST
84 setup_args
+= --install-lib
=$(coladir
)
86 setup_args
+= --root
="$(DESTDIR)"
91 # If NO_VENDOR_LIBS is specified on the command line then pass it to setup.py
93 setup_args
+= --no-vendor-libs
99 ALL_PYTHON_DIRS
= $(PYTHON_DIRS
)
100 ALL_PYTHON_DIRS
+= extras
102 PYTHON_SOURCES
= bin
/git-cola
103 PYTHON_SOURCES
+= bin
/git-dag
104 PYTHON_SOURCES
+= share
/git-cola
/bin
/git-xbase
105 PYTHON_SOURCES
+= setup.py
107 # User customizations
114 @GIT
=$(GIT
) .
/extras
/generate-build-version.sh
2>/dev
/null || true
115 .PHONY
: build_version
118 $(SETUP
) $(VERBOSE
) build
122 $(SETUP
) $(QUIET
) install $(setup_args
)
123 $(MKDIR_P
) "$(DESTDIR)"$(hicolordir
)
124 $(LN_S
) $(datadir)/icons
/git-cola.svg
"$(DESTDIR)"$(hicolordir
)/git-cola.svg
125 $(LN_S
) git-cola
"$(DESTDIR)"$(bindir)/cola
126 $(RM_R
) "$(DESTDIR)"$(coladir
)/git_cola
*
127 $(RM_R
) git_cola.egg-info
130 # Maintainer's dist target
132 $(GIT
) archive
--format
=tar --prefix=$(cola_dist
)/ HEAD^
{tree
} | \
133 $(GZIP
) -f
-9 - >$(cola_dist
).
tar.gz
137 $(MAKE
) -C share
/doc
/git-cola
all
141 $(MAKE
) -C share
/doc
/git-cola html
145 $(MAKE
) -C share
/doc
/git-cola man
149 $(MAKE
) -C share
/doc
/git-cola
install
153 $(MAKE
) -C share
/doc
/git-cola install-html
157 $(MAKE
) -C share
/doc
/git-cola install-man
161 $(RM
) "$(DESTDIR)""$(prefix)"/bin
/git-cola
162 $(RM
) "$(DESTDIR)""$(prefix)"/bin
/git-dag
163 $(RM
) "$(DESTDIR)""$(prefix)"/bin
/cola
164 $(RM
) "$(DESTDIR)""$(prefix)"/share
/applications
/git-cola.desktop
165 $(RM
) "$(DESTDIR)""$(prefix)"/share
/applications
/git-cola-folder-handler.desktop
166 $(RM
) "$(DESTDIR)""$(prefix)"/share
/applications
/git-dag.desktop
167 $(RM
) "$(DESTDIR)""$(prefix)"/share
/appdata
/git-dag.appdata.xml
168 $(RM
) "$(DESTDIR)""$(prefix)"/share
/appdata
/git-cola.appdata.xml
169 $(RM
) "$(DESTDIR)""$(prefix)"/share
/icons
/hicolor
/scalable
/apps
/git-cola.svg
170 $(RM_R
) "$(DESTDIR)""$(prefix)"/share
/doc
/git-cola
171 $(RM_R
) "$(DESTDIR)""$(prefix)"/share
/git-cola
172 $(RM
) "$(DESTDIR)""$(prefix)"/share
/locale
/*/LC_MESSAGES
/git-cola.mo
173 -$(RMDIR
) "$(DESTDIR)""$(prefix)"/share
/applications
2>/dev
/null
174 -$(RMDIR
) "$(DESTDIR)""$(prefix)"/share
/appdata
2>/dev
/null
175 -$(RMDIR
) "$(DESTDIR)""$(prefix)"/share
/doc
2>/dev
/null
176 -$(RMDIR
) "$(DESTDIR)""$(prefix)"/share
/locale
/*/LC_MESSAGES
2>/dev
/null
177 -$(RMDIR
) "$(DESTDIR)""$(prefix)"/share
/locale
/* 2>/dev
/null
178 -$(RMDIR
) "$(DESTDIR)""$(prefix)"/share
/locale
2>/dev
/null
179 -$(RMDIR
) "$(DESTDIR)""$(prefix)"/share
/icons
/hicolor
/scalable
/apps
2>/dev
/null
180 -$(RMDIR
) "$(DESTDIR)""$(prefix)"/share
/icons
/hicolor
/scalable
2>/dev
/null
181 -$(RMDIR
) "$(DESTDIR)""$(prefix)"/share
/icons
/hicolor
2>/dev
/null
182 -$(RMDIR
) "$(DESTDIR)""$(prefix)"/share
/icons
2>/dev
/null
183 -$(RMDIR
) "$(DESTDIR)""$(prefix)"/share
2>/dev
/null
184 -$(RMDIR
) "$(DESTDIR)""$(prefix)"/bin
2>/dev
/null
185 -$(RMDIR
) "$(DESTDIR)""$(prefix)" 2>/dev
/null
189 $(PYTEST
) $(PYTEST_FLAGS
) $(PYTHON_DIRS
)
193 $(PYTEST
) $(PYTEST_FLAGS
) --cov
=cola
$(PYTHON_DIRS
)
197 $(FIND
) $(ALL_PYTHON_DIRS
) -name
'*.py[cod]' -print0 | xargs
-0 rm -f
198 $(RM_R
) build
dist tags git-cola.app
200 $(MAKE
) -C share
/doc
/git-cola
clean
204 $(FIND
) $(ALL_PYTHON_DIRS
) -name
'*.py' -print0 | xargs
-0 $(CTAGS
) -f
tags
212 $(SETUP
) build_pot
--build-dir
=po
--no-lang
216 $(SETUP
) build_pot
--build-dir
=po
220 $(SETUP
) build_mo
--force
224 $(MKDIR_P
) $(cola_app
)/Contents
/MacOS
225 $(MKDIR_P
) $(cola_app
)/Contents
/Resources
226 $(CP
) contrib
/darwin
/Info.plist contrib
/darwin
/PkgInfo
$(cola_app
)/Contents
227 $(CP
) contrib
/darwin
/git-cola
$(cola_app
)/Contents
/MacOS
228 $(CP
) contrib
/darwin
/git-cola.icns
$(cola_app
)/Contents
/Resources
229 $(MAKE
) prefix=$(cola_app
)/Contents
/Resources
install install-doc
232 app-tarball
: git-cola.app
233 $(TAR
) czf
$(cola_dist
).app.
tar.gz
$(cola_app_base
)
236 # Preview the markdown using "make README.html"
241 $(FLAKE8
) $(FLAKE8_FLAGS
) $(PYTHON_SOURCES
) $(PYTHON_DIRS
)
245 $(PYLINT
) $(PYLINT_FLAGS
) --py3k
$(flags
) $(PYTHON_SOURCES
) $(ALL_PYTHON_DIRS
)
249 $(PYLINT
) $(PYLINT_FLAGS
) $(flags
) $(PYTHON_SOURCES
) $(ALL_PYTHON_DIRS
)
253 $(PYLINT
) $(PYLINT_FLAGS
) $(flags
) $(file
)
257 $(PIP
) install --requirement requirements
/requirements.txt
261 $(PIP
) install --requirement requirements
/requirements-dev.txt
262 .PHONY
: requirements-dev