.gitignore: add zip and tar
[git-cola.git] / Makefile
blobb6738523d0f524ead154f9935f202ca7edc07c2b
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 MKDIR_P = mkdir -p
12 NOSETESTS = nosetests
13 PYTHON = python
14 RM = rm -f
15 RM_R = rm -fr
16 RMDIR = rmdir
17 TAR = tar
19 # These values can be overridden on the command-line or via config.mak
20 prefix = $(HOME)
21 bindir = $(prefix)/bin
22 coladir = $(prefix)/share/git-cola/lib
23 darwin_python = /System/Library/Frameworks/Python.framework/Resources/Python.app/Contents/MacOS/Python
24 # DESTDIR =
26 cola_base := git-cola
27 cola_app_base= $(cola_base).app
28 cola_app = $(CURDIR)/$(cola_app_base)
29 cola_version = $(shell $(PYTHON) cola/version.py)
30 cola_dist := $(cola_base)-$(cola_version)
32 test_flags =
33 all_test_flags = --with-doctest --exclude=sphinxtogithub $(test_flags)
35 # User customizations
36 -include config.mak
38 setup_args = --prefix=$(prefix)
39 setup_args += --quiet
40 setup_args += --force
41 setup_args += --install-scripts=$(bindir)
42 setup_args += --record=build/MANIFEST
43 setup_args += --install-lib=$(coladir)
44 ifdef DESTDIR
45 setup_args += --root=$(DESTDIR)
46 export DESTDIR
47 endif
49 all::
50 $(PYTHON) setup.py build
52 install: all
53 $(PYTHON) setup.py install $(setup_args)
54 (cd $(DESTDIR)$(bindir) && \
55 ! test -e cola && $(LN) -s git-cola cola) || true
56 $(RM_R) $(DESTDIR)$(coladir)/git_cola*
57 $(RM_R) git_cola.egg-info
59 # Maintainer's dist target
60 dist:
61 $(GIT) archive --format=tar --prefix=$(cola_dist)/ HEAD^{tree} | \
62 $(GZIP) -f -9 - >$(cola_dist).tar.gz
64 doc:
65 $(MAKE) -C share/doc/git-cola prefix=$(prefix) all
67 html:
68 $(MAKE) -C share/doc/git-cola prefix=$(prefix) html
70 install-doc:
71 $(MAKE) -C share/doc/git-cola prefix=$(prefix) install
73 install-html:
74 $(MAKE) -C share/doc/git-cola prefix=$(prefix) install-html
76 uninstall:
77 $(RM) $(DESTDIR)$(prefix)/bin/git-cola
78 $(RM) $(DESTDIR)$(prefix)/bin/git-dag
79 $(RM) $(DESTDIR)$(prefix)/bin/cola
80 $(RM) $(DESTDIR)$(prefix)/share/applications/git-cola.desktop
81 $(RM) $(DESTDIR)$(prefix)/share/applications/git-dag.desktop
82 $(RM_R) $(DESTDIR)$(prefix)/share/git-cola
83 $(RM_R) $(DESTDIR)$(prefix)/share/doc/git-cola
84 $(RM) $(DESTDIR)$(prefix)/share/locale/*/LC_MESSAGES/git-cola.mo
85 $(RMDIR) $(DESTDIR)$(prefix)/share/locale/*/LC_MESSAGES 2>/dev/null || true
86 $(RMDIR) $(DESTDIR)$(prefix)/share/locale/* 2>/dev/null || true
87 $(RMDIR) $(DESTDIR)$(prefix)/share/locale 2>/dev/null || true
88 $(RMDIR) $(DESTDIR)$(prefix)/share/doc 2>/dev/null || true
89 $(RMDIR) $(DESTDIR)$(prefix)/share/applications 2>/dev/null || true
90 $(RMDIR) $(DESTDIR)$(prefix)/share 2>/dev/null || true
91 $(RMDIR) $(DESTDIR)$(prefix)/bin 2>/dev/null || true
92 $(RMDIR) $(DESTDIR)$(prefix) 2>/dev/null || true
94 test: all
95 $(NOSETESTS) $(all_test_flags)
97 coverage:
98 $(NOSETESTS) --with-coverage --cover-package=cola $(all_test_flags)
100 clean:
101 $(MAKE) -C share/doc/git-cola clean
102 $(FIND) . -name .noseids -print0 | xargs -0 rm -f
103 $(FIND) . -name '*.py[co]' -print0 | xargs -0 rm -f
104 $(RM_R) build dist tmp tags git-cola.app
105 $(RM_R) share/locale
107 tags:
108 $(FIND) . -name '*.py' -print0 | xargs -0 $(CTAGS) -f tags
110 pot:
111 $(PYTHON) setup.py build_pot -N -d .
114 $(PYTHON) setup.py build_mo -f
116 git-cola.app:
117 $(MKDIR_P) $(cola_app)/Contents/MacOS
118 $(MKDIR_P) $(cola_app)/Contents/Resources
119 $(CP) darwin/git-cola $(cola_app)/Contents/MacOS
120 $(CP) darwin/Info.plist darwin/PkgInfo $(cola_app)/Contents
121 $(MAKE) prefix=$(cola_app)/Contents/Resources install install-doc
122 $(CP) darwin/git-cola.icns $(cola_app)/Contents/Resources
123 $(LN) -sf $(darwin_python) $(cola_app)/Contents/Resources/git-cola
125 app-tarball: git-cola.app
126 $(TAR) czf $(cola_dist).app.tar.gz $(cola_app_base)
128 .PHONY: all install doc install-doc install-html test clean tags
129 .PHONY: git-cola.app app-tarball