2007-07-18 17:21:52 +04:00
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
# Part of Equinox Desktop Environment (EDE).
|
|
|
|
# Copyright (c) 2000-2007 EDE Authors.
|
|
|
|
#
|
|
|
|
# This program is licensed under terms of the
|
|
|
|
# GNU General Public License version 2 or newer.
|
|
|
|
# See COPYING for details.
|
|
|
|
|
2008-09-04 14:16:55 +04:00
|
|
|
ASCIIDOC = "$(TOP)/doc/asciidoc/asciidoc.py" ;
|
|
|
|
DOCDIR = "$(TOP)/doc" ;
|
2007-07-18 17:21:52 +04:00
|
|
|
MANUALDIR = "$(DOCDIR)/manual" ;
|
|
|
|
|
2008-09-04 14:16:55 +04:00
|
|
|
# Must be relative to "doc" dir
|
2007-07-18 21:32:49 +04:00
|
|
|
MANUALICONS = "images" ;
|
2007-07-18 17:21:52 +04:00
|
|
|
|
2008-08-05 18:28:46 +04:00
|
|
|
# EdeManual [file] : [optinal-images] : "make-toc" ;
|
2007-07-18 21:32:49 +04:00
|
|
|
# Creates [file].html via asciidoc. If [optinal-images] are
|
|
|
|
# given, they will be copied in $(DOCICONS).
|
2007-07-18 17:21:52 +04:00
|
|
|
rule EdeManual
|
|
|
|
{
|
|
|
|
if ! $(ASCIIDOC) {
|
|
|
|
Echo "ASCIIDOC not defined; documentation will not be built !" ;
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
|
2008-08-05 18:28:46 +04:00
|
|
|
# see if we have tidy installed
|
|
|
|
local tidy_paths = [ Glob $(PATH) : tidy ] ;
|
|
|
|
|
2007-07-18 17:21:52 +04:00
|
|
|
local html_ext = ".html" ;
|
|
|
|
local path = $(SEARCH_SOURCE) ;
|
|
|
|
|
|
|
|
local i source target ;
|
|
|
|
for i in $(<) {
|
|
|
|
source = [ FFileName $(path) $(i) ] ;
|
|
|
|
# strip directory part so we can prepend
|
|
|
|
# another one (used as output directory)
|
|
|
|
target = $(source:D=) ;
|
|
|
|
|
|
|
|
# set output extension (asciidoc does not do that)
|
|
|
|
# and grist to prevent collision
|
|
|
|
target = $(target:S=$(html_ext):G="$(target)-html") ;
|
|
|
|
|
2007-09-28 18:08:59 +04:00
|
|
|
LocalDepends $(target) : $(source) ;
|
|
|
|
LocalDepends all : $(target) ;
|
|
|
|
LocalDepends doc : $(target) ;
|
2007-07-18 17:21:52 +04:00
|
|
|
|
|
|
|
# set output to $(MANUALDIR) directory
|
|
|
|
MakeLocate $(target) : $(MANUALDIR) ;
|
|
|
|
|
2008-08-05 18:28:46 +04:00
|
|
|
# a hack to create Table of Content
|
|
|
|
# seems that this is the only way asciidoc can do it
|
|
|
|
if $(3) = "make-toc" {
|
|
|
|
TOC_FLAG on $(target) = "-a toc" ;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ! $(tidy_paths) {
|
|
|
|
AsciiDoc1 $(target) : $(source) ;
|
|
|
|
} else {
|
|
|
|
TIDY on $(target) = "tidy" ;
|
|
|
|
AsciiDoc2 $(target) : $(source) ;
|
|
|
|
}
|
|
|
|
|
2007-09-28 18:08:59 +04:00
|
|
|
LocalClean clean : $(target) ;
|
2007-07-18 17:21:52 +04:00
|
|
|
}
|
2007-07-18 21:32:49 +04:00
|
|
|
|
|
|
|
# copy images, if given
|
|
|
|
local imgdir = [ FDirName $(MANUALDIR) $(MANUALICONS) ] ;
|
|
|
|
if $(>) {
|
|
|
|
for i in $(>) {
|
|
|
|
source = [ FFileName $(path) $(i) ] ;
|
|
|
|
target = $(source:D=$(imgdir)) ;
|
|
|
|
|
|
|
|
MkDir $(imgdir) ;
|
|
|
|
|
2007-09-28 18:08:59 +04:00
|
|
|
LocalDepends $(target) : $(imgdir) ;
|
|
|
|
LocalDepends $(target) : $(source) ;
|
|
|
|
LocalDepends all : $(target) ;
|
|
|
|
LocalDepends doc : $(target) ;
|
2007-07-18 21:32:49 +04:00
|
|
|
|
|
|
|
Copy $(target) : $(source) ;
|
2007-09-28 18:08:59 +04:00
|
|
|
LocalClean clean : $(target) ;
|
2007-07-18 21:32:49 +04:00
|
|
|
}
|
|
|
|
}
|
2007-07-18 17:21:52 +04:00
|
|
|
}
|
|
|
|
|
2008-08-05 18:28:46 +04:00
|
|
|
# EdeManualWithToc [file] : [optinal-images] ;
|
|
|
|
# The same as EdeManual, but it will build Table of Contents
|
|
|
|
rule EdeManualWithToc
|
|
|
|
{
|
|
|
|
EdeManual $(1) : $(2) : "make-toc" ;
|
|
|
|
}
|
|
|
|
|
2007-07-18 17:21:52 +04:00
|
|
|
actions AsciiDoc1
|
|
|
|
{
|
2008-08-05 18:28:46 +04:00
|
|
|
$(ASCIIDOC) $(TOC_FLAG) -a icons -a iconsdir=$(MANUALICONS) -a edeversion="EDE 2.0" -o $(<) $(>)
|
|
|
|
}
|
|
|
|
|
|
|
|
# version with tidy (utility to clean HTML/XHTML code)
|
|
|
|
actions AsciiDoc2
|
|
|
|
{
|
|
|
|
$(ASCIIDOC) $(TOC_FLAG) -a icons -a iconsdir=$(MANUALICONS) -a edeversion="EDE 2.0" -o "$(<).tmp" $(>)
|
|
|
|
$(TIDY) -q -i "$(<).tmp" > "$(<)"
|
|
|
|
$(RM) "$(<).tmp"
|
2007-07-18 17:21:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NotFile doc ;
|
|
|
|
Always doc ;
|