Makefile 3.67 KB
Newer Older
1
#
2
# makefile for reposurgeon
3
#
4 5 6

INSTALL=install
prefix?=/usr/local
7
mandir?=share/man
8 9
target=$(DESTDIR)$(prefix)

10
CYTHON?=cython
11
PYVERSION=2.7
12 13
pyinclude?=$(shell pkg-config --cflags python-$(PYVERSION) || echo "-I/usr/include/python$(PYVERSION)")
pylib?=$(shell pkg-config --libs python-$(PYVERSION) || echo "-l$python$(PYVERSION)")
14

Eric S. Raymond's avatar
Eric S. Raymond committed
15
VERS=$(shell sed <reposurgeon -n -e '/version=\(.*\)/s//\1/p')
16

Eric S. Raymond's avatar
Eric S. Raymond committed
17
SOURCES = README NEWS AUTHORS COPYING TODO
18 19
SOURCES += \
	reposurgeon reposurgeon.xml \
20
	repotool repotool.xml \
21
	repodiffer repodiffer.xml \
22
	conversion.mk features.asc \
23
	dvcs-migration-guide.asc \
24
	reposurgeon-mode.el
25
SOURCES += Makefile control reposturgeon.png
26

Eric S. Raymond's avatar
Eric S. Raymond committed
27 28
all: reposurgeon.1 repotool.1 repodiffer.1 \
     reposurgeon.html repotool.html repodiffer.html \
29
     dvcs-migration-guide.html features.html
30 31 32 33 34 35 36

reposurgeon.1: reposurgeon.xml
	xmlto man reposurgeon.xml

reposurgeon.html: reposurgeon.xml
	xmlto html-nochunks reposurgeon.xml

37 38
repotool.1: repotool.xml
	xmlto man repotool.xml
Eric S. Raymond's avatar
Eric S. Raymond committed
39

40 41
repotool.html: repotool.xml
	xmlto html-nochunks repotool.xml
Eric S. Raymond's avatar
Eric S. Raymond committed
42

43 44 45 46 47 48
repodiffer.1: repodiffer.xml
	xmlto man repodiffer.xml

repodiffer.html: repodiffer.xml
	xmlto html-nochunks repodiffer.xml

49 50 51
features.html: features.asc
	asciidoc features.asc

52 53 54
reporting-bugs.html: reporting-bugs.asc
	asciidoc reporting-bugs.asc

55 56 57
dvcs-migration-guide.html: dvcs-migration-guide.asc
	asciidoc -a toc dvcs-migration-guide.asc

58
cyreposurgeon: reposurgeon
59
	$(CYTHON) --embed reposurgeon -o cyreposurgeon.c
60 61
	${CC} ${CFLAGS} $(pyinclude) -c cyreposurgeon.c -o cyreposurgeon.o
	${CC} ${CFLAGS} ${LDFLAGS} cyreposurgeon.o $(pylib) -o cyreposurgeon
62

63 64 65
install: all
	$(INSTALL) -d "$(target)/bin"
	$(INSTALL) -d "$(target)/share/doc/reposurgeon"
66
	$(INSTALL) -d "$(target)/$(mandir)/man1"
Eric S. Raymond's avatar
Eric S. Raymond committed
67
	$(INSTALL) -m 755 reposurgeon repotool repodiffer "$(target)/bin"
68
	$(INSTALL) -m 644 README NEWS TODO conversion.mk *.html \
69
		"$(target)/share/doc/reposurgeon"
70
	$(INSTALL) -m 644 *.1 "$(target)/$(mandir)/man1"
71

72 73 74 75
install-cyreposurgeon: cyreposurgeon
	$(INSTALL) -d "$(target)/bin"
	$(INSTALL) -m 755 cyreposurgeon "$(target)/bin"

76
clean:
77
	rm -fr  *~ *.1 *.html *.tar.gz MANIFEST *.md5
78
	rm -fr .rs .rs* test/.rs test/.rs*
Eric S. Raymond's avatar
Eric S. Raymond committed
79
	rm -f typescript test/typescript *.pyc
80
	rm -f cyreposurgeon.c cyreposurgeon.o cyreposurgeon
81 82 83 84

reposurgeon-$(VERS).tar.gz: $(SOURCES)
	@ls $(SOURCES) | sed s:^:reposurgeon-$(VERS)/: >MANIFEST
	@(cd ..; ln -s reposurgeon reposurgeon-$(VERS))
Eric S. Raymond's avatar
Eric S. Raymond committed
85
	(cd ..; tar -czf reposurgeon/reposurgeon-$(VERS).tar.gz `cat reposurgeon/MANIFEST`)
86 87
	@(cd ..; rm reposurgeon-$(VERS))

Eric S. Raymond's avatar
Eric S. Raymond committed
88 89 90
version:
	@echo $(VERS)

91 92 93
COMMON_PYLINT = --rcfile=/dev/null --reports=n \
	--msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" \
	--dummy-variables-rgx='^_'
94
PYLINTOPTS1 = "C0103,C0111,C0301,C0302,C0322,C0324,C0325,C0321,C0323,C0330,C1001,R0201,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,W0108,W0110,W0123,W0141,W0142,W0212,W0233,W0603,W0632,W0640,W0511,W0611,E1101,E1103,E1124,I0011,F0401"
Eric S. Raymond's avatar
Eric S. Raymond committed
95
PYLINTOPTS2 = "C0103,C0111,C0301,C0326,C0330,C1001,W0603,W0621,E1101,E1103,R0902,R0903,R0912,R0914,R0915"
96
pylint:
97 98
	@pylint $(COMMON_PYLINT) --disable=$(PYLINTOPTS1) reposurgeon
	@pylint $(COMMON_PYLINT) --disable=$(PYLINTOPTS2) repodiffer
99

100
check:
101
	cd test; $(MAKE) --quiet
Eric S. Raymond's avatar
Eric S. Raymond committed
102

Eric S. Raymond's avatar
Eric S. Raymond committed
103
dist: reposurgeon-$(VERS).tar.gz reposurgeon.1 repotool.1 repodiffer.1
104

105 106 107
reposurgeon-$(VERS).md5: reposurgeon-$(VERS).tar.gz
	@md5sum reposurgeon-$(VERS).tar.gz >reposurgeon-$(VERS).md5

108
zip: $(SOURCES)
109
	zip -r reposurgeon-$(VERS).zip $(SOURCES)
110

111
release: reposurgeon-$(VERS).tar.gz reposurgeon-$(VERS).md5 reposurgeon.html repodiffer.html reporting-bugs.html dvcs-migration-guide.html features.html
112
	shipper version=$(VERS) | sh -e -x
113 114 115

refresh: reposurgeon.html repodiffer.html reporting-bugs.html features.html
	shipper -N -w version=$(VERS) | sh -e -x