summaryrefslogtreecommitdiff
path: root/Makefile
blob: cc3f906102852ecfcaea93ef73055943487bf04b (plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# $Id: Makefile,v 1.29 2008-09-22 02:37:10 wohler Exp $
#
# Makefile for MH-E documentation.
#
# Note: most changes to this file should also be mirrored in the Makefiles in
# $(TOP)/src and $(TOP)/contrib.
#
TOP = ..

EMACS_SRC	= $(TOP)/src/emacs/trunk

DOC_DIR		= doc/misc

MH_E_DOC 	= $(DOC_DIR)/mh-e.texi

MH_E_ETC_EMACS 	=			\
	$(DOC_DIR)/ChangeLog		\
	$(DOC_DIR)/gpl.texi		\
	$(DOC_DIR)/doclicense.texi

MH_E_ETC 	= ChangeLog Makefile README

MH_E_DIST 	= $(MH_E_DOC) $(MH_E_ETC_EMACS) $(MH_E_ETC)

MAKEINFOINFOFLAGS = -I $(DOC_DIR) --output info/mh-e

MAKEINFOHTMLFLAGS = --html --output html

TEXI2PDFFLAGS 	= --quiet --clean

#
# User Targets
#

all: $(MH_E_DOC) clean info html pdf

$(MH_E_DOC): 
	ln -s $(EMACS_SRC)/doc

clean:
	$(RM) -r info html mh-e.html mh-e.pdf

info: info/mh-e

info/mh-e: $(MH_E_DOC)
	[ -d info ] || mkdir info
	$(RM) info/*
	makeinfo $(MAKEINFOINFOFLAGS) $<

html: html/index.html mh-e.html

html/index.html: $(MH_E_DOC)
	[ -d html ] || mkdir html
	$(RM) html/*
	makeinfo $(MAKEINFOHTMLFLAGS) $<

mh-e.html: $(MH_E_DOC)
	makeinfo --html --output $@ --no-split $<

pdf: mh-e.pdf

mh-e.pdf: $(MH_E_DOC)
	texi2pdf $(TEXI2PDFFLAGS) $<
	texi2pdf $(TEXI2PDFFLAGS) $<

#
# Maintainer Targets
#

# Tag the MH-E files that are checked out.
tag:
	@if [ "$$TAG" = "" ]; then \
	    echo "No tag found. Set TAG environment variable."; \
	    exit 1; \
	fi
	bzr tag $$TAG
	bzr tag --directory $(EMACS_SRC) $$TAG

# Create a distribution. 
dist: $(MH_E_DOC)
	@if [ "$$TAG" = "" ]; then \
	    echo "No tag found. Set TAG environment variable."; \
	    exit 1; \
	fi; \
	if ! bzr tags | grep -q $$TAG; then \
	    echo "Tag $$TAG not found"; \
	    exit 1; \
	fi; \
	tagVersion=`bzr tags | grep $$TAG | awk '{print $$2}'`; \
	workspaceVersion=`bzr version-info --custom --template="{revno}"`; \
	if [ $$tagVersion -ne $$workspaceVersion ]; then \
	    echo "Tag $$TAG version $$tagVersion does not match workspace version $$workspaceVersion"; \
	    exit 1; \
	fi; \
	LOG=/tmp/mh-e-doc.log; \
	bzr st > $$LOG; \
	if [ `cat $$LOG | wc -l` -gt 0 ]; then \
	    echo "There may not be any uncommitted changes when creating a distribution"; \
	    cat $$LOG; \
	    exit 1; \
	fi; \
	echo "Building $$TAG..."; \
	rm -rf $$TAG; \
	mkdir $$TAG; \
	cp --parents $(MH_E_DIST) $$TAG; \
	tar -czhf $$TAG.tgz $$TAG

# Update http://mh-e.sourceforge.net/manual/.
update-web-site: all
	rsync -vaz --delete mh-e.html mh-e.pdf html $$USER,mh-e@web.sourceforge.net:doc