summaryrefslogtreecommitdiff
path: root/Makefile
blob: 6d0507261d98f6c48ebba75b61f1d1521fea867e (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
all:

GIT = git
GZIP = gzip
TAR = tar
PYTHON = python

DOC_RSYNC_FLAGS=-rvzPp --chmod=Dg+s,ug+rwX,o=rX --delete

XMLS = $(wildcard spec/*.xml)
TEMPLATES = $(wildcard doc/templates/*)

VERSION := $(shell sed -ne s'!<tp:version>\(.*\)</tp:version>!\1!p' spec/all.xml)
DISTNAME := telepathy-spec-$(VERSION)

GENERATED_FILES = \
	doc/spec/index.html \
	FIXME.out \
	doc/spec/NEWS \
	$(NULL)

doc/spec/NEWS: NEWS
	install -m644 $< $@

doc/spec/index.html: $(XMLS) tools/doc-generator.py tools/specparser.py $(TEMPLATES)
	rm -rf doc/spec
	install -d doc/spec
	$(PYTHON) tools/doc-generator.py spec/all.xml doc/spec/ telepathy-spec \
		im.telepathy1

all: $(GENERATED_FILES)
	@echo "Your spec HTML starts at:"
	@echo
	@echo file://$(CURDIR)/doc/spec/index.html
	@echo

CHECK_FOR_UNRELEASED = NEWS $(filter-out spec/template.xml,$(XMLS))

check: all FIXME.out
	$(PYTHON) test/test-specparser.py
	@case "$(VERSION)" in \
		*.*.*.*) ;; \
		*) \
			echo "Grepping spec for UNRELEASED..."; \
			if grep -r UNRELEASED $(CHECK_FOR_UNRELEASED); \
			then \
				echo "^^^ This is meant to be a release, but some files say UNRELEASED" >&2; \
				exit 2; \
			fi \
			;; \
	esac

FIXME.out: $(XMLS)
	@echo '  GEN   ' $@
	@egrep -A 5 '[F]IXME|[T]ODO|[X]XX' $(XMLS) \
		> FIXME.out || true

clean:
	rm -f $(GENERATED_FILES)
	rm -rf test/output
	rm -rf tmp
	rm -rf doc/spec

maintainer-upload-snapshot: doc/spec/index.html
	@install -d tmp
	rsync $(DOC_RSYNC_FLAGS) doc/spec/ telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/spec-next/
	@echo "The 'next' snapshot lives at:"
	@echo '  ' http://telepathy.freedesktop.org/spec-next/

maintainer-upload-release: doc/spec/index.html check
	@install -d tmp
	@if ! echo $(VERSION) | egrep '[0-9]+\.[0-9]+\.[0-9]+'; then \
		echo $(VERSION) 'does not look like a spec release'; \
		exit 1; \
	fi
	test -f telepathy-spec-$(VERSION).tar.gz
	test -f telepathy-spec-$(VERSION).tar.gz.asc
	gpg --verify telepathy-spec-$(VERSION).tar.gz.asc
	rsync -vzP telepathy-spec-$(VERSION).tar.gz telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/telepathy-spec/
	rsync -vzP telepathy-spec-$(VERSION).tar.gz.asc telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/releases/telepathy-spec/
	rsync $(DOC_RSYNC_FLAGS) doc/spec/ telepathy.freedesktop.org:/srv/telepathy.freedesktop.org/www/spec-next/

dist: check
	@install -d tmp
	rm -f tmp/ChangeLog "$(DISTNAME)".tar "$(DISTNAME)".tar.gz
	$(GIT) archive --format=tar --prefix="$(DISTNAME)"/ "HEAD^{tree}" \
		> "$(DISTNAME)".tar
	rm -rf tmp/"$(DISTNAME)"
	mkdir tmp/"$(DISTNAME)"
	$(GIT) log telepathy-spec-0.16.0.. > tmp/"$(DISTNAME)"/ChangeLog
	$(TAR) -rf "$(DISTNAME)".tar -C tmp --owner 0 --group 0 --mode 0664 \
		"$(DISTNAME)"/ChangeLog
	$(GZIP) -9 "$(DISTNAME)".tar
	rm -rf tmp/"$(DISTNAME)"

BRANCH = $(shell sh tools/git-which-branch.sh misc | tr -d '\n' | tr -C "[:alnum:]" _)
UPLOAD_BRANCH_HOST = people.freedesktop.org
UPLOAD_BRANCH_TO = $(UPLOAD_BRANCH_HOST):public_html/telepathy-spec

# Usage: make upload-branch BRANCH=discussion
upload-branch: all
	rsync -rzvP --delete doc/spec \
		$(UPLOAD_BRANCH_TO)-$(BRANCH)/
	@echo Your spec branch might be at:
	@echo '  ' http://$(UPLOAD_BRANCH_HOST)/~$$USER/telepathy-spec-$(BRANCH)/spec/

# automake requires these rules for anything that's in DIST_SUBDIRS
distclean: clean
maintainer-clean: clean
distdir:
	@echo distdir not implemented yet; exit 1

.PHONY: \
    all \
    check \
    clean \
    dist \
    distclean \
    distdir \
    maintainer-clean \
    maintainer-upload-release \
    maintainer-upload-snapshot \
    upload-branch \
    $(NULL)