From e60828f978a9d2ec1233acc32ef7edc9dc015cb2 Mon Sep 17 00:00:00 2001 From: fbarriere Date: Tue, 21 Jun 2005 20:29:32 +0000 Subject: Changed the Makefile to the new DocBook version of the doc --- Makefile | 240 ++++++++++++++++----------------------------------------------- setup.mk | 78 +++++++++++++++++++++ 2 files changed, 138 insertions(+), 180 deletions(-) create mode 100644 setup.mk diff --git a/Makefile b/Makefile index f1bfc11..2571ff4 100644 --- a/Makefile +++ b/Makefile @@ -2,19 +2,15 @@ # Generate HTML pages from SGML docs. # ================================== # -# You may need to define (if the default location does not -# correspond to your installation) the SGML_TOOL variable -# (using SGML_TOOL= on the make command -# line). +# Edit the setup.mk included file to define your own docbook setup. +# See the comments in this file for more details... # ###################################################################### # -# FILTER_IMAGES is deprecated, use TARGET_TYPE instead. TARGET_TYPE -# is used to defined the target for the doc to build: either with -# images and directory names as file prefix for the web site -# (TARGET_TYPE=WEB) or without any screenshot and with file names to -# fit the Sylpheed source code file name (to generate the doc to -# include in the Sylpheed distribution). +# TARGET_TYPE is used to defined the target for the doc to build: +# either with images, for the web site (TARGET_TYPE=WEB) or without +# any screenshot (to generate the doc to include in the Sylpheed +# distribution). # TARGET_TYPE can be 'WEB' or any other value (including the null # string). # The default is 'WEB', so if you do not provide anything on the make @@ -22,21 +18,22 @@ # ###################################################################### # -# To only build one type of doc (manual, faq,...) define the -# ALL_TYPES list. For example: -# make ALL_TYPES=manual -# should only build the HTML pages for the manual. -# To only build for one language, define the LANGS variable: -# make LANGS="fr de" -# should build the french and german docs. -# Combine the two variables to build one type of doc for -# selected languages: -# make ALL_TYPES=faq LANGS=es -# should only build the spanish faq. +# Building particular type of doc (manual or faq) or building for +# one language does not require any variable setting (for those who +# remember the old sgmltools days). Just define what you want to +# build in the command line of the make. Examples: +# +# 'make manual' => will make the manual in all languages. +# 'make manual/en' => Will build the english manual. +# 'make faq/en faq/es' => Will build the english and spanish FAQ. +# 'make faq/en manual/en' => Will build the english FAQ and manual. # ###################################################################### # # $Log: Makefile,v $ +# Revision 1.5 2005/06/21 20:29:32 fbarriere +# Changed the Makefile to the new DocBook version of the doc +# # Revision 1.4 2003/03/12 20:10:26 fbarriere # Added the use of the zh-sgmltools for the chinese doc. # @@ -53,16 +50,6 @@ # ###################################################################### -ifeq ($(LANG1), zh_TW.Big5) - SGML_TOOL := /usr/local/bin/bg5sgml2html - SGML_TOOL_OPT := - #SGML_TOOL_OPT := --imagebuttons -else - SGML_TOOL := /usr/bin/sgml2html - SGML_TOOL_OPT := --language=$(LANG1) - #SGML_TOOL_OPT := --imagebuttons -endif - # # Final result type: WEB (with images and original names), # or any other value for a version using he file names @@ -75,20 +62,16 @@ TARGET_TYPE := WEB # ifeq ($(TARGET_TYPE), WEB) FILTER_IMAGES := - TARGET_NAME := $(DOC_TYPE) else FILTER_IMAGES := YES_MY_LORD - ifeq ($(DOC_TYPE), manual) - TARGET_NAME := sylpheed - else - ifeq ($(DOC_TYPE), faq) - TARGET_NAME := sylpheed-faq - else - TARGET_NAME := $(DOC_TYPE) - endif - endif endif +# +# Defines the types of doc and languages to process. +# +ALL_TYPES := faq manual +LANGS := de en es fr zh_TW.Big5 + # # Some usual shell commands with some arguments... # @@ -126,168 +109,65 @@ TODAY := $(shell date "+%d%m%Y") HERE := $(shell pwd) ROOT_DIR := $(HERE) PACKAGE_DIR := $(ROOT_DIR)/../packages -HTML_DIR := $(ROOT_DIR)/HTML/$(DOC_TYPE) +HTML_DIR := $(ROOT_DIR)/HTML SHOTS_DIR := snapshots -# -# Sed command file used to filter the images: -# -SED_CMD_FILE := $(ROOT_DIR)/tools/filter_images.sed - -# -# Defines the list of languages to process. -# -LANG_tmp := $(shell ls) -FILTER_OUT := CVS Makefile HTML tools packages +TARGETS := $(foreach TYPE,$(ALL_TYPES), $(foreach LANG1,$(LANGS),$(HTML_DIR)/$(TYPE)/$(LANG1)/$(TYPE).html)) -ALL_TYPES := $(filter-out $(FILTER_OUT), $(LANG_tmp)) -LANGS := $(filter-out $(FILTER_OUT), $(LANG_tmp)) +SCREENSHOTS := $(addprefix $(HTML_DIR)/,$(shell ls */*/$(SHOTS_DIR)/*png)) # -# List the source files, count the number of sections -# and generate the sections number sequence. A complicated -# GNU make + shell part just to count from 1 to the -# number of sections of the SGML source. Looks like there -# should be a better solution... -# -ifneq ($(LANG1), ) - SOURCE_FILES := $(shell ls $(LANG1)/*.sgml) - ifneq ($(FILTER_IMAGES), ) - SHOTS_tmp := - SCREENSHOTS := - else - SHOTS_tmp := $(shell ls $(LANG1)/$(SHOTS_DIR)) - SCREENSHOTS := $(shell ls $(LANG1)/$(SHOTS_DIR)/*.png) - endif -endif - -ifneq ($(SOURCE_FILES), ) - SECTION_NUM := $(shell /bin/cat $(SOURCE_FILES) | /bin/grep -c -i "") - FILE_PREFIX := $(basename $(notdir $(SOURCE_FILES))) - NUM_SEQUENCE := $(shell \ - index=1;\ - while [ $$index -le $(SECTION_NUM) ];\ - do\ - printf "%3d" $$index | /bin/sed 's/ /0/g' | /bin/sed 's/^/ /';\ - index=$$[$$index + 1];\ - done;\ - ) - html_doc_TARGETS := $(HTML_DIR)/$(LANG1)/$(TARGET_NAME).sgml $(addprefix $(HTML_DIR)/, $(SCREENSHOTS)) -endif +# Java and DocBook setup: +# +include $(ROOT_DIR)/setup.mk # -# Defines the SGML filter: when filtering images, remove them -# while generating the complete SGML file. +# XSLT stylesheets: # -ifneq ($(FILTER_IMAGES), ) - FILTER := /bin/sed -f $(SED_CMD_FILE) | /bin/sed -e '//,/<\/REMOVE_ME>/d' -else - FILTER := /usr/bin/tee -endif - +CHUNKS_STYLESHEET := $(ROOT_DIR)/tools/user_guide_chunks.xsl +SINGLE_STYLESHEET := $(ROOT_DIR)/tools/user_guide.xsl +FO_PDF_STYLESHEET := $(ROOT_DIR)/tools/user_guide_fo.xsl +HTML_STYLESHEET := sylpheeddoc.css # # Top level targets: then propagate the make for each # document type (manual, faq,...), then for each language. # +.PHONY: $(ALL_TYPES) $(foreach LANG1,$(LANGS), $(foreach TYPE,$(ALL_TYPES),$(TYPE)/$(LANG1))) -all: all_docs prep - -prep: - @ $(MAKEDIR) $(HTML_DIR) $(PACKAGE_DIR) - -all_docs: - @ for ONE_TYPE in $(ALL_TYPES);\ - do \ - echo "### Making all_langs in $$ONE_TYPE...";\ - $(MAKE) \ - -C $$ONE_TYPE \ - -f $(ROOT_DIR)/Makefile \ - DOC_TYPE=$$ONE_TYPE \ - ROOT_DIR=$(ROOT_DIR) \ - all_langs;\ - done; +all: $(ALL_TYPES) -all_langs: - @ for ONE_LANG in $(LANGS);\ - do \ - echo "###### Making html_doc in $$ONE_LANG...";\ - $(MAKE) \ - -f $(ROOT_DIR)/Makefile \ - LANG1=$$ONE_LANG \ - DOC_TYPE=$(DOC_TYPE) \ - ROOT_DIR=$(ROOT_DIR) \ - html_doc ;\ - done; +# Foreach document type: manual, faq: +$(ALL_TYPES): + @ echo " *** Document: $@" + @ $(MAKE) $(foreach LANG,$(LANGS),$@/$(LANG)) -html_doc: $(html_doc_TARGETS) +# Foreach type/language pair: +$(foreach TYPE,$(ALL_TYPES),$(foreach LANG1,$(LANGS),$(TYPE)/$(LANG1))): + @ echo " ****** Doc/lang: "$@ + @ $(MAKE) $(HTML_DIR)/$@/$(subst /,.html,$(dir $@)) -$(HTML_DIR)/$(LANG1)/$(TARGET_NAME).sgml: $(SOURCE_FILES) - @ echo "######### Building $(HTML_DIR)/$(LANG1)/$(TARGET_NAME).sgml" - @ $(MAKEDIR) $(HTML_DIR)/$(LANG1) - @ $(CAT) $(SOURCE_FILES) | $(FILTER) > $(HTML_DIR)/$(LANG1)/$(TARGET_NAME).sgml - @ echo "######### Building html file..." - @ cd $(HTML_DIR)/$(LANG1); $(SGML_TOOL) $(SGML_TOOL_OPT) $@; cd $(HERE) +# Foreach HTML output file: +$(TARGETS): $(HTML_DIR)/%.html : %.xml + @ echo " ********* Creating dir: "$(dir $@) + @ $(MAKEDIR) $(dir $@) +ifeq ($(TARGET_TYPE), WEB) + @ echo " ********* Creating dir: "$(dir $@)$(SHOTS_DIR) + @ $(MAKEDIR) $(dir $@)$(SHOTS_DIR) + @ $(MAKE) $(addprefix $(HTML_DIR)/,$(shell ls $(dir $<)$(SHOTS_DIR)/*png)) +endif + @ echo " ********* Creating HTML doc." + @ $(HTML_CMD) -$(addprefix $(HTML_DIR)/, $(SCREENSHOTS)): $(HTML_DIR)/$(LANG1)/$(SHOTS_DIR)/%.png: $(LANG1)/$(SHOTS_DIR)/%.png - @ if [ ! -d $(HTML_DIR)/$(LANG1)/$(SHOTS_DIR) ];\ - then\ - echo "######### Building $(HTML_DIR)/$(LANG1)/$(SHOTS_DIR)";\ - $(MAKEDIR) $(HTML_DIR)/$(LANG1)/$(SHOTS_DIR);\ - fi; - @ echo "######### Importing: $<" +# Foreach PNG screenshot: +$(SCREENSHOTS): $(HTML_DIR)/%.png : %.png + @ echo " ********* Importing: $<" @ $(COPY) $< $@ -# -# Build tar packages of the docs: -# - -packages: - @ for ONE_TYPE in $(ALL_TYPES);\ - do \ - echo "### Making packages for $$ONE_TYPE...";\ - $(MAKE) \ - -f $(ROOT_DIR)/Makefile \ - -C $(HTML_DIR)/$$ONE_TYPE \ - DOC_TYPE=$$ONE_TYPE \ - ROOT_DIR=$(ROOT_DIR) \ - all_package;\ - done; - -all_package: - @ for ONE_LANG in $(LANGS);\ - do \ - echo "###### Making package in $(DOC_TYPE)/$$ONE_LANG...";\ - $(MAKE) \ - -f $(ROOT_DIR)/Makefile \ - -C $(HTML_DIR)/$$ONE_TYPE/$$ONE_LANG \ - LANG1=$$ONE_LANG \ - DOC_TYPE=$(DOC_TYPE) \ - ROOT_DIR=$(ROOT_DIR) \ - package ;\ - done; - -package: - @ echo "######### Building package" - @ $(TAR_CREATE) $(PACKAGE_DIR)/sylpheeddoc_$(DOC_TYPE)_$(LANG1)_$(TODAY).$(TAR_SUFFIX) -C $(HERE) . - - # #################################################### # # Usual clean target: # clean: - @ for ONE_TYPE in $(ALL_TYPES);\ - do \ - echo "### Making html_clean in $$ONE_TYPE...";\ - $(MAKE) \ - -C $$ONE_TYPE \ - -f $(ROOT_DIR)/Makefile \ - DOC_TYPE=$$ONE_TYPE \ - ROOT_DIR=$(ROOT_DIR) \ - html_clean;\ - done; - - $(REMOVE) $(PACKAGE_DIR)/* - -html_clean: - $(REMOVE) $(HTML_DIR) + - $(REMOVE) $(PACKAGE_DIR)/* diff --git a/setup.mk b/setup.mk new file mode 100644 index 0000000..8b534e6 --- /dev/null +++ b/setup.mk @@ -0,0 +1,78 @@ +###################################################################### +# XSLT processing setup: +# ===================== +# +# As this setup may change based on your install and distro, I put +# all this into a separate file. This one is an example (the one +# I use) and must be modified to fit your config. +# By keeping it separate, we can modify the main Makefile without +# breaking the config and avoid the switches. +# +# For now it only supports Saxon+Fop+Jai+Java. I would like to include +# the support for xsltproc (sablotron and xalan) for HTML output only. +# I someone has the time and wants to add this, go ahead! +# +###################################################################### + +# +# JAVA: for Saxon (xslt processor) and FOP (PDF generator) +# +JAVA_HOME ?= $(shell java-config --jdk-home) +JAVACMD ?= $(JAVA_HOME)/bin/java + +# +# XSLT processors: Saxon. +# +SAXON_HOME ?= /usr/share/saxon-bin/lib +SAXON_JAR ?= $(SAXON_HOME)/saxon.jar:$(SAXON_HOME)/saxon-jdom.jar + +# +# XML catalog resolver and setting: for Saxon only +# +RES_CLASSPATH ?= /opt/xxe/resolver.jar + +# +# DOCBOOK XSL extension for Saxon: +# +EXT_CLASSPATH ?= $(DOCBOOK_XSL)/extensions/saxon65.jar + +# +# Formatting object processor: PDF generation only +# +FOP_HOME ?= /usr/share/fop +FOP_CLASSPATH ?= $(FOP_HOME)/build/fop.jar +FOP_CLASSPATH ?= $(FOP_CLASSPATH):$(FOP_HOME)/lib/avalon-framework-cvs-20020806.jar +FOP_CLASSPATH ?= $(FOP_CLASSPATH):$(FOP_HOME)/lib/batik.jar + +# +# JAI: Java Advance Image lib: Saxon only +# +JAIHOME ?= /usr/share/jai-bin +JAI_CLASSPATH ?= $(JAIHOME)/lib/jai_core.jar:$(JAIHOME)/lib/jai_codec.jar:$(JAIHOME)/lib/mlibwrapper_jai.jar + +# +# Final CLASSPATH for java: +# +CLASSPATH := $(SAXON_JAR):$(RES_CLASSPATH):$(EXT_CLASSPATH):$(JAI_CLASSPATH):$(FOP_CLASSPATH) + +# +# Bin libraries: for JAI +# +LD_LIBRARY_PATH += /opt/jai-bin/lib + +# Extra options for catalog handling: +#CATALOG_OPTS = "-x org.apache.xml.resolver.tools.ResolvingXMLReader -y org.apache.xml.resolver.tools.ResolvingXMLReader -r org.apache.xml.resolver.tools.CatalogResolver" +CATALOG_OPTS := + +# +# DocBook stylesheets: common to all XSLT processors: +# +DOCBOOK_XSL ?= /usr/share/sgml/docbook/xsl-stylesheets-1.66.1 + +# Make the HTML +HTML_CMD = $(JAVACMD) com.icl.saxon.StyleSheet \ + $(CATALOG_OPTS) \ + -o $@ \ + $< \ + $(SINGLE_STYLESHEET) +# root.filename=all_in_one_page \ No newline at end of file -- cgit