~dsmythies/serverguide/lp1129649_plus

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
####################################################################################           
# Makefile for the Ubuntu Server Guide
# Copyright (C) 2011 Ubuntu Documentation Project (ubuntu-doc@lists.ubuntu.com)
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version. 
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#    On Debian based systems a copy of the GPL can be found 
#    at /usr/share/common-licenses/GPL
#
####################################################################################

MAKECMD=make
SED=/bin/sed

# Language code for documents
# Ex. LN=ja for japanese
LN=C

# XSL Processors
XSLTPROC=/usr/bin/xsltproc

current_distro=$(shell test -e /etc/debian_version && echo "debian")

# NWalsh Docbook XSL's
NWDBXSL=/usr/share/xml/docbook/stylesheet/nwalsh/html/docbook.xsl

# Ubuntu Docbook Customization Layer

UBUNTUXSL=libs/ubuntu.xsl
UBUNTUPDFXSL=libs/ubuntu-pdf.xsl

# Base gnome directories for output from processor
BASE=build/

clean:
	rm -rf $(BASE)

style:

	# copy style sheet and common images to build directory
	mkdir -p build/libs/img
	mkdir -p build/libs/admon
	mkdir -p build/libs/callouts
	mkdir -p build/libs/navig
	cp libs/*css build/libs/
	cp libs/img/*.* build/libs/img/
	cp -r libs/admon/*.* build/libs/admon	
	cp -r libs/callouts/*.* build/libs/callouts
	cp -r libs/navig/*.* build/libs/navig

## Targets for building standalone documents

serverguide-html:

# Builds the HTML files for the specified language codes.
# Specifiying the language in the final documents and
# performing some other necessary text replacements not handled by yelp-build.
# Language codes are normalized to IETF format, as opposed to glibc format

	if [ $(LN) != "C" ]; then \
		./scripts/translate.sh -d serverguide -l $(LN); \
	fi
	if find serverguide/$(LN) -name "*.xml"; then \
		mkdir -p build/serverguide/$(LN); \
		yelp-build html -o build/serverguide/$(LN) -x $(UBUNTUXSL) serverguide/$(LN)/serverguide.xml; \
		mkdir -p build/img; \
		cp libs/img/* build/img/; \
                lang=`echo $(LN) | $(SED) -e 's/[@_]/-/'`; \
                if test "$$lang" = "C"; then lang=en; fi; \
                if test "$$lang" = "gl"; then lang=gl-GL; fi; \
                if test "$$lang" = "ms"; then lang=ms-MS; fi; \
                if test "$$lang" = "pl"; then lang=pl-PL; fi; \
                $(SED) -i \
                        -e '1s/^/<!DOCTYPE html\>\n/' \
                        -e "s/<html>/<html lang="$$lang">/" \
                        build/serverguide/$(LN)/*.html; \
	fi

serverguide-pdf:

	if [ $(LN) != "C" ]; then \
		./scripts/translate.sh -d serverguide -l $(LN); \
	fi
	if find serverguide/$(LN) -name "*.xml"; then \
		xsltproc --xinclude -o $(BASE)serverguide/$(LN)/serverguide.fo $(UBUNTUPDFXSL) serverguide/$(LN)/serverguide.xml; \
		fop -fo $(BASE)serverguide/$(LN)/serverguide.fo -pdf $(BASE)serverguide/$(LN)/serverguide.pdf; \
	fi

status: style

	if [ $(LN) != "C" ]; then \
		./scripts/translate.sh -d serverguide -l $(LN); \
	fi
	if find serverguide/$(LN) -name "*.xml"; then \
		xsltproc --xinclude -o $(BASE)status/sg-report.xml $(wOS) serverguide/$(LN)/serverguide.xml; \
		xsltproc --xinclude -o $(BASE)status/sg-report.html $(NWDBXSL) $(BASE)status/sg-report.xml; \
	fi