Initial work at removing the root Makefile. Ugly setup.py. Probably not worth it...
[be.git] / Makefile
1 #! /usr/bin/make -f
2 # :vim: filetype=make : -*- makefile; coding: utf-8; -*-
3
4 # Makefile
5 # Part of Bugs Everywhere, a distributed bug tracking system.
6 #
7 # Copyright (C) 2008-2011 Anton Batenev <abbat@abbat>
8 #                         Ben Finney <benf@cybersource.com.au>
9 #                         Eric Kow <eric.kow@gmail.com>
10 #                         Gianluca Montecchi <gian@grys.it>
11 #                         W. Trevor King <wking@drexel.edu>
12 #
13 # This file is part of Bugs Everywhere.
14 #
15 # Bugs Everywhere is free software; you can redistribute it and/or modify it
16 # under the terms of the GNU General Public License as published by the
17 # Free Software Foundation, either version 2 of the License, or (at your
18 # option) any later version.
19 #
20 # Bugs Everywhere is distributed in the hope that it will be useful, but
21 # WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23 # General Public License for more details.
24 #
25 # You should have received a copy of the GNU General Public License
26 # along with Bugs Everywhere.  If not, see <http://www.gnu.org/licenses/>.
27
28 SHELL = /bin/bash
29 RM = /bin/rm
30 RST2MAN = /usr/bin/rst2man
31 RST2HTML = /usr/bin/rst2html
32
33 #PATH = /usr/bin:/bin  # must include sphinx-build for 'sphinx' target.
34
35 #PREFIX = /usr/local
36 PREFIX = ${HOME}
37 INSTALL_OPTIONS = "--prefix=${PREFIX}"
38
39 # Select the documentation you wish to build
40 DOC = sphinx man
41
42 # Directories with semantic meaning
43 DOC_DIR := doc
44 MAN_DIR := ${DOC_DIR}/man
45
46 MANPAGES = be.1
47 LIBBE_VERSION := libbe/_version.py
48 GENERATED_FILES := build $(LIBBE_VERSION)
49
50 MANPAGE_FILES = $(patsubst %,${MAN_DIR}/%,${MANPAGES})
51 MANPAGE_HTML =  $(patsubst %,${MAN_DIR}/%.html,${MANPAGES})
52 GENERATED_FILES += ${MANPAGE_FILES} ${MANPAGE_HTML}
53
54 \f
55 .PHONY: all
56 all: build
57
58 \f
59 .PHONY: build
60 build: $(LIBBE_VERSION)
61         python setup.py build
62
63 .PHONY: doc
64 doc: $(DOC)
65
66 .PHONY: install
67 install: build doc
68         python setup.py install ${INSTALL_OPTIONS}
69
70 test: build
71         python test.py
72
73 .PHONY: clean
74 clean:
75         $(RM) -rf ${GENERATED_FILES}
76         $(MAKE) -C ${DOC_DIR} clean
77
78 \f
79 .PHONY: libbe/_version.py
80 libbe/_version.py:
81         git log -1 --date=short --pretty='format:"Autogenerated by make libbe/_version.py"%nversion_info = {%n    "date":"%cd",%n    "revision":"%H",%n    "committer":"%cn"}%n' > $@
82
83 .PHONY: man
84 man: ${MANPAGE_FILES}
85
86 %.1: %.1.txt
87         $(RST2MAN) $< > $@
88 %.1.html: %.1.txt
89         $(RST2HTML) $< > $@
90
91 .PHONY: sphinx
92 sphinx:
93         $(MAKE) -C ${DOC_DIR} html