source: Makefile@ ed4ba3e

10.0 10.1 11.0 7.10 7.4 7.5 7.6 7.6-blfs 7.6-systemd 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind gnome kde5-13430 kde5-14269 kde5-14686 ken/refactor-virt krejzi/svn lazarus nosym perl-modules qt5new systemd-11177 systemd-13485 trunk xry111/git-date xry111/git-date-for-trunk xry111/git-date-test
Last change on this file since ed4ba3e was ed4ba3e, checked in by Bruce Dubbs <bdubbs@…>, 10 years ago

Minor clarification in Makefile

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@9169 af4574ff-66df-0310-9fd7-8a98e5e911e0

  • Property mode set to 100644
File size: 5.9 KB
Line 
1# Makefile for BLFS Book generation.
2# By Tushar Teredesai <tushar@linuxfromscratch.org>
3# 2004-01-31
4# $LastChangedBy$
5# $Date$
6
7# Adjust these to suit your installation
8BASEDIR ?= $(HOME)/public_html/blfs-book-xsl
9DUMPDIR ?= $(HOME)/blfs-commands
10RENDERTMP ?= tmp
11CHUNK_QUIET = 1
12ROOT_ID =
13PDF_OUTPUT = BLFS-BOOK.pdf
14NOCHUNKS_OUTPUT = BLFS-BOOK.html
15SHELL = /bin/bash
16
17ALLXML := $(filter-out $(RENDERTMP)/%, \
18 $(wildcard *.xml */*.xml */*/*.xml */*/*/*.xml */*/*/*/*.xml))
19ALLXSL := $(filter-out $(RENDERTMP)/%, \
20 $(wildcard *.xsl */*.xsl */*/*.xsl */*/*/*.xsl */*/*/*/*.xsl))
21
22ifdef V
23 Q =
24else
25 Q = @
26endif
27
28blfs: html wget-list
29all: blfs nochunks pdf
30world: all blfs-patch-list dump-commands test-links
31
32html: $(BASEDIR)/index.html
33$(BASEDIR)/index.html: $(RENDERTMP)/blfs-html.xml
34 @echo "Generating chunked XHTML files..."
35 $(Q)xsltproc --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \
36 -stringparam rootid "$(ROOT_ID)" -stringparam base.dir $(BASEDIR)/ \
37 stylesheets/blfs-chunked.xsl $(RENDERTMP)/blfs-html.xml
38
39 @echo "Copying CSS code and images..."
40 $(Q)if [ ! -e $(BASEDIR)/stylesheets ]; then \
41 mkdir -p $(BASEDIR)/stylesheets; \
42 fi;
43 $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
44 $(Q)if [ ! -e $(BASEDIR)/images ]; then \
45 mkdir -p $(BASEDIR)/images; \
46 fi;
47 $(Q)cp images/*.png $(BASEDIR)/images
48 $(Q)cd $(BASEDIR)/; sed -i -e "s@../stylesheets@stylesheets@g" *.html
49 $(Q)cd $(BASEDIR)/; sed -i -e "s@../images@images@g" *.html
50
51 @echo "Running Tidy and obfuscate.sh on chunked XHTML..."
52 $(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
53 tidy -config tidy.conf $$filename; \
54 true; \
55 bash obfuscate.sh $$filename; \
56 sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \
57 done;
58
59pdf: $(BASEDIR)/$(PDF_OUTPUT)
60$(RENDERTMP)/blfs-pdf.xml: $(RENDERTMP)/blfs-full.xml
61 @echo "Generating profiled XML for PDF..."
62 $(Q)xsltproc --nonet --stringparam profile.condition pdf \
63 --output $(RENDERTMP)/blfs-pdf.xml stylesheets/lfs-xsl/profile.xsl \
64 $(RENDERTMP)/blfs-full.xml
65
66$(RENDERTMP)/blfs-pdf.fo: $(RENDERTMP)/blfs-pdf.xml
67 @echo "Generating FO file..."
68 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
69 --output $(RENDERTMP)/blfs-pdf.fo stylesheets/blfs-pdf.xsl \
70 $(RENDERTMP)/blfs-pdf.xml
71 $(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/blfs-pdf.fo
72
73$(BASEDIR)/$(PDF_OUTPUT): $(RENDERTMP)/blfs-pdf.fo
74 @echo "Generating PDF file..."
75 $(Q)if [ ! -e $(BASEDIR) ]; then \
76 mkdir -p $(BASEDIR); \
77 fi;
78 $(Q)fop $(RENDERTMP)/blfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT)
79
80nochunks: $(BASEDIR)/$(NOCHUNKS_OUTPUT)
81$(BASEDIR)/$(NOCHUNKS_OUTPUT): $(RENDERTMP)/blfs-html.xml
82 @echo "Generating non-chunked XHTML file..."
83 $(Q)xsltproc --nonet -stringparam rootid "$(ROOT_ID)" \
84 --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
85 stylesheets/blfs-nochunks.xsl $(RENDERTMP)/blfs-html.xml
86
87 @echo "Running Tidy and obfuscate.sh on non-chunked XHTML..."
88 $(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
89 $(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
90 $(Q)sed -i -e "s@text/html@application/xhtml+xml@g" \
91 $(BASEDIR)/$(NOCHUNKS_OUTPUT)
92
93tmpdir: $(RENDERTMP)
94$(RENDERTMP):
95 @echo "Creating $(RENDERTMP)"
96 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
97
98clean:
99 @echo "Cleaning $(RENDERTMP)"
100 $(Q)rm -f $(RENDERTMP)/blfs-{full,html,pdf}.xml
101 $(Q)rm -f $(RENDERTMP)/blfs-pdf.fo
102 $(Q)rm -f $(RENDERTMP)/blfs-{patch-list,patches}
103 $(Q)rmdir $(RENDERTMP) 2>/dev/null || :
104
105validxml: $(RENDERTMP)/blfs-full.xml
106$(RENDERTMP)/blfs-full.xml: general.ent $(ALLXML) $(ALLXSL)
107 @echo "Validating the book..."
108 $(Q)[ -d $(RENDERTMP) ] || mkdir -p $(RENDERTMP)
109 $(Q)xmllint --nonet --noent --xinclude --postvalid \
110 -o $(RENDERTMP)/blfs-full.xml index.xml
111
112profile-html: $(RENDERTMP)/blfs-html.xml
113$(RENDERTMP)/blfs-html.xml: $(RENDERTMP)/blfs-full.xml
114 @echo "Generating profiled XML for XHTML..."
115 $(Q)xsltproc --nonet --stringparam profile.condition html \
116 --output $(RENDERTMP)/blfs-html.xml stylesheets/lfs-xsl/profile.xsl \
117 $(RENDERTMP)/blfs-full.xml
118
119blfs-patch-list: blfs-patches.sh
120 @echo "Generating blfs patch list..."
121 $(Q)awk '{if ($$1 == "copy") {sub(/.*\//, "", $$2); print $$2}}' \
122 blfs-patches.sh > blfs-patch-list
123
124blfs-patches.sh: $(RENDERTMP)/blfs-full.xml
125 @echo "Generating blfs patch script..."
126 $(Q)xsltproc --nonet --output blfs-patches.sh \
127 stylesheets/patcheslist.xsl $(RENDERTMP)/blfs-full.xml
128
129wget-list: $(BASEDIR)/wget-list
130$(BASEDIR)/wget-list: $(RENDERTMP)/blfs-full.xml
131 @echo "Generating wget list..."
132 $(Q)mkdir -p $(BASEDIR)
133 $(Q)xsltproc --nonet --output $(BASEDIR)/wget-list \
134 stylesheets/wget-list.xsl $(RENDERTMP)/blfs-full.xml
135
136test-links: $(BASEDIR)/test-links
137$(BASEDIR)/test-links: $(RENDERTMP)/blfs-full.xml
138 @echo "Generating test-links file..."
139 $(Q)mkdir -p $(BASEDIR)
140 $(Q)xsltproc --nonet --stringparam list_mode full \
141 --output $(BASEDIR)/test-links stylesheets/wget-list.xsl \
142 $(RENDERTMP)/blfs-full.xml
143
144 @echo "Checking URLs, first pass..."
145 $(Q)rm -f $(BASEDIR)/{good,bad,true_bad}_urls
146 $(Q)for URL in `cat $(BASEDIR)/test-links`; do \
147 wget --spider --tries=2 --timeout=60 $$URL >>/dev/null 2>&1; \
148 if test $$? -ne 0 ; then echo $$URL >> $(BASEDIR)/bad_urls ; \
149 else echo $$URL >> $(BASEDIR)/good_urls 2>&1; \
150 fi; \
151 done
152
153 @echo "Checking URLs, second pass..."
154 $(Q)for URL2 in `cat $(BASEDIR)/bad_urls`; do \
155 wget --spider --tries=2 --timeout=60 $$URL2 >>/dev/null 2>&1; \
156 if test $$? -ne 0 ; then echo $$URL2 >> $(BASEDIR)/true_bad_urls ; \
157 else echo $$URL2 >> $(BASEDIR)/good_urls 2>&1; \
158 fi; \
159 done
160
161dump-commands: $(DUMPDIR)
162$(DUMPDIR): $(RENDERTMP)/blfs-full.xml
163 @echo "Dumping book commands..."
164 $(Q)xsltproc --output $(DUMPDIR)/ \
165 stylesheets/dump-commands.xsl $(RENDERTMP)/blfs-full.xml
166 $(Q)touch $(DUMPDIR)
167
168validate:
169 @echo "Validating the book..."
170 $(Q)xmllint --noout --nonet --xinclude --postvalid index.xml
171
172.PHONY: blfs all world html pdf nochunks tmpdir clean validxml \
173 profile-html wget-list test-links dump-commands validate
Note: See TracBrowser for help on using the repository browser.