doc/relnotes: fix formatting for the Fixes item
[git-cola.git] / Makefile
blob0b83f1dc7a264cdfbf971687400d33b4c10c87cc
1 # The default target of this Makefile is...
2 all::
4 # Development
5 # -----------
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?
12 # Release Prep
13 # ------------
14 # make pot # update main translation template
15 # make po # merge translations
17 # Installation
18 # ------------
19 # make prefix=<path> install
20 # DESTDIR is also supported.
22 # The external commands used by this Makefile are...
23 CTAGS = ctags
24 CP = cp
25 FIND = find
26 FLAKE8 = flake8
27 GIT = git
28 GZIP = gzip
29 LN = ln
30 LN_S = $(LN) -s -f
31 MARKDOWN = markdown
32 MKDIR_P = mkdir -p
33 PIP = pip
34 PYLINT = pylint
35 PYTHON = python
36 PYTEST ?= py.test
37 RM = rm -f
38 RM_R = rm -fr
39 RMDIR = rmdir
40 TAR = tar
42 # Flags
43 # -----
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
48 ifdef V
49 VERBOSE = --verbose
50 ifeq ($(V),2)
51 TEST_VERBOSE = --verbose
52 endif
53 else
54 QUIET = --quiet
55 endif
56 PYTEST_FLAGS = $(QUIET) $(TEST_VERBOSE) --doctest-modules
57 FLAKE8_FLAGS = --max-line-length=80 --statistics --doctests --format=pylint
58 PYLINT_FLAGS = --rcfile=.pylintrc
59 ifdef color
60 PYLINT_FLAGS += --output-format=colorized
61 endif
62 ifdef flags
63 PYTEST_FLAGS += $(flags)
64 endif
66 # These values can be overridden on the command-line or via config.mak
67 prefix = $(HOME)
68 bindir = $(prefix)/bin
69 datadir = $(prefix)/share/git-cola
70 coladir = $(datadir)/lib
71 hicolordir = $(prefix)/share/icons/hicolor/scalable/apps
72 # DESTDIR =
74 cola_base := git-cola
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)
81 setup_args += --force
82 setup_args += --install-scripts=$(bindir)
83 setup_args += --record=build/MANIFEST
84 setup_args += --install-lib=$(coladir)
85 ifdef DESTDIR
86 setup_args += --root=$(DESTDIR)
87 export DESTDIR
88 endif
89 export prefix
91 # If NO_VENDOR_LIBS is specified on the command line then pass it to setup.py
92 ifdef NO_VENDOR_LIBS
93 setup_args += --no-vendor-libs
94 endif
96 PYTHON_DIRS = cola
97 PYTHON_DIRS += test
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
108 -include config.mak
110 all:: build
111 .PHONY: all
113 build_version:
114 @GIT=$(GIT) ./extras/generate-build-version.sh 2>/dev/null || true
115 .PHONY: build_version
117 build: build_version
118 $(SETUP) $(VERBOSE) build
119 .PHONY: build
121 install: all
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
128 .PHONY: install
130 # Maintainer's dist target
131 dist:
132 $(GIT) archive --format=tar --prefix=$(cola_dist)/ HEAD^{tree} | \
133 $(GZIP) -f -9 - >$(cola_dist).tar.gz
134 .PHONY: dist
136 doc:
137 $(MAKE) -C share/doc/git-cola all
138 .PHONY: doc
140 html:
141 $(MAKE) -C share/doc/git-cola html
142 .PHONY: html
144 man:
145 $(MAKE) -C share/doc/git-cola man
146 .PHONY: man
148 install-doc:
149 $(MAKE) -C share/doc/git-cola install
150 .PHONY: install-doc
152 install-html:
153 $(MAKE) -C share/doc/git-cola install-html
154 .PHONY: install-html
156 install-man:
157 $(MAKE) -C share/doc/git-cola install-man
158 .PHONY: install-man
160 uninstall:
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
186 .PHONY: uninstall
188 test: all
189 $(PYTEST) $(PYTEST_FLAGS) $(PYTHON_DIRS)
190 .PHONY: test
192 coverage:
193 $(PYTEST) $(PYTEST_FLAGS) --cov=cola $(PYTHON_DIRS)
194 .PHONY: coverage
196 clean:
197 $(FIND) $(ALL_PYTHON_DIRS) -name '*.py[cod]' -print0 | xargs -0 rm -f
198 $(RM_R) build dist tags git-cola.app
199 $(RM_R) share/locale
200 $(MAKE) -C share/doc/git-cola clean
201 .PHONY: clean
203 tags:
204 $(FIND) $(ALL_PYTHON_DIRS) -name '*.py' -print0 | xargs -0 $(CTAGS) -f tags
205 .PHONY: tags
207 # Update i18n files
208 i18n: pot mo
209 .PHONY: i18n
211 pot:
212 $(SETUP) build_pot --build-dir=po --no-lang
213 .PHONY: pot
216 $(SETUP) build_pot --build-dir=po
217 .PHONY: po
220 $(SETUP) build_mo --force
221 .PHONY: mo
223 git-cola.app:
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
230 .PHONY: git-cola.app
232 app-tarball: git-cola.app
233 $(TAR) czf $(cola_dist).app.tar.gz $(cola_app_base)
234 .PHONY: app-tarball
236 # Preview the markdown using "make README.html"
237 %.html: %.md
238 $(MARKDOWN) $< >$@
240 flake8:
241 $(FLAKE8) $(FLAKE8_FLAGS) $(PYTHON_SOURCES) $(PYTHON_DIRS)
242 .PHONY: flake8
244 pylint3k:
245 $(PYLINT) $(PYLINT_FLAGS) --py3k $(flags) $(PYTHON_SOURCES) $(ALL_PYTHON_DIRS)
246 .PHONY: pylint3k
248 pylint:
249 $(PYLINT) $(PYLINT_FLAGS) $(flags) $(PYTHON_SOURCES) $(ALL_PYTHON_DIRS)
250 .PHONY: pylint
252 pylint-check:
253 $(PYLINT) $(PYLINT_FLAGS) $(flags) $(file)
254 .PHONY: pylint-check
256 requirements:
257 $(PIP) install --requirement requirements/requirements.txt
258 .PHONY: requirements
260 requirements-dev:
261 $(PIP) install --requirement requirements/requirements-dev.txt
262 .PHONY: requirements-dev