blob: 89d2e51b531c74c9061c4c19fb9b4d2c9970809e [file] [log] [blame]
Shawn O. Pearced03e5f92009-03-27 20:17:05 -07001# Copyright (C) 2009 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.
14#
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080015DOC_HTML = $(patsubst %.txt,%.html,$(wildcard *.txt))
16ASCIIDOC = asciidoc
17ASCIIDOC_EXTRA =
Shawn O. Pearcee43a8e62009-01-28 14:52:21 -080018SVN = svn
19PUB_ROOT = https://gerrit.googlecode.com/svn/documentation
20LOCAL_ROOT = .published
Shawn O. Pearce0d760852009-01-16 09:04:47 -080021
Shawn O. Pearcee43a8e62009-01-28 14:52:21 -080022DOC_VERS := $(shell git describe HEAD)
23DOC_VMM := $(shell sh -c "echo $(DOC_VERS) | perl -pe 's,^v(\d+\.\d+)[\.-].*\$$,\$$1,'")
24PUB_DIR = $(PUB_ROOT)/$(DOC_VMM)
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080025
26all: html
27
28html: $(DOC_HTML)
29
Shawn O. Pearce0d760852009-01-16 09:04:47 -080030update: html
Shawn O. Pearcee43a8e62009-01-28 14:52:21 -080031 -rm -rf $(LOCAL_ROOT)
32 $(SVN) checkout $(PUB_DIR) $(LOCAL_ROOT)
33 rm -f $(LOCAL_ROOT)/*.html
34 cp *.html $(LOCAL_ROOT)
35 cd $(LOCAL_ROOT) && \
36 r=`$(SVN) status | perl -ne 'print if s/^! *//' ` && \
37 if [ -n "$$r" ]; then $(SVN) rm $$r; fi && \
38 a=`$(SVN) status | perl -ne 'print if s/^\? *//' ` && \
39 if [ -n "$$a" ]; then \
Shawn O. Pearce90ca58c2009-02-06 12:34:40 -080040 $(SVN) add $$a && \
41 $(SVN) propset svn:mime-type text/html $$a ; \
Shawn O. Pearcee43a8e62009-01-28 14:52:21 -080042 fi && \
43 $(SVN) commit -m "Updated documentation $(DOC_VMM) to $(DOC_VERS)"
44 -rm -rf $(LOCAL_ROOT)
45
46new-docs:
47 $(SVN) mkdir -m "Create documentation $(DOC_VMM)" $(PUB_DIR)
Shawn O. Pearce0d760852009-01-16 09:04:47 -080048
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080049clean:
Shawn O. Pearcee43a8e62009-01-28 14:52:21 -080050 rm -f *.html
51 rm -rf $(LOCAL_ROOT)
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080052
53$(DOC_HTML): %.html : %.txt
Shawn O. Pearce0d760852009-01-16 09:04:47 -080054 rm -f $@+ $@
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080055 $(ASCIIDOC) \
Shawn O. Pearce4bc69e22009-05-08 18:14:52 -070056 -a toc -a 'revision=$(DOC_VERS)' \
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080057 -b xhtml11 -f asciidoc.conf \
58 $(ASCIIDOC_EXTRA) -o $@+ $<
59 mv $@+ $@