Merge pull request #520 from bariscelik/master
[git-cola.git] / Makefile
blob0d98df244d92643dc87c360af8b1d4e755443aa3
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 GIT = git
9 GZIP = gzip
10 LN = ln
11 LN_S = $(LN) -s -f
12 MARKDOWN = markdown
13 MKDIR_P = mkdir -p
14 NOSETESTS = nosetests
15 PYTHON = python
16 RM = rm -f
17 RM_R = rm -fr
18 RMDIR = rmdir
19 TAR = tar
21 # These values can be overridden on the command-line or via config.mak
22 prefix = $(HOME)
23 bindir = $(prefix)/bin
24 datadir = $(prefix)/share/git-cola
25 coladir = $(datadir)/lib
26 hicolordir = $(prefix)/share/icons/hicolor/scalable/apps
27 darwin_python = /System/Library/Frameworks/Python.framework/Resources/Python.app/Contents/MacOS/Python
28 # DESTDIR =
30 cola_base := git-cola
31 cola_app_base= $(cola_base).app
32 cola_app = $(CURDIR)/$(cola_app_base)
33 cola_version = $(shell $(PYTHON) bin/git-cola version --brief)
34 cola_dist := $(cola_base)-$(cola_version)
36 # Allows e.g. "make test flags=--stop"
37 flags =
38 NOSE ?= $(NOSETESTS) --with-doctest --exclude=sphinxtogithub $(flags)
40 SETUP ?= $(PYTHON) setup.py
41 setup_args += --prefix=$(prefix)
42 setup_args += --quiet
43 setup_args += --force
44 setup_args += --install-scripts=$(bindir)
45 setup_args += --record=build/MANIFEST
46 setup_args += --install-lib=$(coladir)
47 ifdef DESTDIR
48 setup_args += --root=$(DESTDIR)
49 export DESTDIR
50 endif
51 export prefix
53 PYTHON_DIRS = test
54 PYTHON_DIRS += cola
56 # User customizations
57 -include config.mak
59 all:: build
60 .PHONY: all
62 build:
63 $(SETUP) build
64 .PHONY: build
66 install: all
67 $(SETUP) install $(setup_args)
68 $(MKDIR_P) $(DESTDIR)$(hicolordir)
69 $(LN_S) $(datadir)/icons/git-cola.svg $(DESTDIR)$(hicolordir)/git-cola.svg
70 $(LN_S) git-cola $(DESTDIR)$(bindir)/cola
71 $(RM_R) $(DESTDIR)$(coladir)/git_cola*
72 $(RM_R) git_cola.egg-info
73 .PHONY: install
75 # Maintainer's dist target
76 dist:
77 $(GIT) archive --format=tar --prefix=$(cola_dist)/ HEAD^{tree} | \
78 $(GZIP) -f -9 - >$(cola_dist).tar.gz
79 .PHONY: dist
81 doc:
82 $(MAKE) -C share/doc/git-cola all
83 .PHONY: doc
85 html:
86 $(MAKE) -C share/doc/git-cola html
87 .PHONY: html
89 man:
90 $(MAKE) -C share/doc/git-cola man
91 .PHONY: man
93 install-doc:
94 $(MAKE) -C share/doc/git-cola install
95 .PHONY: install-doc
97 install-html:
98 $(MAKE) -C share/doc/git-cola install-html
99 .PHONY: install-html
101 install-man:
102 $(MAKE) -C share/doc/git-cola install-man
103 .PHONY: install-man
105 uninstall:
106 $(RM) $(DESTDIR)$(prefix)/bin/git-cola
107 $(RM) $(DESTDIR)$(prefix)/bin/git-dag
108 $(RM) $(DESTDIR)$(prefix)/bin/cola
109 $(RM) $(DESTDIR)$(prefix)/share/applications/git-cola.desktop
110 $(RM) $(DESTDIR)$(prefix)/share/applications/git-cola-folder-handler.desktop
111 $(RM) $(DESTDIR)$(prefix)/share/applications/git-dag.desktop
112 $(RM) $(DESTDIR)$(prefix)/share/icons/hicolor/scalable/apps/git-cola.svg
113 $(RM_R) $(DESTDIR)$(prefix)/share/git-cola
114 $(RM_R) $(DESTDIR)$(prefix)/share/doc/git-cola
115 $(RM) $(DESTDIR)$(prefix)/share/locale/*/LC_MESSAGES/git-cola.mo
116 -$(RMDIR) $(DESTDIR)$(prefix)/share/locale/*/LC_MESSAGES 2>/dev/null
117 -$(RMDIR) $(DESTDIR)$(prefix)/share/locale/* 2>/dev/null
118 -$(RMDIR) $(DESTDIR)$(prefix)/share/locale 2>/dev/null
119 -$(RMDIR) $(DESTDIR)$(prefix)/share/doc 2>/dev/null
120 -$(RMDIR) $(DESTDIR)$(prefix)/share/applications 2>/dev/null
121 -$(RMDIR) $(DESTDIR)$(prefix)/share 2>/dev/null
122 -$(RMDIR) $(DESTDIR)$(prefix)/bin 2>/dev/null
123 -$(RMDIR) $(DESTDIR)$(prefix) 2>/dev/null
124 .PHONY: uninstall
126 test: all
127 $(NOSE) $(PYTHON_DIRS)
128 .PHONY: test
130 coverage:
131 $(NOSE) --with-coverage --cover-package=cola $(PYTHON_DIRS)
132 .PHONY: coverage
134 clean:
135 $(FIND) $(PYTHON_DIRS) -name '*.py[cod]' -print0 | xargs -0 rm -f
136 $(RM_R) build dist tags git-cola.app
137 $(RM_R) share/locale
138 $(MAKE) -C share/doc/git-cola clean
139 .PHONY: clean
141 tags:
142 $(FIND) $(PYTHON_DIRS) -name '*.py' -print0 | xargs -0 $(CTAGS) -f tags
143 .PHONY: tags
145 pot:
146 $(SETUP) build_pot -N -d po
147 .PHONY: pot
150 $(SETUP) build_mo -f
151 .PHONY: mo
153 git-cola.app:
154 $(MKDIR_P) $(cola_app)/Contents/MacOS
155 $(MKDIR_P) $(cola_app)/Contents/Resources
156 $(CP) contrib/darwin/Info.plist contrib/darwin/PkgInfo $(cola_app)/Contents
157 $(CP) contrib/darwin/git-cola $(cola_app)/Contents/MacOS
158 $(CP) contrib/darwin/git-cola.icns $(cola_app)/Contents/Resources
159 $(MAKE) prefix=$(cola_app)/Contents/Resources install install-doc
160 $(LN_S) $(darwin_python) $(cola_app)/Contents/Resources/git-cola
161 .PHONY: git-cola.app
163 app-tarball: git-cola.app
164 $(TAR) czf $(cola_dist).app.tar.gz $(cola_app_base)
165 .PHONY: app-tarball
167 # Preview the markdown using "make README.html"
168 %.html: %.md
169 $(MARKDOWN) $< >$@