Shawn O. Pearce | c20e283 | 2010-02-17 09:16:26 -0800 | [diff] [blame] | 1 | # 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. Pearce | c20e283 | 2010-02-17 09:16:26 -0800 | [diff] [blame] | 14 | |
Shawn O. Pearce | edd8ed3 | 2010-02-22 08:16:07 -0800 | [diff] [blame] | 15 | ASCIIDOC ?= asciidoc |
| 16 | ASCIIDOC_EXTRA ?= |
| 17 | SVN ?= svn |
| 18 | PUB_ROOT ?= https://gerrit.googlecode.com/svn/ReleaseNotes |
| 19 | |
| 20 | DOC_HTML := $(patsubst %.txt,%.html,$(wildcard ReleaseNotes*.txt)) |
| 21 | COMMIT := $(shell git describe HEAD | sed s/^v//) |
Shawn O. Pearce | c20e283 | 2010-02-17 09:16:26 -0800 | [diff] [blame] | 22 | SCRIPTSDIR := $(shell pwd)/../Documentation/javascript |
Shawn O. Pearce | edd8ed3 | 2010-02-22 08:16:07 -0800 | [diff] [blame] | 23 | LOCAL_ROOT := .published |
| 24 | PUB_DIR := $(PUB_ROOT) |
Shawn O. Pearce | c20e283 | 2010-02-17 09:16:26 -0800 | [diff] [blame] | 25 | |
| 26 | all: html |
| 27 | |
| 28 | html: index.html $(DOC_HTML) |
| 29 | |
| 30 | update: html |
Shawn O. Pearce | edd8ed3 | 2010-02-22 08:16:07 -0800 | [diff] [blame] | 31 | @-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. Pearce | c20e283 | 2010-02-17 09:16:26 -0800 | [diff] [blame] | 37 | 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. Pearce | edd8ed3 | 2010-02-22 08:16:07 -0800 | [diff] [blame] | 44 | echo "Committing release notes at v$(COMMIT)" && \ |
| 45 | $(SVN) commit -m "Updated release notes to v$(COMMIT)" |
| 46 | @-rm -rf $(LOCAL_ROOT) |
Shawn O. Pearce | c20e283 | 2010-02-17 09:16:26 -0800 | [diff] [blame] | 47 | |
| 48 | clean: |
| 49 | rm -f *.html |
| 50 | rm -rf $(LOCAL_ROOT) |
| 51 | |
| 52 | index.html: index.txt $(SCRIPTSDIR)/toc.js |
Shawn O. Pearce | edd8ed3 | 2010-02-22 08:16:07 -0800 | [diff] [blame] | 53 | @echo FORMAT $@ |
| 54 | @rm -f $@+ $@ |
| 55 | @$(ASCIIDOC) --unsafe \ |
Shawn O. Pearce | c20e283 | 2010-02-17 09:16:26 -0800 | [diff] [blame] | 56 | -a toc \ |
| 57 | -a 'scriptsdir=$(SCRIPTSDIR)' \ |
| 58 | -b xhtml11 -f asciidoc.conf \ |
| 59 | $(ASCIIDOC_EXTRA) -o $@+ $< |
Shawn O. Pearce | edd8ed3 | 2010-02-22 08:16:07 -0800 | [diff] [blame] | 60 | @mv $@+ $@ |
Shawn O. Pearce | c20e283 | 2010-02-17 09:16:26 -0800 | [diff] [blame] | 61 | |
| 62 | $(DOC_HTML): %.html : %.txt $(SCRIPTSDIR)/toc.js |
Shawn O. Pearce | edd8ed3 | 2010-02-22 08:16:07 -0800 | [diff] [blame] | 63 | @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. Pearce | c20e283 | 2010-02-17 09:16:26 -0800 | [diff] [blame] | 70 | -a toc \ |
| 71 | -a "revision=$$v" \ |
| 72 | -a 'scriptsdir=$(SCRIPTSDIR)' \ |
| 73 | -b xhtml11 -f asciidoc.conf \ |
| 74 | $(ASCIIDOC_EXTRA) -o $@+ $< |
Shawn O. Pearce | edd8ed3 | 2010-02-22 08:16:07 -0800 | [diff] [blame] | 75 | @mv $@+ $@ |