travis: update pylint to the version in debian/sid
[git-cola.git] / Makefile
blob4a0cfa0dcea1ddaa9f9ac60ec44739154008b48a
1 # The default target of this Makefile is...
2 all::
4 # The external commands used by this Makefile are...
5 CTAGS = ctags
6 CP = cp
7 FIND = find
8 FLAKE8 = flake8
9 GIT = git
10 GZIP = gzip
11 LN = ln
12 LN_S = $(LN) -s -f
13 MARKDOWN = markdown
14 MKDIR_P = mkdir -p
15 NOSETESTS = nosetests
16 PYLINT = pylint
17 PYTHON = python
18 RM = rm -f
19 RM_R = rm -fr
20 RMDIR = rmdir
21 TAR = tar
23 # Flags
24 FLAKE8_FLAGS = --max-line-length=80 --statistics --doctests --format=pylint
25 PYLINT_FLAGS = --py3k --output-format=colorized --rcfile=.pylintrc
27 # These values can be overridden on the command-line or via config.mak
28 prefix = $(HOME)
29 bindir = $(prefix)/bin
30 datadir = $(prefix)/share/git-cola
31 coladir = $(datadir)/lib
32 hicolordir = $(prefix)/share/icons/hicolor/scalable/apps
33 darwin_python = /System/Library/Frameworks/Python.framework/Resources/Python.app/Contents/MacOS/Python
34 # DESTDIR =
36 cola_base := git-cola
37 cola_app_base= $(cola_base).app
38 cola_app = $(CURDIR)/$(cola_app_base)
39 cola_version = $(shell $(PYTHON) bin/git-cola version --brief)
40 cola_dist := $(cola_base)-$(cola_version)
42 # Allows e.g. "make test flags=--stop"
43 flags =
44 NOSE ?= $(NOSETESTS) --with-doctest --with-id --exclude=sphinxtogithub $(flags)
46 SETUP ?= $(PYTHON) setup.py
47 setup_args += --prefix=$(prefix)
48 setup_args += --quiet
49 setup_args += --force
50 setup_args += --install-scripts=$(bindir)
51 setup_args += --record=build/MANIFEST
52 setup_args += --install-lib=$(coladir)
53 ifdef DESTDIR
54 setup_args += --root=$(DESTDIR)
55 export DESTDIR
56 endif
57 export prefix
59 PYTHON_DIRS = cola
60 PYTHON_DIRS += test
62 ALL_PYTHON_DIRS = $(PYTHON_DIRS)
63 ALL_PYTHON_DIRS += extras
65 PYTHON_SOURCES = bin/git-cola
66 PYTHON_SOURCES += bin/git-dag
67 PYTHON_SOURCES += share/git-cola/bin/git-xbase
68 PYTHON_SOURCES += setup.py
70 # User customizations
71 -include config.mak
73 all:: build
74 .PHONY: all
76 build:
77 $(SETUP) build
78 .PHONY: build
80 install: all
81 $(SETUP) install $(setup_args)
82 $(MKDIR_P) $(DESTDIR)$(hicolordir)
83 $(LN_S) $(datadir)/icons/git-cola.svg $(DESTDIR)$(hicolordir)/git-cola.svg
84 $(LN_S) git-cola $(DESTDIR)$(bindir)/cola
85 $(RM_R) $(DESTDIR)$(coladir)/git_cola*
86 $(RM_R) git_cola.egg-info
87 .PHONY: install
89 # Maintainer's dist target
90 dist:
91 $(GIT) archive --format=tar --prefix=$(cola_dist)/ HEAD^{tree} | \
92 $(GZIP) -f -9 - >$(cola_dist).tar.gz
93 .PHONY: dist
95 doc:
96 $(MAKE) -C share/doc/git-cola all
97 .PHONY: doc
99 html:
100 $(MAKE) -C share/doc/git-cola html
101 .PHONY: html
103 man:
104 $(MAKE) -C share/doc/git-cola man
105 .PHONY: man
107 install-doc:
108 $(MAKE) -C share/doc/git-cola install
109 .PHONY: install-doc
111 install-html:
112 $(MAKE) -C share/doc/git-cola install-html
113 .PHONY: install-html
115 install-man:
116 $(MAKE) -C share/doc/git-cola install-man
117 .PHONY: install-man
119 uninstall:
120 $(RM) $(DESTDIR)$(prefix)/bin/git-cola
121 $(RM) $(DESTDIR)$(prefix)/bin/git-dag
122 $(RM) $(DESTDIR)$(prefix)/bin/cola
123 $(RM) $(DESTDIR)$(prefix)/share/applications/git-cola.desktop
124 $(RM) $(DESTDIR)$(prefix)/share/applications/git-cola-folder-handler.desktop
125 $(RM) $(DESTDIR)$(prefix)/share/applications/git-dag.desktop
126 $(RM) $(DESTDIR)$(prefix)/share/icons/hicolor/scalable/apps/git-cola.svg
127 $(RM_R) $(DESTDIR)$(prefix)/share/git-cola
128 $(RM_R) $(DESTDIR)$(prefix)/share/doc/git-cola
129 $(RM) $(DESTDIR)$(prefix)/share/locale/*/LC_MESSAGES/git-cola.mo
130 -$(RMDIR) $(DESTDIR)$(prefix)/share/locale/*/LC_MESSAGES 2>/dev/null
131 -$(RMDIR) $(DESTDIR)$(prefix)/share/locale/* 2>/dev/null
132 -$(RMDIR) $(DESTDIR)$(prefix)/share/locale 2>/dev/null
133 -$(RMDIR) $(DESTDIR)$(prefix)/share/doc 2>/dev/null
134 -$(RMDIR) $(DESTDIR)$(prefix)/share/applications 2>/dev/null
135 -$(RMDIR) $(DESTDIR)$(prefix)/share 2>/dev/null
136 -$(RMDIR) $(DESTDIR)$(prefix)/bin 2>/dev/null
137 -$(RMDIR) $(DESTDIR)$(prefix) 2>/dev/null
138 .PHONY: uninstall
140 test: all
141 $(NOSE) $(PYTHON_DIRS)
142 .PHONY: test
144 coverage:
145 $(NOSE) --with-coverage --cover-package=cola $(PYTHON_DIRS)
146 .PHONY: coverage
148 clean:
149 $(FIND) $(ALL_PYTHON_DIRS) -name '*.py[cod]' -print0 | xargs -0 rm -f
150 $(RM_R) build dist tags git-cola.app
151 $(RM_R) share/locale
152 $(MAKE) -C share/doc/git-cola clean
153 .PHONY: clean
155 tags:
156 $(FIND) $(ALL_PYTHON_DIRS) -name '*.py' -print0 | xargs -0 $(CTAGS) -f tags
157 .PHONY: tags
159 pot:
160 $(SETUP) build_pot -N -d po
161 .PHONY: pot
164 $(SETUP) build_mo -f
165 .PHONY: mo
167 git-cola.app:
168 $(MKDIR_P) $(cola_app)/Contents/MacOS
169 $(MKDIR_P) $(cola_app)/Contents/Resources
170 $(CP) contrib/darwin/Info.plist contrib/darwin/PkgInfo $(cola_app)/Contents
171 $(CP) contrib/darwin/git-cola $(cola_app)/Contents/MacOS
172 $(CP) contrib/darwin/git-cola.icns $(cola_app)/Contents/Resources
173 $(MAKE) prefix=$(cola_app)/Contents/Resources install install-doc
174 $(LN_S) $(darwin_python) $(cola_app)/Contents/Resources/git-cola
175 .PHONY: git-cola.app
177 app-tarball: git-cola.app
178 $(TAR) czf $(cola_dist).app.tar.gz $(cola_app_base)
179 .PHONY: app-tarball
181 # Preview the markdown using "make README.html"
182 %.html: %.md
183 $(MARKDOWN) $< >$@
185 flake8:
186 $(FLAKE8) $(FLAKE8_FLAGS) $(PYTHON_SOURCES) $(PYTHON_DIRS)
187 .PHONY: flake8
189 pylint:
190 $(PYLINT) $(PYLINT_FLAGS) $(PYTHON_SOURCES) $(ALL_PYTHON_DIRS)
191 .PHONY: pylint