blob: 0b1f9849cf253e63b315f2d0b7244be2bf251f06 [file] [log] [blame]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -08001DOC_HTML = $(patsubst %.txt,%.html,$(wildcard *.txt))
2ASCIIDOC = asciidoc
3ASCIIDOC_EXTRA =
Shawn O. Pearcee43a8e62009-01-28 14:52:21 -08004SVN = svn
5PUB_ROOT = https://gerrit.googlecode.com/svn/documentation
6LOCAL_ROOT = .published
Shawn O. Pearce0d760852009-01-16 09:04:47 -08007
Shawn O. Pearcee43a8e62009-01-28 14:52:21 -08008DOC_VERS := $(shell git describe HEAD)
9DOC_VMM := $(shell sh -c "echo $(DOC_VERS) | perl -pe 's,^v(\d+\.\d+)[\.-].*\$$,\$$1,'")
10PUB_DIR = $(PUB_ROOT)/$(DOC_VMM)
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080011
12all: html
13
14html: $(DOC_HTML)
15
Shawn O. Pearce0d760852009-01-16 09:04:47 -080016update: html
Shawn O. Pearcee43a8e62009-01-28 14:52:21 -080017 -rm -rf $(LOCAL_ROOT)
18 $(SVN) checkout $(PUB_DIR) $(LOCAL_ROOT)
19 rm -f $(LOCAL_ROOT)/*.html
20 cp *.html $(LOCAL_ROOT)
21 cd $(LOCAL_ROOT) && \
22 r=`$(SVN) status | perl -ne 'print if s/^! *//' ` && \
23 if [ -n "$$r" ]; then $(SVN) rm $$r; fi && \
24 a=`$(SVN) status | perl -ne 'print if s/^\? *//' ` && \
25 if [ -n "$$a" ]; then \
26 $(SVN) add $$r && \
27 $(SVN) propset svn:mime-type text/html $$r ; \
28 fi && \
29 $(SVN) commit -m "Updated documentation $(DOC_VMM) to $(DOC_VERS)"
30 -rm -rf $(LOCAL_ROOT)
31
32new-docs:
33 $(SVN) mkdir -m "Create documentation $(DOC_VMM)" $(PUB_DIR)
Shawn O. Pearce0d760852009-01-16 09:04:47 -080034
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080035clean:
Shawn O. Pearcee43a8e62009-01-28 14:52:21 -080036 rm -f *.html
37 rm -rf $(LOCAL_ROOT)
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080038
39$(DOC_HTML): %.html : %.txt
Shawn O. Pearce0d760852009-01-16 09:04:47 -080040 rm -f $@+ $@
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080041 $(ASCIIDOC) \
42 -b xhtml11 -f asciidoc.conf \
43 $(ASCIIDOC_EXTRA) -o $@+ $<
44 mv $@+ $@