dag: change initial frontier selection heuristic
[git-cola.git] / Makefile
blob6a14206f9b652418efdcc1444b91f3795122af44
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 PIP = pip
17 PYLINT = pylint
18 PYTHON = python
19 PYTHON_CONFIG = python-config
20 PYTHON_DARWIN_APP = $(shell $(PYTHON_CONFIG) --prefix)/Resources/Python.app/Contents/MacOS/Python
21 RM = rm -f
22 RM_R = rm -fr
23 RMDIR = rmdir
24 TAR = tar
26 # Flags
27 FLAKE8_FLAGS = --max-line-length=80 --statistics --doctests --format=pylint
28 PYLINT_FLAGS = --rcfile=.pylintrc
29 ifdef color
30 PYLINT_FLAGS += --output-format=colorized
31 endif
33 # These values can be overridden on the command-line or via config.mak
34 prefix = $(HOME)
35 bindir = $(prefix)/bin
36 datadir = $(prefix)/share/git-cola
37 coladir = $(datadir)/lib
38 hicolordir = $(prefix)/share/icons/hicolor/scalable/apps
39 # DESTDIR =
41 cola_base := git-cola
42 cola_app_base= $(cola_base).app
43 cola_app = $(CURDIR)/$(cola_app_base)
44 cola_version = $(shell $(PYTHON) bin/git-cola version --brief)
45 cola_dist := $(cola_base)-$(cola_version)
47 NOSE_FLAGS = --with-doctest
48 NOSE_FLAGS += --with-id
49 NOSE_FLAGS += --exclude=sphinxtogithub
50 NOSE_FLAGS += --exclude=extras
51 # Allows "make test flags=--stop"
52 flags =
53 NOSE ?= $(NOSETESTS) $(NOSE_FLAGS) $(flags)
55 SETUP ?= $(PYTHON) setup.py
56 setup_args += --prefix=$(prefix)
57 setup_args += --quiet
58 setup_args += --force
59 setup_args += --install-scripts=$(bindir)
60 setup_args += --record=build/MANIFEST
61 setup_args += --install-lib=$(coladir)
62 ifdef DESTDIR
63 setup_args += --root=$(DESTDIR)
64 export DESTDIR
65 endif
66 export prefix
68 # If NO_VENDOR_LIBS is specified on the command line then pass it to setup.py
69 ifdef NO_VENDOR_LIBS
70 setup_args += --no-vendor-libs
71 endif
73 PYTHON_DIRS = cola
74 PYTHON_DIRS += test
76 ALL_PYTHON_DIRS = $(PYTHON_DIRS)
77 ALL_PYTHON_DIRS += extras
79 PYTHON_SOURCES = bin/git-cola
80 PYTHON_SOURCES += bin/git-dag
81 PYTHON_SOURCES += share/git-cola/bin/git-xbase
82 PYTHON_SOURCES += setup.py
84 # User customizations
85 -include config.mak
87 all:: build
88 .PHONY: all
90 build:
91 $(SETUP) build
92 .PHONY: build
94 install: all
95 $(SETUP) install $(setup_args)
96 $(MKDIR_P) $(DESTDIR)$(hicolordir)
97 $(LN_S) $(datadir)/icons/git-cola.svg $(DESTDIR)$(hicolordir)/git-cola.svg
98 $(LN_S) git-cola $(DESTDIR)$(bindir)/cola
99 $(RM_R) $(DESTDIR)$(coladir)/git_cola*
100 $(RM_R) git_cola.egg-info
101 .PHONY: install
103 # Maintainer's dist target
104 dist:
105 $(GIT) archive --format=tar --prefix=$(cola_dist)/ HEAD^{tree} | \
106 $(GZIP) -f -9 - >$(cola_dist).tar.gz
107 .PHONY: dist
109 doc:
110 $(MAKE) -C share/doc/git-cola all
111 .PHONY: doc
113 html:
114 $(MAKE) -C share/doc/git-cola html
115 .PHONY: html
117 man:
118 $(MAKE) -C share/doc/git-cola man
119 .PHONY: man
121 install-doc:
122 $(MAKE) -C share/doc/git-cola install
123 .PHONY: install-doc
125 install-html:
126 $(MAKE) -C share/doc/git-cola install-html
127 .PHONY: install-html
129 install-man:
130 $(MAKE) -C share/doc/git-cola install-man
131 .PHONY: install-man
133 uninstall:
134 $(RM) $(DESTDIR)$(prefix)/bin/git-cola
135 $(RM) $(DESTDIR)$(prefix)/bin/git-dag
136 $(RM) $(DESTDIR)$(prefix)/bin/cola
137 $(RM) $(DESTDIR)$(prefix)/share/applications/git-cola.desktop
138 $(RM) $(DESTDIR)$(prefix)/share/applications/git-cola-folder-handler.desktop
139 $(RM) $(DESTDIR)$(prefix)/share/applications/git-dag.desktop
140 $(RM) $(DESTDIR)$(prefix)/share/appdata/git-dag.appdata.xml
141 $(RM) $(DESTDIR)$(prefix)/share/appdata/git-cola.appdata.xml
142 $(RM) $(DESTDIR)$(prefix)/share/icons/hicolor/scalable/apps/git-cola.svg
143 $(RM_R) $(DESTDIR)$(prefix)/share/doc/git-cola
144 $(RM_R) $(DESTDIR)$(prefix)/share/git-cola
145 $(RM) $(DESTDIR)$(prefix)/share/locale/*/LC_MESSAGES/git-cola.mo
146 -$(RMDIR) $(DESTDIR)$(prefix)/share/applications 2>/dev/null
147 -$(RMDIR) $(DESTDIR)$(prefix)/share/appdata 2>/dev/null
148 -$(RMDIR) $(DESTDIR)$(prefix)/share/doc 2>/dev/null
149 -$(RMDIR) $(DESTDIR)$(prefix)/share/locale/*/LC_MESSAGES 2>/dev/null
150 -$(RMDIR) $(DESTDIR)$(prefix)/share/locale/* 2>/dev/null
151 -$(RMDIR) $(DESTDIR)$(prefix)/share/locale 2>/dev/null
152 -$(RMDIR) $(DESTDIR)$(prefix)/share/icons/hicolor/scalable/apps 2>/dev/null
153 -$(RMDIR) $(DESTDIR)$(prefix)/share/icons/hicolor/scalable 2>/dev/null
154 -$(RMDIR) $(DESTDIR)$(prefix)/share/icons/hicolor 2>/dev/null
155 -$(RMDIR) $(DESTDIR)$(prefix)/share/icons 2>/dev/null
156 -$(RMDIR) $(DESTDIR)$(prefix)/share 2>/dev/null
157 -$(RMDIR) $(DESTDIR)$(prefix)/bin 2>/dev/null
158 -$(RMDIR) $(DESTDIR)$(prefix) 2>/dev/null
159 .PHONY: uninstall
161 test: all
162 $(NOSE) $(PYTHON_DIRS)
163 .PHONY: test
165 coverage:
166 $(NOSE) --with-coverage --cover-package=cola $(PYTHON_DIRS)
167 .PHONY: coverage
169 clean:
170 $(FIND) $(ALL_PYTHON_DIRS) -name '*.py[cod]' -print0 | xargs -0 rm -f
171 $(RM_R) build dist tags git-cola.app
172 $(RM_R) share/locale
173 $(MAKE) -C share/doc/git-cola clean
174 .PHONY: clean
176 tags:
177 $(FIND) $(ALL_PYTHON_DIRS) -name '*.py' -print0 | xargs -0 $(CTAGS) -f tags
178 .PHONY: tags
180 # Update i18n files
181 i18n: mo pot
182 .PHONY: i18n
184 i18n-update: i18n
185 git add po
186 git commit -sm'i18n: update translation template'
187 .PHONY: i18n-update
189 pot:
190 $(SETUP) build_pot --no-lang --build-dir=po
191 .PHONY: pot
194 $(SETUP) build_mo --force
195 .PHONY: mo
197 git-cola.app:
198 $(MKDIR_P) $(cola_app)/Contents/MacOS
199 $(MKDIR_P) $(cola_app)/Contents/Resources
200 $(CP) contrib/darwin/Info.plist contrib/darwin/PkgInfo $(cola_app)/Contents
201 $(CP) contrib/darwin/git-cola $(cola_app)/Contents/MacOS
202 $(CP) contrib/darwin/git-cola.icns $(cola_app)/Contents/Resources
203 $(MAKE) prefix=$(cola_app)/Contents/Resources install install-doc
204 $(LN_S) $(PYTHON_DARWIN_APP) $(cola_app)/Contents/Resources/git-cola
205 .PHONY: git-cola.app
207 app-tarball: git-cola.app
208 $(TAR) czf $(cola_dist).app.tar.gz $(cola_app_base)
209 .PHONY: app-tarball
211 # Preview the markdown using "make README.html"
212 %.html: %.md
213 $(MARKDOWN) $< >$@
215 flake8:
216 $(FLAKE8) $(FLAKE8_FLAGS) $(PYTHON_SOURCES) $(PYTHON_DIRS)
217 .PHONY: flake8
219 pylint3k:
220 $(PYLINT) $(PYLINT_FLAGS) --py3k $(flags) $(PYTHON_SOURCES) $(ALL_PYTHON_DIRS)
221 .PHONY: pylint3k
223 pylint:
224 $(PYLINT) $(PYLINT_FLAGS) $(flags) $(PYTHON_SOURCES) $(ALL_PYTHON_DIRS)
225 .PHONY: pylint
227 pylint-check:
228 $(PYLINT) $(PYLINT_FLAGS) $(flags) $(file)
229 .PHONY: pylint-check
231 requirements:
232 $(PIP) install --requirement requirements.txt
233 $(PIP) install --requirement extras/requirements-dev.txt
234 .PHONY: requirements