Subversion Repositories svn LFS-FR

Rev

Rev 1346 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1347 jmengual 1
BASEDIR = ~/hlfs-book
2
DUMPDIR = ~/hlfs-commands
598 gleu 3
RENDERTMP = $(HOME)/tmp
4
CHUNK_QUIET = 1
5
ROOT_ID =
1347 jmengual 6
PDF_OUTPUT = HLFS-BOOK.pdf
7
NOCHUNKS_OUTPUT = HLFS-BOOK.html
474 gleu 8
 
598 gleu 9
ifdef V
10
  Q =
11
else
12
  Q = @
13
endif
517 gleu 14
 
1347 jmengual 15
hlfs: maketar validxml profile-html
598 gleu 16
	@echo "Generating chunked XHTML files..."
17
	$(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
18
	  -stringparam rootid "$(ROOT_ID)" -stringparam base.dir $(BASEDIR)/ \
1347 jmengual 19
	  stylesheets/lfs-chunked.xsl $(RENDERTMP)/hlfs-html.xml
598 gleu 20
 
21
	@echo "Copying CSS code and images..."
22
	$(Q)if [ ! -e $(BASEDIR)/stylesheets ]; then \
474 gleu 23
	  mkdir -p $(BASEDIR)/stylesheets; \
24
	fi;
598 gleu 25
	$(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
26
	$(Q)if [ ! -e $(BASEDIR)/images ]; then \
474 gleu 27
	  mkdir -p $(BASEDIR)/images; \
28
	fi;
598 gleu 29
	$(Q)cp images/*.png $(BASEDIR)/images
30
	$(Q)cd $(BASEDIR)/; sed -i -e "s@../stylesheets@stylesheets@g" *.html
31
	$(Q)cd $(BASEDIR)/; sed -i -e "s@../images@images@g" *.html
474 gleu 32
 
598 gleu 33
	@echo "Running Tidy and obfuscate.sh..."
34
	$(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
555 gleu 35
	  tidy -config tidy.conf $$filename; \
36
	  true; \
602 texou 37
	  /bin/bash obfuscate.sh $$filename; \
517 gleu 38
	  sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
39
	done;
40
 
598 gleu 41
	$(Q)$(MAKE) wget-list
474 gleu 42
 
598 gleu 43
pdf: validxml
44
	@echo "Generating profiled XML for PDF..."
45
	$(Q)xsltproc --nonet --stringparam profile.condition pdf \
1347 jmengual 46
	  --output $(RENDERTMP)/hlfs-pdf.xml stylesheets/lfs-xsl/profile.xsl \
47
	  $(RENDERTMP)/hlfs-full.xml
555 gleu 48
 
598 gleu 49
	@echo "Generating FO file..."
50
	$(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
1347 jmengual 51
	  --output $(RENDERTMP)/hlfs-pdf.fo stylesheets/lfs-pdf.xsl \
52
	  $(RENDERTMP)/hlfs-pdf.xml
53
	$(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/hlfs-pdf.fo
54
	$(Q)bash pdf-fixups.sh $(RENDERTMP)/hlfs-pdf.fo
474 gleu 55
 
598 gleu 56
	@echo "Generating PDF file..."
57
	$(Q)if [ ! -e $(BASEDIR) ]; then \
58
	  mkdir -p $(BASEDIR); \
59
	fi;
1347 jmengual 60
	$(Q)fop $(RENDERTMP)/hlfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT)
561 gleu 61
 
863 texou 62
nochunks: maketar validxml profile-html
598 gleu 63
	@echo "Generating non chunked XHTML file..."
64
	$(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
65
	  --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
1347 jmengual 66
	  stylesheets/lfs-nochunks.xsl $(RENDERTMP)/hlfs-html.xml
598 gleu 67
 
68
	@echo "Running Tidy..."
69
	$(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
70
	@echo "Running obfuscate.sh..."
615 texou 71
	$(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
598 gleu 72
	$(Q)sed -i -e "s@text/html@application/xhtml+xml@g"  \
555 gleu 73
	  $(BASEDIR)/$(NOCHUNKS_OUTPUT)
74
 
598 gleu 75
tmpdir:
76
	@echo "Creating and cleaning $(RENDERTMP)"
77
	$(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
1347 jmengual 78
	$(Q)rm -f $(RENDERTMP)/hlfs-{full,html,pdf}.xml
79
	$(Q)rm -f $(RENDERTMP)/hlfs-pdf.fo
561 gleu 80
 
598 gleu 81
validxml: tmpdir
602 texou 82
	@echo "Processing bootscripts..."
763 texou 83
	$(Q)bash process-scripts.sh
598 gleu 84
	@echo "Validating the book..."
85
	$(Q)xmllint --nonet --noent --xinclude --postvalid \
1347 jmengual 86
	  -o $(RENDERTMP)/hlfs-full.xml index.xml
602 texou 87
	$(Q)rm -f appendices/*.script
1347 jmengual 88
	$(Q)./aux-file-data.sh $(RENDERTMP)/hlfs-full.xml
598 gleu 89
 
602 texou 90
maketar:
91
	@echo "Making tarballs..."
763 texou 92
	$(Q)sh make-aux-files.sh
602 texou 93
 
598 gleu 94
profile-html: validxml
95
	@echo "Generating profiled XML for XHTML..."
96
	$(Q)xsltproc --nonet --stringparam profile.condition html \
1347 jmengual 97
	  --output $(RENDERTMP)/hlfs-html.xml stylesheets/lfs-xsl/profile.xsl \
98
	  $(RENDERTMP)/hlfs-full.xml
598 gleu 99
 
100
wget-list:
101
	@echo "Generating wget list..."
102
	$(Q)mkdir -p $(BASEDIR)
103
	$(Q)xsltproc --xinclude --nonet --output $(BASEDIR)/wget-list \
104
	  stylesheets/wget-list.xsl chapter03/chapter03.xml
105
 
106
dump-commands: validxml
107
	@echo "Dumping book commands..."
108
	$(Q)xsltproc --output $(DUMPDIR)/ \
1347 jmengual 109
	   stylesheets/dump-commands.xsl $(RENDERTMP)/hlfs-full.xml
598 gleu 110
 
690 texou 111
validate: maketar validxml
687 texou 112
	@echo "Validation complete."
517 gleu 113
 
1347 jmengual 114
all: hlfs nochunks pdf dump-commands
598 gleu 115
 
1347 jmengual 116
.PHONY : all dump-commands hlfs nochunks pdf profile-html tmpdir validate \
602 texou 117
	 validxml wget-list maketar