Shawn O. Pearce | d03e5f9 | 2009-03-27 20:17:05 -0700 | [diff] [blame] | 1 | # 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. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 15 | DOC_HTML = $(patsubst %.txt,%.html,$(wildcard *.txt)) |
| 16 | ASCIIDOC = asciidoc |
| 17 | ASCIIDOC_EXTRA = |
Shawn O. Pearce | e43a8e6 | 2009-01-28 14:52:21 -0800 | [diff] [blame] | 18 | SVN = svn |
| 19 | PUB_ROOT = https://gerrit.googlecode.com/svn/documentation |
| 20 | LOCAL_ROOT = .published |
Shawn O. Pearce | 0d76085 | 2009-01-16 09:04:47 -0800 | [diff] [blame] | 21 | |
Shawn O. Pearce | e43a8e6 | 2009-01-28 14:52:21 -0800 | [diff] [blame] | 22 | DOC_VERS := $(shell git describe HEAD) |
| 23 | DOC_VMM := $(shell sh -c "echo $(DOC_VERS) | perl -pe 's,^v(\d+\.\d+)[\.-].*\$$,\$$1,'") |
| 24 | PUB_DIR = $(PUB_ROOT)/$(DOC_VMM) |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 25 | |
| 26 | all: html |
| 27 | |
| 28 | html: $(DOC_HTML) |
| 29 | |
Shawn O. Pearce | 0d76085 | 2009-01-16 09:04:47 -0800 | [diff] [blame] | 30 | update: html |
Shawn O. Pearce | e43a8e6 | 2009-01-28 14:52:21 -0800 | [diff] [blame] | 31 | -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. Pearce | 90ca58c | 2009-02-06 12:34:40 -0800 | [diff] [blame] | 40 | $(SVN) add $$a && \ |
| 41 | $(SVN) propset svn:mime-type text/html $$a ; \ |
Shawn O. Pearce | e43a8e6 | 2009-01-28 14:52:21 -0800 | [diff] [blame] | 42 | fi && \ |
| 43 | $(SVN) commit -m "Updated documentation $(DOC_VMM) to $(DOC_VERS)" |
| 44 | -rm -rf $(LOCAL_ROOT) |
| 45 | |
| 46 | new-docs: |
| 47 | $(SVN) mkdir -m "Create documentation $(DOC_VMM)" $(PUB_DIR) |
Shawn O. Pearce | 0d76085 | 2009-01-16 09:04:47 -0800 | [diff] [blame] | 48 | |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 49 | clean: |
Shawn O. Pearce | e43a8e6 | 2009-01-28 14:52:21 -0800 | [diff] [blame] | 50 | rm -f *.html |
| 51 | rm -rf $(LOCAL_ROOT) |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 52 | |
| 53 | $(DOC_HTML): %.html : %.txt |
Shawn O. Pearce | 0d76085 | 2009-01-16 09:04:47 -0800 | [diff] [blame] | 54 | rm -f $@+ $@ |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 55 | $(ASCIIDOC) \ |
Shawn O. Pearce | 4bc69e2 | 2009-05-08 18:14:52 -0700 | [diff] [blame] | 56 | -a toc -a 'revision=$(DOC_VERS)' \ |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 57 | -b xhtml11 -f asciidoc.conf \ |
| 58 | $(ASCIIDOC_EXTRA) -o $@+ $< |
| 59 | mv $@+ $@ |