-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
55 lines (43 loc) · 1.58 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
PYTHON=python3
NAME=milkcheck
VERSION=$(shell cd lib ; $(PYTHON) -c "from MilkCheck import __version__ ; print(__version__)")
TARBALL=$(NAME)-$(VERSION).tar.gz
SPECFILE=$(NAME).spec
RPMTOPDIR=$$PWD/RPMBUILD
TESTDIR=$$PWD/tests
MANPAGE=doc/$(NAME).8
MANSOURCE=doc/$(NAME).asciidoc
DESTDIR=/
MANDIR=/usr/share/man
SYSCONFIGDIR=/etc
VIMDATADIR=/usr/share/vim/vimfiles
all: $(MANPAGE)
$(PYTHON) setup.py build
install: all
$(PYTHON) setup.py install -O1 --skip-build --root $(DESTDIR)
# config files
install -d $(DESTDIR)/$(SYSCONFIGDIR)/$(NAME)/conf/samples
install -p -m 0644 conf/milkcheck.conf $(DESTDIR)/$(SYSCONFIGDIR)/$(NAME)
install -p -m 0644 conf/samples/*.yaml $(DESTDIR)/$(SYSCONFIGDIR)/$(NAME)/conf/samples
install -d $(DESTDIR)/$(MANDIR)/man8/
# doc files
install -p -m 0644 doc/*.8 $(DESTDIR)/$(MANDIR)/man8/
# vim files
install -d $(DESTDIR)/$(VIMDATADIR)/{ftdetect,syntax}
install -p -m 0644 doc/vim/ftdetect/milkcheck.vim $(DESTDIR)/$(VIMDATADIR)/ftdetect
install -p -m 0644 doc/vim/syntax/milkcheck.vim $(DESTDIR)/$(VIMDATADIR)/syntax
$(RPMTOPDIR):
mkdir -p $(RPMTOPDIR)/{BUILD,RPMS,SRPMS,SPECS}
rpm: $(TARBALL) $(SPECFILE) $(RPMTOPDIR) $(MANPAGE)
rpmbuild --define "_topdir $(RPMTOPDIR)" --define "__python_name $(PYTHON)" --define "_sourcedir $$PWD" -ba $(SPECFILE)
$(TARBALL):
git archive --prefix=$(NAME)-$(VERSION)/ HEAD | gzip -9 >$@
.PHONY: rpm clean all test doc
clean:
rm -f $(TARBALL) $(MANPAGE)
rm -rf $(RPMTOPDIR) build/
test:
export PYTHONPATH=$$PWD/lib/ ; nosetests --exe --all-modules -w tests
$(MANPAGE): $(MANSOURCE)
a2x -f manpage $<
doc: $(MANPAGE)