[19599c63] | 1 | # Makefile for BLFS Book generation.
|
---|
| 2 | # By Tushar Teredesai <tushar@linuxfromscratch.org>
|
---|
| 3 | # 2004-01-31
|
---|
[5cd0959d] | 4 | # $LastChangedBy$
|
---|
| 5 | # $Date$
|
---|
[19599c63] | 6 | # Adjust these to suit your installation
|
---|
| 7 | OUTPUTDIR = $(HOME)/public_html/blfs-book
|
---|
[4a02298] | 8 | DUMPDIR= $(HOME)/blfs-commands
|
---|
[19599c63] | 9 | INSTALL = install
|
---|
| 10 | JADE = openjade
|
---|
| 11 | DOCBOOK = /usr/share/sgml/docbook/dsssl-stylesheets-1.78
|
---|
[527966e] | 12 | BASEDIR= $(HOME)/public_html/blfs-book-xsl
|
---|
| 13 | TEXBASEDIR= $(HOME)/public_html/blfs-book-tex
|
---|
[d8dc77a] | 14 | NOCHUNKS_OUTPUT=BLFS-BOOK.html
|
---|
[19599c63] | 15 | SRCDIR = $(PWD)
|
---|
| 16 |
|
---|
[972150e7] | 17 | all: blfs
|
---|
[22c4e1ee] | 18 |
|
---|
[eff3826] | 19 | blfs:
|
---|
[e9e9b47a] | 20 | @if [ -z $(BASEDIR) ]; then \
|
---|
| 21 | echo "Envar BASEDIR is not set!" ; \
|
---|
| 22 | exit 1 ; \
|
---|
[1881a5b] | 23 | fi
|
---|
[e9e9b47a] | 24 | @echo "Generating XHTML Version of BLFS Book with xsltproc..."
|
---|
| 25 | @echo " BASEDIR = $(BASEDIR)"
|
---|
| 26 | @$(INSTALL) -d $(BASEDIR)
|
---|
[527966e] | 27 | xsltproc --xinclude --nonet -stringparam base.dir $(BASEDIR)/ \
|
---|
[eff3826] | 28 | stylesheets/blfs-chunked.xsl index.xml
|
---|
[527966e] | 29 | if [ ! -e $(BASEDIR)/stylesheets ]; then \
|
---|
| 30 | mkdir -p $(BASEDIR)/stylesheets; \
|
---|
[eff3826] | 31 | fi;
|
---|
[527966e] | 32 | cp stylesheets/*.css $(BASEDIR)/stylesheets
|
---|
| 33 | if [ ! -e $(BASEDIR)/images ]; then \
|
---|
| 34 | mkdir -p $(BASEDIR)/images; \
|
---|
[eff3826] | 35 | fi;
|
---|
[5d4975d] | 36 | cp images/*.png $(BASEDIR)/images
|
---|
[3fe8b511] | 37 | cd $(BASEDIR); sed -i -e "s@../stylesheets@stylesheets@g" *.html
|
---|
| 38 | cd $(BASEDIR); sed -i -e "s@../images@images@g" *.html
|
---|
[4a02298] | 39 |
|
---|
| 40 | for filename in `find $(BASEDIR) -name "*.html"`; do \
|
---|
| 41 | tidy -config tidy.conf $$filename; \
|
---|
| 42 | true; \
|
---|
| 43 | sh obfuscate.sh $$filename; \
|
---|
| 44 | sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
|
---|
| 45 | done;
|
---|
[eff3826] | 46 |
|
---|
[8e1efd0] | 47 |
|
---|
[3fe8b511] | 48 | nochunks:
|
---|
| 49 | @echo "Generating nochunks version of BLFS..."
|
---|
[d8dc77a] | 50 | xsltproc --xinclude --nonet -stringparam profile.condition html \
|
---|
| 51 | --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
|
---|
[1881a5b] | 52 | stylesheets/blfs-nochunks.xsl index.xml
|
---|
[4ff86b9] | 53 |
|
---|
[d8dc77a] | 54 | tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
|
---|
[4ff86b9] | 55 |
|
---|
[4a02298] | 56 | sh obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
| 57 |
|
---|
[d8dc77a] | 58 | sed -i -e "s@text/html@application/xhtml+xml@g" \
|
---|
| 59 | $(BASEDIR)/$(NOCHUNKS_OUTPUT)
|
---|
[3fe8b511] | 60 |
|
---|
[eff3826] | 61 | pdf:
|
---|
[d53eb0e] | 62 | xsltproc --xinclude --nonet --stringparam profile.condition pdf \
|
---|
[8e1efd0] | 63 | --output blfs-pdf.xml stylesheets/blfs-profile.xsl index.xml
|
---|
[d9712fb] | 64 | xsltproc --xinclude --nonet --output blfs.fo \
|
---|
[d53eb0e] | 65 | stylesheets/blfs-pdf.xsl blfs-pdf.xml
|
---|
[5d4975d] | 66 | sed -i -e "s/inherit/all/" blfs.fo
|
---|
[634c636c] | 67 | fop.sh blfs.fo blfs.pdf
|
---|
[527966e] | 68 | $(INSTALL) -d $(BASEDIR)/pdf
|
---|
[9c12e42] | 69 | rm blfs.fo
|
---|
[527966e] | 70 | mv blfs.pdf $(BASEDIR)/pdf
|
---|
[e9e9b47a] | 71 |
|
---|
| 72 | tex:
|
---|
| 73 | @if [ -z $(TEXBASEDIR) ]; then \
|
---|
[1881a5b] | 74 | echo "Envar TEXBASEDIR is not set!" ; \
|
---|
| 75 | exit 1 ; \
|
---|
| 76 | fi
|
---|
[e9e9b47a] | 77 | @echo "Generating TeX Version of BLFS Book with xsltproc..."
|
---|
| 78 | @echo " TEXBASEDIR = $(TEXBASEDIR)"
|
---|
| 79 | @$(INSTALL) -d $(TEXBASEDIR)
|
---|
| 80 | # Using profiles in book source to exclude parts of the book from TeX
|
---|
[0990cf7a] | 81 | # i.e., Changelog
|
---|
[527966e] | 82 | xsltproc --nonet --output $(TEXBASEDIR)/index.xml \
|
---|
[1881a5b] | 83 | --stringparam "profile.role" "book" \
|
---|
[e9e9b47a] | 84 | http://docbook.sourceforge.net/release/xsl/current/profiling/profile.xsl \
|
---|
[1881a5b] | 85 | index.xml
|
---|
[e9e9b47a] | 86 | @cd $(TEXBASEDIR) && xsltproc --nonet -o blfs-book.tex \
|
---|
[1881a5b] | 87 | $(SRCDIR)/stylesheets/blfs-tex.xsl index.xml
|
---|
[22c4e1ee] | 88 |
|
---|
[4a02298] | 89 | dump-commands:
|
---|
| 90 | xsltproc --xinclude --nonet --output $(DUMPDIR)/ \
|
---|
| 91 | stylesheets/dump-commands.xsl index.xml
|
---|
| 92 |
|
---|
[7337fcb] | 93 | validate:
|
---|
[714d067] | 94 | xmllint --noout --nonet --xinclude --postvalid index.xml
|
---|
[47d87939] | 95 |
|
---|
[d53eb0e] | 96 | validate-pdf:
|
---|
| 97 | xsltproc --xinclude --nonet --stringparam profile.condition pdf \
|
---|
[8e1efd0] | 98 | --output blfs-pdf.xml stylesheets/blfs-profile.xsl index.xml
|
---|
[d53eb0e] | 99 | xmllint --noout --nonet --postvalid blfs-pdf.xml
|
---|
| 100 |
|
---|
[4ff86b9] | 101 | blfs-patch-list:
|
---|
[47d87939] | 102 | @echo "Generating blfs-patch-list..."
|
---|
| 103 | xsltproc --xinclude --nonet \
|
---|
| 104 | --output blfs-patch-list stylesheets/patcheslist.xsl index.xml
|
---|
| 105 | sed -e "s|^.*/||" blfs-patch-list > blfs-patches
|
---|
| 106 | sort blfs-patches > blfs-patch-list
|
---|
| 107 | rm blfs-patches
|
---|
| 108 |
|
---|
[7818e780] | 109 | wget-list:
|
---|
| 110 | mkdir -p $(BASEDIR)
|
---|
| 111 | xsltproc --xinclude --nonet stylesheets/wget-list.xsl index.xml > $(BASEDIR)/wget-list
|
---|
| 112 |
|
---|
| 113 | test-links:
|
---|
| 114 | mkdir -p $(BASEDIR)
|
---|
| 115 | xsltproc --xinclude --nonet --stringparam list_mode full \
|
---|
| 116 | stylesheets/wget-list.xsl index.xml > $(BASEDIR)/test-links
|
---|
[60844b8] | 117 | rm -f $(BASEDIR)/{good,bad,true_bad}_urls
|
---|
[7818e780] | 118 | for URL in `cat $(BASEDIR)/test-links`; do \
|
---|
| 119 | wget --spider --tries=2 --timeout=60 $$URL >>/dev/null 2>&1; \
|
---|
| 120 | if test $$? -ne 0 ; then echo $$URL >> $(BASEDIR)/bad_urls ; \
|
---|
| 121 | else echo $$URL >> $(BASEDIR)/good_urls 2>&1; \
|
---|
| 122 | fi; \
|
---|
| 123 | done
|
---|
| 124 | for URL2 in `cat $(BASEDIR)/bad_urls`; do \
|
---|
| 125 | wget --spider --tries=2 --timeout=60 $$URL2 >>/dev/null 2>&1; \
|
---|
| 126 | if test $$? -ne 0 ; then echo $$URL2 >> $(BASEDIR)/true_bad_urls ; \
|
---|
| 127 | else echo $$URL2 >> $(BASEDIR)/good_urls 2>&1; \
|
---|
| 128 | fi; \
|
---|
| 129 | done
|
---|
| 130 |
|
---|
| 131 | .PHONY : blfs-patch-list wget-list test-links
|
---|