blob: c9c7c17fe2d93867c4629bfdc83722a14f93688f [file] [log] [blame]
Shawn O. Pearcec20e2832010-02-17 09:16:26 -08001# Copyright (C) 2010 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Shawn O. Pearcec20e2832010-02-17 09:16:26 -080014
Shawn O. Pearceedd8ed32010-02-22 08:16:07 -080015ASCIIDOC ?= asciidoc
16ASCIIDOC_EXTRA ?=
17SVN ?= svn
18PUB_ROOT ?= https://gerrit.googlecode.com/svn/ReleaseNotes
19
20DOC_HTML := $(patsubst %.txt,%.html,$(wildcard ReleaseNotes*.txt))
21COMMIT := $(shell git describe HEAD | sed s/^v//)
Shawn O. Pearcec20e2832010-02-17 09:16:26 -080022SCRIPTSDIR := $(shell pwd)/../Documentation/javascript
Shawn O. Pearceedd8ed32010-02-22 08:16:07 -080023LOCAL_ROOT := .published
24PUB_DIR := $(PUB_ROOT)
Shawn O. Pearcec20e2832010-02-17 09:16:26 -080025
26all: html
27
28html: index.html $(DOC_HTML)
29
30update: html
Shawn O. Pearceedd8ed32010-02-22 08:16:07 -080031 @-rm -rf $(LOCAL_ROOT)
32 @echo "Checking out current release notes"
33 @$(SVN) checkout $(PUB_DIR) $(LOCAL_ROOT)
34 @rm -f $(LOCAL_ROOT)/*.html
35 @cp *.html $(LOCAL_ROOT)
36 @cd $(LOCAL_ROOT) && \
Shawn O. Pearcec20e2832010-02-17 09:16:26 -080037 r=`$(SVN) status | perl -ne 'print if s/^! *//' ` && \
38 if [ -n "$$r" ]; then $(SVN) rm $$r; fi && \
39 a=`$(SVN) status | perl -ne 'print if s/^\? *//' ` && \
40 if [ -n "$$a" ]; then \
41 $(SVN) add $$a && \
42 $(SVN) propset svn:mime-type text/html $$a ; \
43 fi && \
Shawn O. Pearceedd8ed32010-02-22 08:16:07 -080044 echo "Committing release notes at v$(COMMIT)" && \
45 $(SVN) commit -m "Updated release notes to v$(COMMIT)"
46 @-rm -rf $(LOCAL_ROOT)
Shawn O. Pearcec20e2832010-02-17 09:16:26 -080047
48clean:
49 rm -f *.html
50 rm -rf $(LOCAL_ROOT)
51
52index.html: index.txt $(SCRIPTSDIR)/toc.js
Shawn O. Pearceedd8ed32010-02-22 08:16:07 -080053 @echo FORMAT $@
54 @rm -f $@+ $@
55 @$(ASCIIDOC) --unsafe \
Shawn O. Pearcec20e2832010-02-17 09:16:26 -080056 -a toc \
57 -a 'scriptsdir=$(SCRIPTSDIR)' \
58 -b xhtml11 -f asciidoc.conf \
59 $(ASCIIDOC_EXTRA) -o $@+ $<
Shawn O. Pearceedd8ed32010-02-22 08:16:07 -080060 @mv $@+ $@
Shawn O. Pearcec20e2832010-02-17 09:16:26 -080061
62$(DOC_HTML): %.html : %.txt $(SCRIPTSDIR)/toc.js
Shawn O. Pearceedd8ed32010-02-22 08:16:07 -080063 @echo FORMAT $@
64 @rm -f $@+ $@
65 @v=$$(echo $< | sed 's/^ReleaseNotes-//;s/.txt$$//;') && \
66 c=$$(git rev-list -1 HEAD -- $<) && \
67 n=$$(git describe $$c) && \
68 if [ "X$$n" != "Xv$$v" ]; then v="$$v (from $$n)"; fi && \
69 $(ASCIIDOC) --unsafe \
Shawn O. Pearcec20e2832010-02-17 09:16:26 -080070 -a toc \
71 -a "revision=$$v" \
72 -a 'scriptsdir=$(SCRIPTSDIR)' \
73 -b xhtml11 -f asciidoc.conf \
74 $(ASCIIDOC_EXTRA) -o $@+ $<
Shawn O. Pearceedd8ed32010-02-22 08:16:07 -080075 @mv $@+ $@